Computer Assited Medical Intervention Tool Kit  version 3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Atom.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2014 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 
26 #ifndef ATOM_H
27 #define ATOM_H
28 
29 #include <string>
30 
31 
32 #include "Structure.h"
33 #include "AtomProperties.h"
34 #include "RenderingMode.h"
44 class Atom : public Structure {
45 public:
49  Atom(PhysicalModel *myPM);
50 
57  Atom(PhysicalModel *myPM, xmlNodePtr n, unsigned int id = -1);
58 
63  Atom(PhysicalModel *myPM, const double pos[3]);
64 
69  Atom(PhysicalModel *myPM, const unsigned int ind);
70 
76  Atom(PhysicalModel *myPM, const unsigned int ind, const double pos[3]);
77 
79  ~Atom();
80 
83  void xmlPrint(std::ostream &, const StructuralComponent *);
84 
86  void getPosition(double pos[3]) const;
87 
89  void setPosition(const double [3]);
90 
92  void setPosition(const double ,const double ,const double );
93 
100  virtual bool setIndex(const unsigned int);
101 
103  unsigned int getIndexInAtoms() const;
104 
106  virtual bool isInstanceOf(const char *) const;
107 
109  AtomProperties * getProperties() const;
110 
111  private:
112  unsigned int indexInAtoms;
113 };
114 
115 // -------------------- inline ---------------------
116 inline void Atom::getPosition(double p[3]) const {
117  return getProperties()->getPosition(p);
118 }
119 
120 inline void Atom::setPosition(const double pos[3]) {
121  getProperties()->setPosition(pos);
122 }
123 inline void Atom::setPosition(const double x, const double y,const double z) {
124  getProperties()->setPosition(x,y,z);
125 }
126 
127 inline bool Atom::isInstanceOf(const char *className) const {
128  return (std::string(className)==std::string("Atom"));
129 }
131  return (AtomProperties *) properties;
132 }
133 
134 #endif //ATOM_H
~Atom()
std destructor
virtual bool setIndex(const unsigned int)
set the index.
Pure virtual class that represent an element of the structure.
Definition: Structure.h:43
virtual bool isInstanceOf(const char *) const
return true only if the parameter is equal to "Atom"
Definition: Atom.h:127
void setPosition(const double[3])
set the position of the atom
Definition: BasicAtomProperties.h:132
unsigned int getIndexInAtoms() const
get the index of this atom in the global atom structural component, i.e. its order number in atoms ...
StructureProperties * properties
Property of the current structure.
Definition: Structure.h:99
void getPosition(double pos[3]) const
get the position of the atom (array of 3 doubles)
Definition: BasicAtomProperties.h:128
void xmlPrint(std::ostream &, const StructuralComponent *)
print to an output stream in "pseaudo" XML format.
This is an automatically generated class for custom Atom properties.
Definition: AtomProperties.h:45
An atom has an unique index in the physical model object, a 3D position, and different basic properti...
Definition: Atom.h:44
This is the main class of this project.
Definition: PhysicalModel.h:74
Atom(PhysicalModel *myPM)
Default constructor : set the position to the origin, generate a unique index.
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
AtomProperties * getProperties() const
Get a ptr to the AtomProperties.
Definition: Atom.h:130
void getPosition(double pos[3]) const
get the position of the atom (array of 3 doubles)
Definition: Atom.h:116
void setPosition(const double[3])
set the position of the atom
Definition: Atom.h:120
unsigned int indexInAtoms
Definition: Atom.h:112