Computer Assisted Medical Intervention Tool Kit  version 6.0
Loading...
Searching...
No Matches
AtomProperties Class Reference

This class manages all the properties attached to an atom. More...

#include <AtomProperties.h>

Public Member Functions

 AtomProperties (PhysicalModel *myPM)
 Default constructor : set the position to the origin, and generate an unique index.
 AtomProperties (PhysicalModel *myPM, const double pos[3])
 generate an unique index.
 AtomProperties (PhysicalModel *myPM, const unsigned int ind)
 set the position to the origin
 AtomProperties (PhysicalModel *myPM, const unsigned int ind, const double pos[3])
 everything is given here
 AtomProperties (PhysicalModel *myPM, physicalModel::AtomProperties xmlAtomProp)
 constructor from xml node: try to read and get the properties from xml
void getPosition (double pos[3]) const
 get the position of the atom (array of 3 doubles)
void setPosition (const double, const double, const double)
 set the position of the atom
void setPosition (const double[3])
 set the position of the atom
void setPositionPointer (double *ptr, bool update=true)
 change the position pointer.
virtual void xmlPrint (std::ostream &)
 print to an output stream in "pseudo" XML format.
 ~AtomProperties () override
 the destructor...
Public Member Functions inherited from StructureProperties
unsigned int getIndex () const
 return the unique index in the global structure
GeometricType getType () const
 Return the type of force.
void setIndex (const unsigned int)
 set the index (BECAREFUL: it MUST be unique !!!)
void setType (const GeometricType t)
 Set the force type.
 StructureProperties (PhysicalModel *, const GeometricType)
 the only default constructor : type must be set
void xmlPrint (std::ostream &) const
 print to an output stream in "pseaudo" XML format.
 ~StructureProperties ()=default
Public Member Functions inherited from Properties
std::string getName () const
 get the name (be careful, this method DOES NOT return a copy, so you got the direct ptr to the name!!!)
PhysicalModelgetPhysicalModel () const
 get the physical model
 Properties (const std::string n="")
 A nice simple constructor, with a given name.
 Properties (PhysicalModel *, const std::string n="")
 Another nice constructor, with the PM and a name.
void setName (std::string)
 set the name (use the string = operator)
void setPhysicalModel (PhysicalModel *)
 set the physical model
virtual ~Properties ()=default
 The default destructor.
void xmlToFields (xsd::cxx::tree::attribute_set< char > attrs)
 convert the xml node parameters to data fields
unsigned int numberOfFields () const
 get the number of extra fields found in the PML
bool isAField (std::string attName) const
 check if the field exist in the XML document, return false if it does not
std::string getField (unsigned int) const
 get the name of field of given index
double getDouble (std::string attName)
 field accessor: get the field attName as a double value, if field does not exist, 0.0 is return
int getInt (std::string attName) const
 field accessor: get the field attName as an int value, if field does not exist, 0 is return
bool getBool (std::string attName) const
 field accessor: get the field attName as a bool value, if field does not exist, false is return
std::string getString (std::string attName) const
 field accessor: get the field attName as a string value, if field does not exist, empty string is return
void get (std::string attName, std::string &attVal) const
 field accessor: get the field attName as a string value in attVal, if field does not exist, empty string is return
void set (std::string attName, double val)
 field modificator: set field attName using a double value
void set (std::string attName, int val)
 field modificator: set field attName using an int value
void set (std::string attName, bool val)
 field modificator: set field attName using a bool value
void set (std::string attName, std::string val)
 field modificator: set field attName using a string value

Static Public Member Functions

static void resetUniqueIndex ()
 Reinitialize the unique index to zero (usually that what you want to do when you start to load a new PhysicalModel.
Static Public Member Functions inherited from StructureProperties
static std::string toString (const GeometricType)
 return the string equivalent to this geometric type
static GeometricType toType (const std::string)
 return the enum corresponding to this string

Additional Inherited Members

Public Types inherited from StructureProperties
enum  GeometricType {
  INVALID , ATOM , LINE , TRIANGLE ,
  QUAD , TETRAHEDRON , WEDGE , PYRAMID ,
  HEXAHEDRON , POLY_LINE , POLY_VERTEX
}
 Geometric type gives information about which kind of geometric representation is the structure. More...
Protected Attributes inherited from StructureProperties
unsigned int index
 unique index in the global structure
std::map< std::string, std::string > fields
 map containing all the different fields (name, value stored as string )

Detailed Description

This class manages all the properties attached to an atom.

Constructor & Destructor Documentation

◆ AtomProperties() [1/5]

AtomProperties::AtomProperties ( PhysicalModel * myPM)

Default constructor : set the position to the origin, and generate an unique index.

Parameters
myPMthe physical model the atom belongs to

References StructureProperties::ATOM, StructureProperties::index, setPosition(), and StructureProperties::StructureProperties().

◆ AtomProperties() [2/5]

AtomProperties::AtomProperties ( PhysicalModel * myPM,
physicalModel::AtomProperties xmlAtomProp )

constructor from xml node: try to read and get the properties from xml

Parameters
myPMthe physical model the atom belongs to
xmlAtomPropthe xsd node of properties for this atom.

References StructureProperties::ATOM, StructureProperties::setIndex(), Properties::setName(), setPosition(), StructureProperties::StructureProperties(), and Properties::xmlToFields().

◆ AtomProperties() [3/5]

AtomProperties::AtomProperties ( PhysicalModel * myPM,
const unsigned int ind )

set the position to the origin

Parameters
myPMthe physical model the atom belongs to
indan unique index

References StructureProperties::ATOM, StructureProperties::index, setPosition(), and StructureProperties::StructureProperties().

◆ AtomProperties() [4/5]

AtomProperties::AtomProperties ( PhysicalModel * myPM,
const double pos[3] )

generate an unique index.

Parameters
myPMthe physical model the atom belongs to
posthe initial position

References StructureProperties::ATOM, StructureProperties::index, setPosition(), and StructureProperties::StructureProperties().

◆ AtomProperties() [5/5]

AtomProperties::AtomProperties ( PhysicalModel * myPM,
const unsigned int ind,
const double pos[3] )

everything is given here

Parameters
myPMthe physical model the atom belongs to
posthe initial position
indan unique index

References StructureProperties::ATOM, StructureProperties::index, setPosition(), and StructureProperties::StructureProperties().

◆ ~AtomProperties()

AtomProperties::~AtomProperties ( )
override

the destructor...

Member Function Documentation

◆ getPosition()

void AtomProperties::getPosition ( double pos[3]) const
inline

get the position of the atom (array of 3 doubles)

Referenced by Atom::getPosition(), and setPositionPointer().

◆ resetUniqueIndex()

void AtomProperties::resetUniqueIndex ( )
static

Reinitialize the unique index to zero (usually that what you want to do when you start to load a new PhysicalModel.

◆ setPosition() [1/2]

void AtomProperties::setPosition ( const double x,
const double y,
const double z )
inline

set the position of the atom

◆ setPosition() [2/2]

void AtomProperties::setPosition ( const double pos[3])
inline

◆ setPositionPointer()

void AtomProperties::setPositionPointer ( double * ptr,
bool update = true )

change the position pointer.

This is useful to allocate a big bunch of memory with all the position in order to improve memory cache usage.

Note
this memory is not deleted/cleaned in ~AtomProperties (the destructor)
Parameters
ptrthe pointer to the memory (should have enough space for storing double[3]
updateupdate the new memory space using the previously stored position

References getPosition(), and setPosition().

◆ xmlPrint()

void AtomProperties::xmlPrint ( std::ostream & o)
virtual

print to an output stream in "pseudo" XML format.

References Properties::fields, Properties::getName(), and StructureProperties::index.


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