Computer Assited Medical Intervention Tool Kit  version 5.0
Loads.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2021 Univ. Grenoble Alpes, CNRS, Grenoble INP, TIMC, 38000 Grenoble, France
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 LOADS_H
27 #define LOADS_H
28 
29 #include "Load.h"
30 #include "ValueEvent.h"
31 #include "Direction.h"
32 
33 #include <vector>
34 
71 class Loads {
72 
73 public:
75  Loads() = default;
76 
78  Loads(std::string);
79 
81  ~Loads();
82 
84  void addLoad(Load* ld);
85 
87  Load* getLoad(const unsigned int i) const;
88 
90  void deleteLoad(const unsigned int i);
91 
93  unsigned int numberOfLoads() const;
94 
98  friend std::ostream& operator << (std::ostream&, const Loads);
99 
102  void xmlRead(std::string filename);
103 
105  void xmlPrint(std::ostream&) const;
106 
108  void ansysPrint(std::ostream&) const;
109 
113  double getFirstEventDate();
114 
118  double getLastEventDate();
119 
121  static const char* VERSION;
122 
123 private:
125  std::vector <Load*> loads;
126 
127 };
128 
129 
130 #endif //LOADS_H
Loads::getLastEventDate
double getLastEventDate()
get the last event date present in the list of loads
Definition: Loads.cpp:297
Loads.h
Load::LoadFactory
static Load * LoadFactory(std::string type)
static method to create a new load using a specific type (return nullptr if type is unknown)
Definition: Load.cpp:39
Direction::setToward
void setToward(const unsigned int toward)
set the toward index
Definition: Direction.h:159
Loads::operator<<
friend std::ostream & operator<<(std::ostream &, const Loads)
print to an output stream in XML format.
Definition: Loads.cpp:225
TranslationUnit::MM
static TranslationUnit & MM()
millimeters
Definition: TranslationUnit.cpp:44
Load::getType
std::string getType() const
get the type string, has to be impleted in subclasses
Definition: Load.cpp:283
Loads::xmlPrint
void xmlPrint(std::ostream &) const
Print to an ostream.
Definition: Loads.cpp:187
Loads::VERSION
static const char * VERSION
current version of the library
Definition: Loads.h:144
Load
Class that describes a load to be used in the simulation. This load can have different types Translat...
Definition: Load.h:53
RotationUnit::DEG
static RotationUnit & DEG()
degrees
Definition: RotationUnit.cpp:30
ForceUnit::N
static ForceUnit & N()
Newtons.
Definition: ForceUnit.cpp:35
Direction::setX
void setX(const double x)
set the x coordinate
Definition: Direction.h:194
Loads::xmlRead
void xmlRead(std::string filename)
read the input xml file using xsd and instantiate the loads
Definition: Loads.cpp:70
AccelerationUnit::CMSm2
static AccelerationUnit & CMSm2()
cm/s^2
Definition: AccelerationUnit.cpp:35
Load::addTarget
void addTarget(std::string currentData)
add a lots of new targets using a description string (...)
Definition: Load.cpp:209
Load::xmlPrint
void xmlPrint(std::ostream &) const
Print to an ostream.
Definition: Load.cpp:290
PressureUnit::MMHG
static PressureUnit & MMHG()
Millimeters of mercure.
Definition: PressureUnit.cpp:35
Loads::addLoad
void addLoad(Load *ld)
add a load to the list
Definition: Loads.cpp:244
Loads::numberOfLoads
unsigned int numberOfLoads() const
get the number of "Load" stored in the list
Definition: Loads.cpp:259
Loads::loads
std::vector< Load * > loads
vector of loads : these "Load" are created while the file is parsed
Definition: Loads.h:148
Load::setUnit
void setUnit(const Unit u)
set the unit
Definition: Load.cpp:277
Direction
Class that defines the direction of the Load with x, y and z.
Definition: Direction.h:39
Direction.h
RotationUnit::RAD
static RotationUnit & RAD()
radians
Definition: RotationUnit.cpp:35
PressureUnit::PA
static PressureUnit & PA()
Pascal.
Definition: PressureUnit.cpp:40
PressureUnit.h
ForceUnit::PN
static ForceUnit & PN()
picoNewtons
Definition: ForceUnit.cpp:40
TranslationUnit::MICRO_M
static TranslationUnit & MICRO_M()
micro meters
Definition: TranslationUnit.cpp:34
TranslationUnit::M
static TranslationUnit & M()
meters
Definition: TranslationUnit.cpp:29
Load::addEvent
void addEvent(ValueEvent *ve)
Insert an event from the particular load the load is set to value v when time is equal to t.
Definition: Load.cpp:184
Load.h
Loads::deleteLoad
void deleteLoad(const unsigned int i)
delete a load and remove it from the list using its index
Definition: Loads.cpp:264
ForceUnit::KN
static ForceUnit & KN()
KiloNewtons.
Definition: ForceUnit.cpp:30
Load::ansysPrint
virtual void ansysPrint(std::ostream &) const
Print the load in ansys format (BEWARE: not everything is implemented)
Definition: Load.cpp:321
RotationUnit.h
ForceUnit.h
TranslationUnit::NM
static TranslationUnit & NM()
nano meters
Definition: TranslationUnit.cpp:39
Loads::ansysPrint
void ansysPrint(std::ostream &) const
Print the load list in ansys format (BEWARE: not everything is implemented)
Definition: Loads.cpp:206
AccelerationUnit::MMSm2
static AccelerationUnit & MMSm2()
mm/s^2
Definition: AccelerationUnit.cpp:41
ValueEvent.h
Loads
This class makes it possible to manage a list of "Load". Remember that Load is an abstract class (con...
Definition: Loads.h:71
PressureUnit::KPA
static PressureUnit & KPA()
kiloPascal
Definition: PressureUnit.cpp:30
Translation.h
operator<<
std::ostream & operator<<(std::ostream &o, const Loads l)
Definition: Loads.cpp:225
Loads::~Loads
~Loads()
destructor
Definition: Loads.cpp:55
ValueEvent
A valueEvent of a load is composed of a value and a date.
Definition: ValueEvent.h:41
ValueEvent::getDate
double getDate() const
double get start time
Definition: ValueEvent.cpp:62
Loads::Loads
Loads()=default
default constructor
Loads::getFirstEventDate
double getFirstEventDate()
get the first event date present in the list of loads
Definition: Loads.cpp:272
Direction::setZ
void setZ(const double z)
set the z coordinate
Definition: Direction.h:255
AccelerationUnit::MSm2
static AccelerationUnit & MSm2()
Standard SI unit for acceleration: m/s^2.
Definition: AccelerationUnit.cpp:30
Loads::getLoad
Load * getLoad(const unsigned int i) const
get a load by its index in the list
Definition: Loads.cpp:249
Direction::setY
void setY(const double y)
set the y coordinate
Definition: Direction.h:224
AccelerationUnit.h
Load::setDirection
void setDirection(const double x, const double y, const double z)
Set the direction using 3 coordinates.
Definition: Load.cpp:246