MCPcopy Create free account
hub / github.com/NatLabRockies/SAM / Write_JSON

Method Write_JSON

src/variables.cpp:840–865  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

838
839
840bool VarTable::Write_JSON(const std::string& file, const wxArrayString& asCalculated, const wxArrayString& asIndicator, const size_t maxdim)
841{
842 rapidjson::Document doc;
843 Write_JSON(doc, asCalculated, asIndicator, maxdim);
844
845
846 // TODO - hybrids - write out based on compute modules similar to test input files for cmod_hybrid_test.cpp
847 rapidjson::StringBuffer os;
848 // SAM issue 1856 handle writing inf and nan
849 rapidjson::PrettyWriter<rapidjson::StringBuffer,rapidjson::UTF8<char>,rapidjson::UTF8<char>,rapidjson::CrtAllocator, rapidjson::kWriteNanAndInfFlag> writer(os); // MSPT/MP 64MB JSON, 6.7MB txt, JSON Zip 242kB
850 //writer.SetMaxDecimalPlaces(6); // sets small values (e.g. 2.3e-8 to zero so cannot use
851 doc.Accept(writer);
852 wxString sfn = file;
853 wxFileName fn(sfn);
854 //sfn.Replace(".json", ".zip");
855 wxFFileOutputStream out(sfn);
856 out.Write(os.GetString(), os.GetSize());
857 out.Close();
858 /* compressed JSON
859 wxZipOutputStream zip(out);
860 zip.PutNextEntry(fn.GetFullName());
861 zip.Write(os.GetString(), os.GetSize());
862 zip.Close();
863 */
864 return true;
865}
866
867void VarTable::Write_JSON(rapidjson::Document& doc, const wxArrayString& asCalculated, const wxArrayString& asIndicator, const size_t maxdim)
868{

Callers 1

Write_JSON_ConstantMethod · 0.45

Calls 15

GetFunction · 0.85
SetObjectMethod · 0.80
SortMethod · 0.80
CountMethod · 0.80
TypeMethod · 0.80
nrowsMethod · 0.80
MatrixMethod · 0.80
ncolsMethod · 0.80
sizeMethod · 0.80
wxArrayStringClass · 0.70
WriteMethod · 0.45

Tested by

no test coverage detected