Computer Assited Medical Intervention Tool Kit  version 3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
BasicAtomProperties Class Referenceabstract

This class is the basic Atom Properties class. More...

#include <BasicAtomProperties.h>

+ Inheritance diagram for BasicAtomProperties:

Public Member Functions

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

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. More...
 
- Static Public Member Functions inherited from StructureProperties
static std::string toString (const GeometricType)
 return the string equivalent to this geometric type More...
 
static GeometricType toType (const std::string)
 return the enum corresponding to this string More...
 

Protected Member Functions

void beginXML (std::ostream &)
 write the default xml properties (beginning) More...
 
void endXML (std::ostream &)
 write the default xml properties (end) More...
 

Private Member Functions

void allocate ()
 allocate the memory needed for the position (double[3]). More...
 

Private Attributes

bool allocated
 true only if the memory used for the position was allocated in the constructor and not changed afterwards More...
 
double * X
 Pointer to the memory triplet that stores the atom's position. More...
 

Static Private Attributes

static unsigned int maxUniqueIndex
 unique number (used to generate unique index for atoms if not given at the instanciation) More...
 

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 More...
 
- Protected Attributes inherited from Properties
std::map< std::string,
std::string
fields
 map containing all the different fields (name, value stored as string ) More...
 

Detailed Description

This class is the basic Atom Properties class.

You should derive from this class a AtomProperties class and use it to implement your own custom stuff. This is a pure virtual class.

Constructor & Destructor Documentation

BasicAtomProperties::BasicAtomProperties ( PhysicalModel myPM)

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

Parameters
myPMthe physical model the atom belongs to
BasicAtomProperties::BasicAtomProperties ( PhysicalModel myPM,
xmlNodePtr  n 
)

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

Parameters
myPMthe physical model the atom belongs to
nthe xml node to read to get the information
BasicAtomProperties::BasicAtomProperties ( PhysicalModel myPM,
const unsigned int  ind 
)

set the position to the origin

Parameters
myPMthe physical model the atom belongs to
indan unique index
BasicAtomProperties::BasicAtomProperties ( PhysicalModel myPM,
const double  pos[3] 
)

generate an unique index.

Parameters
myPMthe physical model the atom belongs to
posthe initial position
BasicAtomProperties::BasicAtomProperties ( 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
virtual BasicAtomProperties::~BasicAtomProperties ( )
virtual

the destructor...

Member Function Documentation

void BasicAtomProperties::allocate ( )
private

allocate the memory needed for the position (double[3]).

This place in memory is a default, it can be changed using setPositionPointer(..). This method is called in all the constructors, and only there.

void BasicAtomProperties::beginXML ( std::ostream &  )
protected

write the default xml properties (beginning)

void BasicAtomProperties::endXML ( std::ostream &  )
protected

write the default xml properties (end)

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

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

References X.

Referenced by Atom::getPosition().

static void BasicAtomProperties::resetUniqueIndex ( )
static

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

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

set the position of the atom

References X.

Referenced by Atom::setPosition().

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

set the position of the atom

References X.

void BasicAtomProperties::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 ~BasicAtomProperties (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
virtual void BasicAtomProperties::xmlPrint ( std::ostream &  )
pure virtual

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

Implemented in AtomProperties.

Member Data Documentation

bool BasicAtomProperties::allocated
private

true only if the memory used for the position was allocated in the constructor and not changed afterwards

unsigned int BasicAtomProperties::maxUniqueIndex
staticprivate

unique number (used to generate unique index for atoms if not given at the instanciation)

double* BasicAtomProperties::X
private

Pointer to the memory triplet that stores the atom's position.

Referenced by getPosition(), and setPosition().


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