QMCPACK
AttribListType Class Reference
+ Inheritance diagram for AttribListType:
+ Collaboration diagram for AttribListType:

Public Member Functions

 AttribListType ()
 objects created by getXYZAttrib(aname) More...
 
template<typename AT >
int add (ParticleAttrib< AT > &pa)
 add ParticleAttrib<AT> More...
 
int getAttribType (const std::string &tname)
 return a type id: one of the enum values More...
 
template<typename AT >
ParticleAttrib< AT > * getAttribute (const std::string &tname, const std::string &oname)
 generic get function attribute function More...
 

Private Attributes

std::map< std::string, int > AttribTypeMap
 
std::map< std::string, OhmmsObject * > AttribList
 

Additional Inherited Members

- Public Types inherited from ParticleTags
enum  {
  PA_IndexType = 0, PA_ScalarType, PA_StringType, PA_PositionType,
  PA_TensorType, PA_UnkownType
}
 enumeraton for datatypes for particle attributes More...
 
- Static Public Attributes inherited from ParticleTags
static std::string null_tag = "null"
 type names of particle attributes, e.g., posArray More...
 
static std::string indextype_tag = "indexArray"
 the datatype tag for the index-type attribute More...
 
static std::string scalartype_tag = "scalarArray"
 the datatype tag for the scalar-type attribute More...
 
static std::string stringtype_tag = "stringArray"
 the datatype tag for the string-type attribute More...
 
static std::string postype_tag = "posArray"
 the datatype tag for the pos-type attribute More...
 
static std::string gradtype_tag = "gradArray"
 the datatype tag for the gradient-type attribute More...
 
static std::string laptype_tag = "lapArray"
 the datatype tag for the laplacian-type attribute More...
 
static std::string tensortype_tag = "tensorArray"
 the datatype tag for the tensor-type attribute More...
 
static std::string xmoltype_tag = "xmolArray"
 the datatype tag for the xmol-type attribute More...
 
static std::string position_tag = "position"
 names of particle attributes, e.g., position More...
 
static std::string spins_tag = "spins"
 the name for spins attribute More...
 
static std::string id_tag = "id"
 the name for id attribute More...
 
static std::string ionid_tag = "ionid"
 the name for ionid attribute More...
 
static std::string trajectory_tag = "trajectory"
 the name for trajectory attribute More...
 
static std::string force_tag = "f"
 the name for force attribute More...
 
static std::string velocity_tag = "v"
 the name for velocity attribute More...
 
static std::string energy_tag = "e"
 the name for energy attribute More...
 
static std::string sumbc_tag = "sumbc"
 the name for sumbc (accumulative boundary crossings) attribute More...
 
static std::string root_tag = "particleset"
 xml element names More...
 
static std::string attrib_tag = "attrib"
 the name of particle attribute node More...
 
static std::string name_tag = "name"
 the attribute name of name More...
 
static std::string datatype_tag = "datatype"
 the attribute name of datatype More...
 
static std::string condition_tag = "condition"
 the attribute name of condition More...
 
static std::string size_tag = "size"
 the attribute name of size More...
 
static std::string format_tag = "format"
 the attribute name of format More...
 
static std::string role_tag = "role"
 the attribute name of role More...
 

Detailed Description

Definition at line 24 of file XMLParticleIO.h.

Constructor & Destructor Documentation

◆ AttribListType()

AttribListType ( )
inline

objects created by getXYZAttrib(aname)

Definition at line 32 of file XMLParticleIO.h.

References AttribListType::AttribTypeMap, ParticleTags::indextype_tag, ParticleTags::PA_IndexType, ParticleTags::PA_PositionType, ParticleTags::PA_ScalarType, ParticleTags::PA_StringType, ParticleTags::PA_TensorType, ParticleTags::postype_tag, ParticleTags::scalartype_tag, ParticleTags::stringtype_tag, and ParticleTags::tensortype_tag.

33  {
34  //map[type-name] to enum
40  }
static std::string indextype_tag
the datatype tag for the index-type attribute
Definition: ParticleTags.h:55
static std::string postype_tag
the datatype tag for the pos-type attribute
Definition: ParticleTags.h:64
static std::string tensortype_tag
the datatype tag for the tensor-type attribute
Definition: ParticleTags.h:73
static std::string stringtype_tag
the datatype tag for the string-type attribute
Definition: ParticleTags.h:61
std::map< std::string, int > AttribTypeMap
Definition: XMLParticleIO.h:26
static std::string scalartype_tag
the datatype tag for the scalar-type attribute
Definition: ParticleTags.h:58

Member Function Documentation

◆ add()

int add ( ParticleAttrib< AT > &  pa)
inline

add ParticleAttrib<AT>

Template Parameters
ATany element type, int, double, float ...

Definition at line 54 of file XMLParticleIO.h.

References AttribListType::AttribList, OhmmsObject::objName(), and OhmmsObject::setID().

55  {
56  int oid = AttribList.size();
57  std::map<std::string, OhmmsObject*>::iterator it = AttribList.find(pa.objName());
58  if (it == AttribList.end())
59  {
60  AttribList[pa.objName()] = &pa;
61  pa.setID(oid);
62  }
63  else
64  {
65  oid = (*it).second->id();
66  }
67  return oid;
68  }
std::map< std::string, OhmmsObject * > AttribList
Definition: XMLParticleIO.h:27

◆ getAttribType()

int getAttribType ( const std::string &  tname)
inline

return a type id: one of the enum values

Definition at line 71 of file XMLParticleIO.h.

References AttribListType::AttribTypeMap.

Referenced by XMLParticleParser::getPtclAttrib().

71 { return AttribTypeMap[tname]; }
std::map< std::string, int > AttribTypeMap
Definition: XMLParticleIO.h:26

◆ getAttribute()

ParticleAttrib<AT>* getAttribute ( const std::string &  tname,
const std::string &  oname 
)
inline

generic get function attribute function

Parameters
tnameattribute type name
onameattribute name
Returns
pointer to the attribute

Definition at line 79 of file XMLParticleIO.h.

References AttribListType::AttribList.

Referenced by XMLParticleParser::getPtclAttrib().

80  {
81  using attrib_type = ParticleAttrib<AT>;
82  const auto it = AttribList.find(oname);
83  if (it != AttribList.end())
84  {
85  OhmmsObject* o = (*it).second;
86  return dynamic_cast<attrib_type*>(o);
87  }
88  else
89  throw std::runtime_error("AttribListType::getAttribute Unknown attribute " + oname + "\n");
90  return nullptr;
91  }
std::map< std::string, OhmmsObject * > AttribList
Definition: XMLParticleIO.h:27
An OhmmsElementBase with extra members to keep track the object/type.
Definition: OhmmsObject.h:43

Member Data Documentation

◆ AttribList

std::map<std::string, OhmmsObject*> AttribList
private

Definition at line 27 of file XMLParticleIO.h.

Referenced by AttribListType::add(), and AttribListType::getAttribute().

◆ AttribTypeMap

std::map<std::string, int> AttribTypeMap
private

The documentation for this class was generated from the following file: