Computer Assited Medical Intervention Tool Kit  version 4.1
Public Member Functions | Private Attributes | List of all members
Atom Class Reference

An atom has an unique index in the physical model object, a 3D position, and different basic properties. More...

#include <Atom.h>

Inherits Structure.

Public Member Functions

 Atom (PhysicalModel *myPM)
 Default constructor : set the position to the origin, generate a unique index. More...
 
 Atom (PhysicalModel *myPM, physicalModel::Atom atom, unsigned int id=-1)
 constructor from xml node: try to read and get the parameters from xml and set the index in atom SC (if possible) More...
 
 Atom (PhysicalModel *myPM, const double pos[3])
 constructor : generate a unique index More...
 
 Atom (PhysicalModel *myPM, const unsigned int ind)
 set the position to the origin More...
 
 Atom (PhysicalModel *myPM, const unsigned int ind, const double pos[3])
 constructor : generate a unique index More...
 
unsigned int getIndexInAtoms () const
 get the index of this atom in the global atom structural component, i.e. its order number in atoms More...
 
void getPosition (double pos[3]) const
 get the position of the atom (array of 3 doubles) More...
 
AtomPropertiesgetProperties () const
 Get a ptr to the AtomProperties. More...
 
bool isInstanceOf (const char *) const override
 return true only if the parameter is equal to "Atom" More...
 
bool setIndex (const unsigned int) override
 set the index. 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 xmlPrint (std::ostream &, const StructuralComponent *) override
 print to an output stream in "pseudo" XML format. More...
 
 ~Atom () override
 std destructor More...
 
- Public Member Functions inherited from Structure
virtual void addStructuralComponent (StructuralComponent *)
 add a particular StructuralComponent in the list More...
 
std::vector< StructuralComponent * > getAllStructuralComponents ()
 get the list of all the StructuralComponent that are using this structure More...
 
unsigned int getIndex () const
 get the structure unique index (stored in its property) More...
 
std::string getName () const
 get the name of the structure More...
 
unsigned int getNumberOfStructuralComponents () const
 get the number of StructuralComponent that are using this structure More...
 
StructuralComponentgetStructuralComponent (unsigned int i)
 get a particular StructuralComponent that is using this structure More...
 
StructureProperties::GeometricType getType () const
 get the type of index More...
 
void removeStructuralComponent (StructuralComponent *)
 remove a particular StructuralComponent from the list More...
 
void setName (std::string)
 set the name of the structure More...
 
virtual void setPhysicalModel (PhysicalModel *)
 set the physical model More...
 
 Structure ()
 Base constructor. More...
 
virtual ~Structure ()=default
 Virtual destructor needed here as this is an abstract class (pure virtual) More...
 

Private Attributes

unsigned int indexInAtoms
 

Additional Inherited Members

- Public Attributes inherited from Structure
bool hasIndex
 indicate if the Structure has an index (which is not the case all the time) More...
 
- Protected Attributes inherited from Structure
StructurePropertiesproperties {nullptr}
 Property of the current structure. More...
 

Detailed Description

An atom has an unique index in the physical model object, a 3D position, and different basic properties.

It is the most basic structure composing a physical model. It is on an atoms that the forces and loads could be applied in order to generate dynamics.

Constructor & Destructor Documentation

◆ Atom() [1/5]

Atom::Atom ( PhysicalModel myPM)

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

Parameters
myPMthe physical model the atom belongs to

References Structure::properties.

◆ Atom() [2/5]

Atom::Atom ( PhysicalModel myPM,
physicalModel::Atom  atom,
unsigned int  id = -1 
)

constructor from xml node: try to read and get the parameters from xml and set the index in atom SC (if possible)

Parameters
myPMthe physical model the atom belongs to
atomthe xsd class representing the atom to read information from.
idthe index in the atoms structural component (useful to directly access the memory block corresponding to the position)
See also
getIndexInAtoms()

References indexInAtoms, and Structure::properties.

◆ Atom() [3/5]

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

constructor : generate a unique index

Parameters
myPMthe physical model the atom belongs to
posthe initial position of the created atom (array of 3 double)

References Structure::properties.

◆ Atom() [4/5]

Atom::Atom ( PhysicalModel myPM,
const unsigned int  ind 
)

set the position to the origin

Parameters
myPMthe physical model the atom belongs to
indgive the unique index

References Structure::properties.

◆ Atom() [5/5]

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

constructor : generate a unique index

Parameters
myPMthe physical model the atom belongs to
indgive the unique index
posthe initial position of the created atom (array of 3 double)

References Structure::properties.

◆ ~Atom()

Atom::~Atom ( )
override

std destructor

References Structure::properties.

Member Function Documentation

◆ getIndexInAtoms()

unsigned int Atom::getIndexInAtoms ( ) const

get the index of this atom in the global atom structural component, i.e. its order number in atoms

References indexInAtoms.

Referenced by PhysicalModel::getPositionPointer().

◆ getPosition()

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

◆ getProperties()

AtomProperties * Atom::getProperties ( ) const
inline

◆ isInstanceOf()

bool Atom::isInstanceOf ( const char *  className) const
inlineoverridevirtual

return true only if the parameter is equal to "Atom"

Implements Structure.

◆ setIndex()

bool Atom::setIndex ( const unsigned int  index)
overridevirtual

set the index.

The index have to be unique otherwise this method has no effect. The sub-classes method will check that this index is not in use.

Returns
true only if the index of the structure was changed

Reimplemented from Structure.

References PhysicalModel::addGlobalIndexAtomPair(), Properties::getPhysicalModel(), Structure::properties, and Structure::setIndex().

◆ setPosition() [1/2]

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

set the position of the atom

Referenced by PhysicalModel::setAtomPosition(), and Simulator::updatePositions().

◆ setPosition() [2/2]

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

set the position of the atom

◆ xmlPrint()

void Atom::xmlPrint ( std::ostream &  o,
const StructuralComponent sc 
)
overridevirtual

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

Implements Structure.

References PhysicalModel::getAtoms(), Structure::getIndex(), Properties::getPhysicalModel(), and Structure::properties.

Member Data Documentation

◆ indexInAtoms

unsigned int Atom::indexInAtoms
private

Referenced by Atom(), and getIndexInAtoms().


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