26#ifndef PHYSICALMODEL_H
27#define PHYSICALMODEL_H
33class ExclusiveComponent;
34class InformativeComponent;
55#if defined(_WIN32) && !defined(__MINGW32__)
56#pragma warning( disable : 4290 )
116 const std::string
getName()
const;
118 void setName(
const std::string);
145 void xmlPrint(std::ostream& o,
bool opt =
false);
261 virtual void setProgress(
const float donePercentage);
289 bool parseTree(std::unique_ptr<physicalModel::PhysicalModel> root, std::string defaultName);
291 bool parseAtoms(physicalModel::Atoms atomsRoot);
391 if (quickAccessed && quickAccessed->
getIndex() == id) {
392 return quickAccessed;
400 return ((mapIt ==
atomMap.end()) ? nullptr : (
Atom*) mapIt->second);
413 mapIt =
cellMap.find(cellIndex);
416 return ((mapIt ==
cellMap.end()) ?
nullptr : (
Cell*) mapIt->second);
427 while (mapIt !=
cellMap.end() && mapIt->second->getName() != n) {
433 return mapIt->second;
439 while (mapIt !=
atomMap.end() && mapIt->second->getName() != n) {
445 return mapIt->second;
void(*)(const float donePercentage) PtrToSetProgressFunction
Definition of a function/method that could be called by the setProgress method.
Definition: PhysicalModel.h:60
An atom has an unique index in the physical model object, a 3D position, and different basic properti...
Definition: Atom.h:49
A cell has an unique index in the physical model object, is composed by atoms, and different basic pr...
Definition: Cell.h:46
A component is something that composed something and could also be a part of something.
Definition: modeling/libraries/pml/Component.h:48
A multi-component stores other components, hence providing a way to have an tree representation of co...
Definition: MultiComponent.h:44
This is the main class of this project.
Definition: PhysicalModel.h:86
void setModified()
tell the physical model something has changed (for example: a property was modified/added).
Definition: PhysicalModel.h:370
virtual ~PhysicalModel()
destructor
Definition: PhysicalModel.cpp:67
unsigned int getNumberOfAtoms() const
get the number of atoms
Definition: PhysicalModel.cpp:716
Properties * getProperties()
get all properties (beware of what you do with them!): please consider calling setModified().
Definition: PhysicalModel.h:354
bool isModified()
check if something have changed
Definition: PhysicalModel.h:366
void init()
initialization method
Definition: PhysicalModel.cpp:72
void exportPatran(std::string filename)
Save the geometry (atoms/cells) of this PhysicalModel in the Patran format.
Definition: PhysicalModel.cpp:896
std::GlobalIndexStructureMap atomMap
the association couple list, which contains the direct map between the atom's global index and the at...
Definition: PhysicalModel.h:340
PtrToSetProgressFunction setProgressFunction
the progress function
Definition: PhysicalModel.h:346
double * getPositionPointer() const
get the pointer to the memory space allocated for the atom's position.
Definition: PhysicalModel.cpp:145
Cell * getCell(const unsigned int id)
get the cell that has the global index given in parameters.
Definition: PhysicalModel.h:405
std::GlobalIndexStructureMap cellMap
the association couple list, which contains the direct map between the cell's global index and the ce...
Definition: PhysicalModel.h:324
unsigned int getNumberOfCells() const
get the total nr of cell in the physical model (exclusive as well as informative)
Definition: PhysicalModel.cpp:130
Component * getInformativeComponent(const unsigned int) const
get an informative component by its index in the list
Definition: PhysicalModel.cpp:736
void xmlRead(const char *n)
use the XML Parser/Reader to read an XML file conform to physicalmodel.dtd This method may throw a PM...
Definition: PhysicalModel.cpp:332
StructuralComponent * atoms
List of all the atoms : this is the basic stuff for a physicall model.
Definition: PhysicalModel.h:318
PhysicalModel() noexcept
Default constructor : this one just initialize everything.
Definition: PhysicalModel.cpp:54
MultiComponent * exclusiveComponents
Exclusive components are the non-overlaping components : they defined all the components of the physi...
Definition: PhysicalModel.h:306
bool parseAtoms(physicalModel::Atoms atomsRoot)
read the atom list in the xml tree and build them.
Definition: PhysicalModel.cpp:461
bool parseTree(std::unique_ptr< physicalModel::PhysicalModel > root, std::string defaultName)
read the xml tree and call other parse methods to build the physicalModel.
Definition: PhysicalModel.cpp:401
double * positionPtr
the big memory space where all the atom's position are stored (it is one big block,...
Definition: PhysicalModel.h:349
Structure * getStructureByName(const std::string n)
get a cell using its name
Definition: PhysicalModel.h:421
void setName(const std::string)
set the name of the physical model
Definition: PhysicalModel.h:362
bool addGlobalIndexAtomPair(std::GlobalIndexStructurePair)
add or update a pair to the atom map.
Definition: PhysicalModel.cpp:605
Atom * getAtom(const unsigned int id)
Get the atom that has the global index given in parameters.
Definition: PhysicalModel.h:385
virtual void setProgress(const float donePercentage)
this method is called during a long process everytime a little bit of the process is finished.
Definition: PhysicalModel.cpp:84
virtual void setAtomPosition(Atom *atom, const double pos[3])
Set the new position of an atom.
Definition: PhysicalModel.cpp:671
MultiComponent * getExclusiveComponents() const
get all the exclusive components
Definition: PhysicalModel.h:374
bool cellIndexOptimized
tell if optimizedCellList can be used
Definition: PhysicalModel.h:330
unsigned int getNumberOfInformativeComponents() const
get the total number of informative components
Definition: PhysicalModel.cpp:706
bool addAtom(Atom *)
Add a new atom to the atoms' structural component.
Definition: PhysicalModel.cpp:592
MultiComponent * informativeComponents
Informative components could be overlaping with other components : they are extra components that giv...
Definition: PhysicalModel.h:313
Component * getComponentByName(const std::string n)
get a structural or multi component by its name.
Definition: PhysicalModel.cpp:553
bool isModifiedFlag
is the current property state modified
Definition: PhysicalModel.h:299
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 ...
Definition: PhysicalModel.cpp:258
const std::string getName() const
Return the name of the physical model.
Definition: PhysicalModel.h:358
unsigned int getNumberOfExclusiveComponents() const
get the total number of exclusive components
Definition: PhysicalModel.cpp:696
std::vector< Cell * > optimizedCellList
optimized consecutive cell vector (in here optimizedCellList[i]->getIndex() == i )
Definition: PhysicalModel.h:327
Component * getExclusiveComponent(const unsigned int) const
get an exclusive component by its index in the list
Definition: PhysicalModel.cpp:726
void clear()
Clear everything. That allows one to restart an allready instantiated object from scratch.
Definition: PhysicalModel.cpp:91
void setExclusiveComponents(MultiComponent *)
set the exclusive multi component. Becareful: the physical model takes control of this MultiComponent
Definition: PhysicalModel.cpp:676
StructuralComponent * getAtoms() const
get all the atoms
Definition: PhysicalModel.h:380
Properties * properties
all physical model properties
Definition: PhysicalModel.h:296
void optimizeIndexes()
optimize atom and cell indexes so that each order number is equal to the index
Definition: PhysicalModel.cpp:232
bool addGlobalIndexCellPair(std::GlobalIndexStructurePair)
add or update a pair to the cell map.
Definition: PhysicalModel.cpp:633
void setAtoms(StructuralComponent *, bool deleteOld=true)
set the atom structural component.
Definition: PhysicalModel.cpp:572
bool parseComponents(physicalModel::MultiComponent mcFather, Component *father, bool isExclusive)
read the exclusive components list in the xml tree and build them.
Definition: PhysicalModel.cpp:490
void setInformativeComponents(MultiComponent *)
set the exclusive multi component. Becareful: the physical model takes control of this MultiComponent
Definition: PhysicalModel.cpp:686
static const char * VERSION
Current PML library version.
Definition: PhysicalModel.h:109
MultiComponent * getInformativeComponents() const
get all the informative components
Definition: PhysicalModel.h:377
void exportAnsysMesh(std::string filename)
Save the mesh (atoms/cells) of this PhysicalModel in the Ansys format.
Definition: PhysicalModel.cpp:747
Describes the properties common to all structures and components.
Definition: Properties.h:59
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:250
void setName(std::string)
set the name (use the string = operator)
Definition: Properties.h:254
A structural component is composed either by cell or by atoms.
Definition: StructuralComponent.h:52
Structure * getStructure(const unsigned int) const
get a structure by its index (fisrt structure is at index 0)
Definition: StructuralComponent.h:220
Pure virtual class that represent an element of the structure.
Definition: Structure.h:43
unsigned int getIndex() const
get the structure unique index (stored in its property)
Definition: Structure.cpp:30
std::map< unsigned int, Structure * > ::iterator GlobalIndexStructureMapIterator
the iterator corresponding to GlobalIndexStructureMap
Definition: PhysicalModel.h:73
std::pair< unsigned int, Structure * > GlobalIndexStructurePair
definition of a couple (=STL pair) (int , Structure *) this associates a global cell/atom index to th...
Definition: PhysicalModel.h:66
std::map< unsigned int, Structure * > GlobalIndexStructureMap
definition of the association set (=map in STL) globalIndexStructureMap.
Definition: PhysicalModel.h:71