[cig-commits] commit: Add in special logic for manualParticlePositions
Mercurial
hg at geodynamics.org
Sun Nov 20 23:10:59 PST 2011
changeset: 411:bf3845257573
user: Walter Landry <wlandry at caltech.edu>
date: Sun Nov 20 13:12:45 2011 -0800
files: json_parser/print_xml.cxx
description:
Add in special logic for manualParticlePositions
diff -r b7eef633f548 -r bf3845257573 json_parser/print_xml.cxx
--- a/json_parser/print_xml.cxx Sun Nov 20 13:11:54 2011 -0800
+++ b/json_parser/print_xml.cxx Sun Nov 20 13:12:45 2011 -0800
@@ -50,7 +50,7 @@ void print_xml(std::ostream &os, const s
os << start << end;
break;
case json_spirit::obj_type:
- fix_start_end("struct",name,start,end);
+ fix_start_end("struct",name,start,end);
os << start;
for(json_spirit::Object::const_iterator i=o.get_obj().begin();
i!=o.get_obj().end(); ++i)
@@ -60,12 +60,35 @@ void print_xml(std::ostream &os, const s
os << end;
break;
case json_spirit::array_type:
- fix_start_end("list",name,start,end);
+ fix_start_end("list",name,start,end);
os << start;
- for(json_spirit::Array::const_iterator i=o.get_array().begin();
- i!=o.get_array().end(); ++i)
+ if(name=="manualParticlePositions")
{
- print_xml(os,*i);
+ os << "<asciidata>\n"
+ << "<columnDefinition name=\"x\" type=\"double\"/>\n"
+ << "<columnDefinition name=\"y\" type=\"double\"/>\n"
+ << "<columnDefinition name=\"z\" type=\"double\"/>\n";
+ for(json_spirit::Array::const_iterator i=o.get_array().begin();
+ i!=o.get_array().end(); ++i)
+ {
+ if(i->type()==json_spirit::int_type)
+ {
+ os << i->get_int() << " ";
+ }
+ else
+ {
+ os << i->get_real() << " ";
+ }
+ }
+ os << "</asciidata>\n";
+ }
+ else
+ {
+ for(json_spirit::Array::const_iterator i=o.get_array().begin();
+ i!=o.get_array().end(); ++i)
+ {
+ print_xml(os,*i);
+ }
}
os << end;
break;
More information about the CIG-COMMITS
mailing list