620 xmlNodePtr cur = xmlNewNode(NULL, (
const xmlChar*)
"particleset");
621 xmlNewProp(cur, (
const xmlChar*)
"name", (
const xmlChar*)
ref_.
getName().c_str());
625 int nitem(mySpecies.numAttributes());
626 int nspecies(mySpecies.getTotalNum());
627 for (
int is = 0; is < nspecies; is++)
629 std::ostringstream ng;
631 xmlNodePtr g = xmlNewNode(NULL, (
const xmlChar*)
"group");
632 xmlNewProp(g, (
const xmlChar*)
"name", (
const xmlChar*)
SpeciesName[is].c_str());
633 xmlNewProp(g, (
const xmlChar*)
"size", (
const xmlChar*)ng.str().c_str());
634 for (
int item = 0; item < nitem; item++)
636 std::ostringstream prop;
637 prop << mySpecies(item, is);
638 xmlNodePtr p = xmlNewTextChild(g, NULL, (
const xmlChar*)
"parameter", (
const xmlChar*)prop.str().c_str());
639 xmlNewProp(p, (
const xmlChar*)
"name", (
const xmlChar*)mySpecies.attribName[item].c_str());
641 std::ostringstream pos;
642 pos.setf(std::ios_base::scientific);
646 pos <<
ref_.
R[iat] << std::endl;
648 xmlNodePtr posPtr = xmlNewTextChild(g, NULL, (
const xmlChar*)
"attrib", (
const xmlChar*)pos.str().c_str());
649 xmlNewProp(posPtr, (
const xmlChar*)
"name", (
const xmlChar*)
"position");
650 xmlNewProp(posPtr, (
const xmlChar*)
"datatype", (
const xmlChar*)
"posArray");
656 std::ostringstream nat;
658 xmlNewProp(cur, (
const xmlChar*)
"size", (
const xmlChar*)nat.str().c_str());
660 int nitem(mySpecies.numAttributes());
661 int nspecies(mySpecies.getTotalNum());
662 for (
int is = 0; is < nspecies; is++)
664 xmlNodePtr g = xmlNewNode(NULL, (
const xmlChar*)
"group");
665 xmlNewProp(g, (
const xmlChar*)
"name", (
const xmlChar*)
SpeciesName[is].c_str());
666 for (
int item = 0; item < nitem; item++)
668 std::ostringstream prop;
669 prop << mySpecies(item, is);
670 xmlNodePtr p = xmlNewTextChild(g, NULL, (
const xmlChar*)
"parameter", (
const xmlChar*)prop.str().c_str());
671 xmlNewProp(p, (
const xmlChar*)
"name", (
const xmlChar*)mySpecies.attribName[item].c_str());
675 std::ostringstream pos, gid;
676 pos.setf(std::ios_base::scientific);
680 pos <<
ref_.
R[iat] << std::endl;
682 xmlNodePtr posPtr = xmlNewTextChild(cur, NULL, (
const xmlChar*)
"attrib", (
const xmlChar*)pos.str().c_str());
683 xmlNewProp(posPtr, (
const xmlChar*)
"name", (
const xmlChar*)
"position");
684 xmlNewProp(posPtr, (
const xmlChar*)
"datatype", (
const xmlChar*)
"posArray");
691 xmlNodePtr gPtr = xmlNewTextChild(cur, NULL, (
const xmlChar*)
"attrib", (
const xmlChar*)gid.str().c_str());
692 xmlNewProp(gPtr, (
const xmlChar*)
"name", (
const xmlChar*)
"ionid");
693 xmlNewProp(gPtr, (
const xmlChar*)
"datatype", (
const xmlChar*)
"stringArray");
const std::string & getName() const
return the name
size_t getTotalNum() const
int first(int igroup) const
return the first index of a group i
std::vector< std::string > SpeciesName
ParticleIndex GroupID
Species ID.
int getTotalNum() const
return the number of species
int groups() const
return the number of groups
int last(int igroup) const
return the last index of a group i
SpeciesSet & getSpeciesSet()
retrun the SpeciesSet of this particle set
std::vector< std::string > speciesName
Species name list.