26 #ifndef PHYSICALMODEL_H 27 #define PHYSICALMODEL_H 33 class ExclusiveComponent;
34 class InformativeComponent;
55 #if defined(_WIN32) && !defined(__MINGW32__) // MSVC only 56 #pragma warning( disable : 4290 ) 112 const std::string getName()
const;
114 void setName(
const std::string);
141 void xmlPrint(std::ostream &o,
bool opt=
false);
150 void exportPatran(std::string filename);
159 void exportAnsysMesh(std::string filename);
165 unsigned int getNumberOfExclusiveComponents()
const;
169 unsigned int getNumberOfInformativeComponents()
const;
172 unsigned int getNumberOfAtoms()
const;
175 unsigned int getNumberOfCells()
const;
178 Component * getExclusiveComponent(
const unsigned int)
const;
193 Component * getInformativeComponent(
const unsigned int)
const;
210 bool addAtom(
Atom *);
224 Atom * getAtom(
const unsigned int id);
242 Cell * getCell(
const unsigned int id);
245 Structure * getStructureByName(
const std::string n);
251 Component * getComponentByName(
const std::string n);
257 virtual void setProgress(
const float donePercentage);
261 virtual void setAtomPosition(
Atom *atom,
const double pos[3]);
267 double * getPositionPointer()
const;
270 double * getPositionPointer(
const unsigned int index)
const;
273 double * getPositionPointer(
const Atom* a)
const;
284 bool parseTree(std::auto_ptr<physicalModel::PhysicalModel> root, std::string defaultName);
286 bool parseAtoms(physicalModel::Atoms atomsRoot);
288 bool parseComponents(physicalModel::MultiComponent mcFather,
Component* father,
bool isExclusive );
329 void optimizeIndexes();
354 return properties->getName();
358 properties->setName(n);
362 return isModifiedFlag;
366 isModifiedFlag =
true;
370 return exclusiveComponents;
373 return informativeComponents;
384 Atom *quickAccessed =
dynamic_cast<Atom *
>(atoms->getStructure(
id));
386 if (quickAccessed && quickAccessed->
getIndex()==id) {
387 return quickAccessed;
391 mapIt = atomMap.find(
id);
394 return ( (mapIt == atomMap.end()) ? NULL : (
Atom *) mapIt->second );
400 if (cellIndexOptimized) {
401 return optimizedCellList[cellIndex];
406 mapIt = cellMap.find(cellIndex);
409 return ( (mapIt == cellMap.end()) ? NULL : (
Cell *) mapIt->second );
420 while (mapIt != cellMap.end() && mapIt->second->getName()!=n) {
425 if (mapIt!=cellMap.end())
426 return mapIt->second;
429 mapIt = atomMap.begin();
431 while (mapIt != atomMap.end() && mapIt->second->getName()!=n) {
436 if (mapIt!=atomMap.end())
437 return mapIt->second;
std::map< unsigned int, Structure * > GlobalIndexStructureMap
definition of the association set (=map in STL) globalIndexStructureMap.
Definition: PhysicalModel.h:71
const std::string getName() const
Return the name of the physical model.
Definition: PhysicalModel.h:353
Properties * properties
all physical model properties
Definition: PhysicalModel.h:291
A cell has an unique index in the physical model object, is composed by atoms, and different basic pr...
Definition: Cell.h:46
bool cellIndexOptimized
tell if optimizedCellList can be used
Definition: PhysicalModel.h:325
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
bool isModified()
check if something have changed
Definition: PhysicalModel.h:361
MultiComponent * getInformativeComponents() const
get all the informative components
Definition: PhysicalModel.h:372
StructuralComponent * getAtoms() const
get all the atoms
Definition: PhysicalModel.h:375
Pure virtual class that represent an element of the structure.
Definition: Structure.h:43
Cell * getCell(const unsigned int id)
get the cell that has the global index given in parameters.
Definition: PhysicalModel.h:399
Describes the properties common to all structures and components.
Definition: Properties.h:59
bool isModifiedFlag
is the current property state modified
Definition: PhysicalModel.h:294
Atom * getAtom(const unsigned int id)
Get the atom that has the global index given in parameters.
Definition: PhysicalModel.h:380
Exception class to handle abortion in the xmlReading Particularly useful to handle constructor's abor...
Definition: PMLAbortException.h:39
unsigned int getIndex() const
get the structure unique index (stored in its property)
Definition: Structure.cpp:30
PtrToSetProgressFunction setProgressFunction
the progress function
Definition: PhysicalModel.h:341
void setName(const std::string)
set the name of the physical model
Definition: PhysicalModel.h:357
std::GlobalIndexStructureMap atomMap
the association couple list, which contains the direct map between the atom's global index and the at...
Definition: PhysicalModel.h:335
std::map< unsigned int, Structure * >::iterator GlobalIndexStructureMapIterator
the iterator corresponding to GlobalIndexStructureMap
Definition: PhysicalModel.h:73
MultiComponent * exclusiveComponents
Exclusive components are the non-overlaping components : they defined all the components of the physi...
Definition: PhysicalModel.h:301
A component is something that composed something and could also be a part of something.
Definition: modeling/libraries/pml/Component.h:48
MultiComponent * getExclusiveComponents() const
get all the exclusive components
Definition: PhysicalModel.h:369
An atom has an unique index in the physical model object, a 3D position, and different basic properti...
Definition: Atom.h:49
This is the main class of this project.
Definition: PhysicalModel.h:86
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:344
static const char * VERSION
Current PML library version.
Definition: PhysicalModel.h:105
Structure * getStructureByName(const std::string n)
get a cell using its name
Definition: PhysicalModel.h:414
void(* PtrToSetProgressFunction)(const float donePercentage)
Definition of a function/method that could be called by the setProgress method.
Definition: PhysicalModel.h:60
std::vector< Cell * > optimizedCellList
optimized consecutive cell vector (in here optimizedCellList[i]->getIndex() == i ) ...
Definition: PhysicalModel.h:322
void setModified()
tell the physical model something has changed (for example: a property was modified/added).
Definition: PhysicalModel.h:365
A structural component is composed either by cell or by atoms.
Definition: StructuralComponent.h:52
MultiComponent * informativeComponents
Informative components could be overlaping with other components : they are extra components that giv...
Definition: PhysicalModel.h:308
Properties * getProperties()
get all properties (beware of what you do with them!): please consider calling setModified().
Definition: PhysicalModel.h:349
std::GlobalIndexStructureMap cellMap
the association couple list, which contains the direct map between the cell's global index and the ce...
Definition: PhysicalModel.h:319
StructuralComponent * atoms
List of all the atoms : this is the basic stuff for a physicall model.
Definition: PhysicalModel.h:313
A multi-component stores other components, hence providing a way to have an tree representation of co...
Definition: MultiComponent.h:44