Computer Assited Medical Intervention Tool Kit  version 5.0
Load.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 LOAD_H
27 #define LOAD_H
28 
29 #include "Direction.h"
30 #include "ValueEvent.h"
31 #include "TargetList.h"
32 #include "Unit.h"
33 
34 #include <algorithm>
35 
53 class Load {
54 
55 public:
57  Load();
58 
60  virtual ~Load();
61 
63  bool isActive(const double t);
64 
94  double getValue(const double d = 0.0);
95 
100  void addEvent(ValueEvent* ve);
105  void addValueEvent(const double v, const double d);
106 
108  ValueEvent* getValueEvent(const unsigned int i) const;
110  unsigned int numberOfValueEvents() const;
112  void setAllEvents(std::vector<ValueEvent*>&);
113 
115  std::string getType() const;
116 
118  void addTarget(std::string currentData);
120  void addTarget(unsigned int target);
122  unsigned int numberOfTargets() const;
127  int getTarget(const unsigned int target) const;
129  TargetList getTargetList() const;
131  void setTargetList(const TargetList&);
132 
134  void setDirection(const double x, const double y, const double z);
135 
137  void setDirection(const Direction&);
138 
140  void getDirection(double& x, double& y, double& z) const;
141 
143  Direction getDirection() const;
144 
146  Unit getUnit() const;
148  void setUnit(const Unit u);
149 
153  friend std::ostream& operator << (std::ostream&, Load);
154 
156  virtual void ansysPrint(std::ostream&) const;
157 
159  void xmlPrint(std::ostream&) const;
160 
162  static Load* LoadFactory(std::string type);
163 
164 private:
168  std::vector <ValueEvent*> eventList;
169 
171  void deleteEventList();
172 
173 protected:
174  Direction dir;
175  Unit unit;
176  std::string typeString;
177 };
178 
179 #endif //LOAD_H
Load::setAllEvents
void setAllEvents(std::vector< ValueEvent * > &)
set all value events
Definition: Load.cpp:86
Unit::getUnitName
std::string getUnitName()
Definition: Unit.h:49
Load::~Load
virtual ~Load()
destructor is deleting all the value events (BEWARE!!!)
Definition: Load.cpp:71
std::greater< ValueEvent * >::operator()
bool operator()(const ValueEvent *lhs, const ValueEvent *rhs) const
Definition: Load.cpp:176
Pressure
Class that defines the type of Load 'Pressure'.
Definition: Pressure.h:38
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
Unit.h
TargetList::toString
std::string toString() const
return the list in a handy/compact format (compact interval, i.e. 4,5,6 becomes 4-6,...
Definition: TargetList.cpp:168
Load::getType
std::string getType() const
get the type string, has to be impleted in subclasses
Definition: Load.cpp:283
Direction::getY
double getY() const
get the y coordinate
Definition: Direction.h:203
Load::getValueEvent
ValueEvent * getValueEvent(const unsigned int i) const
Get a the ValueEvent.
Definition: Load.cpp:256
Load::numberOfValueEvents
unsigned int numberOfValueEvents() const
get the nr of value event
Definition: Load.cpp:266
Load::getTargetList
TargetList getTargetList() const
get the complete list
Definition: Load.cpp:214
Load
Class that describes a load to be used in the simulation. This load can have different types Translat...
Definition: Load.h:53
Load::typeString
std::string typeString
Definition: Load.h:199
Load::eventList
std::vector< ValueEvent * > eventList
the list of different events
Definition: Load.h:191
Load::operator<<
friend std::ostream & operator<<(std::ostream &, Load)
print to an output stream in XML format.
Definition: Load.cpp:327
Rotation.h
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
Pressure.h
Load::numberOfTargets
unsigned int numberOfTargets() const
get the number of target
Definition: Load.cpp:224
Load::getTarget
int getTarget(const unsigned int target) const
Get a target by index.
Definition: Load.cpp:229
Load::Load
Load()
Constructor.
Definition: Load.cpp:67
Load::setUnit
void setUnit(const Unit u)
set the unit
Definition: Load.cpp:277
Direction::getZ
double getZ() const
get the z coordinate
Definition: Direction.h:234
Load::isActive
bool isActive(const double t)
return true if the load is active at time t
Definition: Load.cpp:95
Direction
Class that defines the direction of the Load with x, y and z.
Definition: Direction.h:39
Direction.h
TargetList.h
Load::targetList
TargetList targetList
the list of targets
Definition: Load.h:189
Rotation
Class that defines the type of Load 'Rotation'.
Definition: Rotation.h:37
std::greater< ValueEvent * >
Definition: Load.cpp:175
TargetList::add
void add(const unsigned int)
add a load using an integer
Definition: TargetList.cpp:39
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
Direction::xmlPrint
void xmlPrint(std::ostream &o) const
print to an ostream
Definition: Direction.h:100
Load::getUnit
Unit getUnit() const
get the unit
Definition: Load.cpp:272
ValueEvent::xmlPrint
void xmlPrint(std::ostream &)
Print to an ostream.
Definition: ValueEvent.cpp:67
Unit
Class that defines the unit of the Load.
Definition: Unit.h:46
Direction::set
void set(const double x, const double y, const double z)
set the direction
Definition: Direction.h:147
Acceleration
Class that defines the type of Load 'Acceleration', for example to set the gravity.
Definition: Acceleration.h:38
Load::ansysPrint
virtual void ansysPrint(std::ostream &) const
Print the load in ansys format (BEWARE: not everything is implemented)
Definition: Load.cpp:321
TargetList::getIndexedTarget
int getIndexedTarget(const unsigned int) const
get an indexed target
Definition: TargetList.cpp:142
ValueEvent.h
Translation.h
Translation
Class that defines the type of Load 'Translation'.
Definition: Translation.h:39
operator<<
std::ostream & operator<<(std::ostream &o, Load)
Definition: Load.cpp:327
TargetList::toAnsys
std::string toAnsys() const
return the ANSYS command to select the list of target (only work for indexed targets)
Definition: TargetList.cpp:216
Force.h
ValueEvent
A valueEvent of a load is composed of a value and a date.
Definition: ValueEvent.h:41
Load::getDirection
Direction getDirection() const
get direction object (a copy)
Definition: Load.cpp:241
ValueEvent::getDate
double getDate() const
double get start time
Definition: ValueEvent.cpp:62
Load::dir
Direction dir
Definition: Load.h:197
Load::getValue
double getValue(const double d=0.0)
The current value at date d (default: d = 0.0).
Definition: Load.cpp:112
Direction::getX
double getX() const
get the x coordinate
Definition: Direction.h:173
Load::unit
Unit unit
Definition: Load.h:198
Load::setTargetList
void setTargetList(const TargetList &)
set the complete list
Definition: Load.cpp:219
TargetList::getNumberOfTargets
unsigned int getNumberOfTargets() const
get the nr of indevidual targets
Definition: TargetList.cpp:132
Acceleration.h
Force
Class that defines the type of Load 'Force'.
Definition: lml/Force.h:37
Load::addValueEvent
void addValueEvent(const double v, const double d)
set the valueEvent.
Definition: Load.cpp:198
Load::deleteEventList
void deleteEventList()
delete all the list
Definition: Load.cpp:77
TargetList
Manage a list of targets, can be created/modified using either an integer, a name,...
Definition: TargetList.h:45
Load::setDirection
void setDirection(const double x, const double y, const double z)
Set the direction using 3 coordinates.
Definition: Load.cpp:246