26 #ifndef PHYSICALMODEL_H
27 #define PHYSICALMODEL_H
44 #if defined(_WIN32) && !defined(__MINGW32__) // MSVC only
45 #pragma warning( disable : 4290 )
55 typedef std::pair<unsigned int, Structure *> GlobalIndexStructurePair;
60 typedef std::map <unsigned int, Structure *> GlobalIndexStructureMap;
62 typedef std::map <unsigned int, Structure *> ::iterator GlobalIndexStructureMapIterator;
129 void xmlPrint(std::ostream &o,
bool opt=
false);
237 virtual void setProgress(
const float donePercentage);
366 if (quickAccessed && quickAccessed->
getIndex()==id) {
367 return quickAccessed;
371 std::GlobalIndexStructureMapIterator mapIt;
375 return ( (mapIt ==
atomMap.end()) ? NULL : (
Atom *) mapIt->second );
385 std::GlobalIndexStructureMapIterator mapIt;
388 mapIt =
cellMap.find(cellIndex);
391 return ( (mapIt ==
cellMap.end()) ? NULL : (
Cell *) mapIt->second );
400 std::GlobalIndexStructureMapIterator mapIt =
cellMap.begin();
402 while (mapIt !=
cellMap.end() && mapIt->second->getName()!=n) {
408 return mapIt->second;
413 while (mapIt !=
atomMap.end() && mapIt->second->getName()!=n) {
419 return mapIt->second;
virtual ~PhysicalModel()
destructor
void setAtoms(StructuralComponent *, bool deleteOld=true)
set the atom structural component.
void init()
initialization method
void clear()
Clear everything. That allows to restart an allready instanciated object from scratch.
PhysicalModel()
Default constructor : this one just initialize everything.
Properties * properties
all physical model properties
Definition: PhysicalModel.h:271
A cell has an unique index in the physical model object, is composed by atoms, and different basic pr...
Definition: Cell.h:41
bool cellIndexOptimized
tell if optimizedCellList can be used
Definition: PhysicalModel.h:305
bool isModified()
check if something have changed
Definition: PhysicalModel.h:341
Pure virtual class that represent an element of the structure.
Definition: Structure.h:43
void setName(std::string)
set the name (use the string = operator)
Definition: Properties.h:234
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!!...
Definition: Properties.h:230
unsigned int getNumberOfExclusiveComponents() const
get the total number of exclusive components
Cell * getCell(const unsigned int id)
get the cell that has the global index given in parameters.
Definition: PhysicalModel.h:380
unsigned int getIndex() const
get the structure unique index (stored in its property)
Describes the properties common to all structures and components.
Definition: Properties.h:57
Component * getInformativeComponent(const unsigned int) const
get an informative component by its index in the list
bool addGlobalIndexCellPair(std::GlobalIndexStructurePair)
add or update a pair to the cell map.
bool isModifiedFlag
is the current property state modified
Definition: PhysicalModel.h:274
Atom * getAtom(const unsigned int id)
Get the atom that has the global index given in parameters.
Definition: PhysicalModel.h:360
Exception class to handle abortion in the xmlReading Particularly useful to handle constructor's abor...
Definition: PMLAbortException.h:39
double * getPositionPointer() const
get the pointer to the memory space allocated for the atom's position.
PtrToSetProgressFunction setProgressFunction
the progress function
Definition: PhysicalModel.h:321
unsigned int getNumberOfCells() const
get the total nr of cell in the physical model (exclusive as well as informative) ...
void setName(const std::string)
set the name of the physical model
Definition: PhysicalModel.h:337
virtual void setProgress(const float donePercentage)
this method is called during a long process everytime a little bit of the process is finished...
Structure * getStructure(const unsigned int) const
get a structure by its index (fisrt structure is at index 0)
Definition: StructuralComponent.h:216
std::GlobalIndexStructureMap atomMap
the association couple list, which contains the direct map between the atom's global index and the at...
Definition: PhysicalModel.h:315
bool addAtom(Atom *)
Add a new atom to the atoms' structural component.
void xmlRead(const char *n)
use the XML Parser/Reader to read an XML file conform to physicalmodel.dtd
MultiComponent * exclusiveComponents
Exclusive components are the non-overlaping components : they defined all the components of the physi...
Definition: PhysicalModel.h:281
bool addGlobalIndexAtomPair(std::GlobalIndexStructurePair)
add or update a pair to the atom map.
MultiComponent * getExclusiveComponents() const
get all the exclusive components
Definition: PhysicalModel.h:349
A component is something that composed something and could also be a part of something.
Definition: modeling/libraries/pml/Component.h:48
const std::string getName() const
Return the name of the physical model.
Definition: PhysicalModel.h:333
Component * getComponentByName(const std::string n)
get a structural or multi component by its name.
unsigned int getNumberOfInformativeComponents() const
get the total number of informative components
virtual void setAtomPosition(Atom *atom, const double pos[3])
Set the new position of an atom.
void setInformativeComponents(MultiComponent *)
set the exclusive multi component. Becareful: the physical model takes control of this MultiComponent...
StructuralComponent * getAtoms() const
get all the atoms
Definition: PhysicalModel.h:355
bool parseComponents(xmlNodePtr exclusiveRoot, Component *father, bool isExclusive)
read the exclusive components list in the xml tree and build them.
An atom has an unique index in the physical model object, a 3D position, and different basic properti...
Definition: Atom.h:44
void(* PtrToSetProgressFunction)(const float donePercentage)
Definition of a function/method that could be called by the setProgress method.
Definition: PhysicalModel.h:49
void setExclusiveComponents(MultiComponent *)
set the exclusive multi component. Becareful: the physical model takes control of this MultiComponent...
This is the main class of this project.
Definition: PhysicalModel.h:74
void optimizeIndexes()
optimize atom and cell indexes so that each order number is equal to the index
unsigned int getNumberOfAtoms() const
get the number of atoms
void xmlPrint(std::ostream &o, bool opt=false)
print the physical model to an output stream in a XML format (see physicalmodel.xsd for detail about ...
double * positionPtr
the big memory space where all the atom's position are stored (it is one big block, optimizing the memory cache management). Size = 3*nrOfAtoms*sizeof(double)
Definition: PhysicalModel.h:324
bool parseAtoms(xmlNodePtr atomsRoot)
read the atom list in the xml tree and build them.
static const char * VERSION
Current PML library version.
Definition: PhysicalModel.h:93
Structure * getStructureByName(const std::string n)
get a cell using its name
Definition: PhysicalModel.h:396
std::vector< Cell * > optimizedCellList
optimized consecutive cell vector (in here optimizedCellList[i]->getIndex() == i ) ...
Definition: PhysicalModel.h:302
void setModified()
tell the physical model something has changed (for example: a property was modified/added).
Definition: PhysicalModel.h:345
string(REGEX REPLACE"^.*-(.*)-.*""\\1"ARCH"${CAMITK_CONTINUOUS_INTEGRATION}") string(REGEX REPLACE"^.*-.*-(.*)""\\1"BUILDTYPE"$
Definition: continuous.cmake:34
A structural component is composed either by cell or by atoms.
Definition: StructuralComponent.h:48
MultiComponent * informativeComponents
Informative components could be overlaping with other components : they are extra components that giv...
Definition: PhysicalModel.h:288
Properties * getProperties()
get all properties (beware of what you do with them!): please consider calling setModified().
Definition: PhysicalModel.h:329
std::GlobalIndexStructureMap cellMap
the association couple list, which contains the direct map between the cell's global index and the ce...
Definition: PhysicalModel.h:299
StructuralComponent * atoms
List of all the atoms : this is the basic stuff for a physicall model.
Definition: PhysicalModel.h:293
bool parseTree(xmlNodePtr root)
read the xml tree and call other parse methods to biuld the physicalModel.
void exportAnsysMesh(std::string filename)
Save the mesh (atoms/cells) of this PhysicalModel in the Ansys format.
A multi-component stores other components, hence providing a way to have an tree representation of co...
Definition: MultiComponent.h:44
MultiComponent * getInformativeComponents() const
get all the informative components
Definition: PhysicalModel.h:352
Component * getExclusiveComponent(const unsigned int) const
get an exclusive component by its index in the list
void exportPatran(std::string filename)
Save the geometry (atoms/cells) of this PhysicalModel in the Patran format.