Computer Assited Medical Intervention Tool Kit  version 5.0
Load Class Reference

Class that describes a load to be used in the simulation. This load can have different types Translation, Rotation, Force and Pressure. This load can be created by parsing in an XML file or by load library programming A load could be save in XML format as well using the << operator. The load is set automatically when the method setTarget is called. More...

#include <Load.h>

+ Inheritance diagram for Load:
+ Collaboration diagram for Load:

Public Member Functions

void addEvent (ValueEvent *ve)
 Insert an event from the particular load the load is set to value v when time is equal to t. More...
 
void addTarget (std::string currentData)
 add a lots of new targets using a description string (...) More...
 
void addTarget (unsigned int target)
 add a new target More...
 
void addValueEvent (const double v, const double d)
 set the valueEvent. More...
 
virtual void ansysPrint (std::ostream &) const
 Print the load in ansys format (BEWARE: not everything is implemented) More...
 
Direction getDirection () const
 get direction object (a copy) More...
 
void getDirection (double &x, double &y, double &z) const
 Get the direction. More...
 
int getTarget (const unsigned int target) const
 Get a target by index. More...
 
TargetList getTargetList () const
 get the complete list More...
 
std::string getType () const
 get the type string, has to be impleted in subclasses More...
 
Unit getUnit () const
 get the unit More...
 
double getValue (const double d=0.0)
 The current value at date d (default: d = 0.0). More...
 
ValueEventgetValueEvent (const unsigned int i) const
 Get a the ValueEvent. More...
 
bool isActive (const double t)
 return true if the load is active at time t More...
 
 Load ()
 Constructor. More...
 
unsigned int numberOfTargets () const
 get the number of target More...
 
unsigned int numberOfValueEvents () const
 get the nr of value event More...
 
void setAllEvents (std::vector< ValueEvent * > &)
 set all value events More...
 
void setDirection (const Direction &)
 Set the direction using another direction. More...
 
void setDirection (const double x, const double y, const double z)
 Set the direction using 3 coordinates. More...
 
void setTargetList (const TargetList &)
 set the complete list More...
 
void setUnit (const Unit u)
 set the unit More...
 
void xmlPrint (std::ostream &) const
 Print to an ostream. More...
 
virtual ~Load ()
 destructor is deleting all the value events (BEWARE!!!) More...
 

Static Public Member Functions

static LoadLoadFactory (std::string type)
 static method to create a new load using a specific type (return nullptr if type is unknown) More...
 

Protected Attributes

Direction dir
 
std::string typeString
 
Unit unit
 

Private Member Functions

void deleteEventList ()
 delete all the list More...
 

Private Attributes

std::vector< ValueEvent * > eventList
 the list of different events More...
 
TargetList targetList
 the list of targets More...
 

Friends

std::ostream & operator<< (std::ostream &, Load)
 print to an output stream in XML format. More...
 

Detailed Description

Class that describes a load to be used in the simulation. This load can have different types Translation, Rotation, Force and Pressure. This load can be created by parsing in an XML file or by load library programming A load could be save in XML format as well using the << operator. The load is set automatically when the method setTarget is called.

a Load contains a Type, AppliedTo, 3 Directions x/y/z, a Unit and several ValueEvent (value, date)

All value events that are added to the load are then taking over by the load (i.e. when the load is deleted, it will delete all its value event.

Constructor & Destructor Documentation

◆ Load()

Load::Load ( )

Constructor.

◆ ~Load()

Load::~Load ( )
virtual

destructor is deleting all the value events (BEWARE!!!)

References deleteEventList().

+ Here is the call graph for this function:

Member Function Documentation

◆ addEvent()

void Load::addEvent ( ValueEvent ve)

Insert an event from the particular load the load is set to value v when time is equal to t.

Parameters
vethe force to add in the list at the correct place

References eventList.

Referenced by addValueEvent(), setAllEvents(), and Loads::xmlRead().

+ Here is the caller graph for this function:

◆ addTarget() [1/2]

void Load::addTarget ( std::string  currentData)

add a lots of new targets using a description string (...)

References TargetList::add(), and targetList.

Referenced by GenerateModel::saveMMLFiles(), and Loads::xmlRead().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addTarget() [2/2]

void Load::addTarget ( unsigned int  target)

add a new target

References TargetList::add(), and targetList.

+ Here is the call graph for this function:

◆ addValueEvent()

void Load::addValueEvent ( const double  v,
const double  d 
)

set the valueEvent.

Parameters
vthe value
dthe date at which the value is applied

References addEvent().

Referenced by GenerateModel::saveMMLFiles().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ansysPrint()

void Load::ansysPrint ( std::ostream &  o) const
virtual

Print the load in ansys format (BEWARE: not everything is implemented)

Reimplemented in Force, and Translation.

References targetList, and TargetList::toAnsys().

Referenced by Force::ansysPrint(), Translation::ansysPrint(), and Loads::ansysPrint().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteEventList()

void Load::deleteEventList ( )
private

delete all the list

References eventList.

Referenced by setAllEvents(), and ~Load().

+ Here is the caller graph for this function:

◆ getDirection() [1/2]

Direction Load::getDirection ( ) const

get direction object (a copy)

References dir.

◆ getDirection() [2/2]

void Load::getDirection ( double &  x,
double &  y,
double &  z 
) const

Get the direction.

References dir, Direction::getX(), Direction::getY(), and Direction::getZ().

+ Here is the call graph for this function:

◆ getTarget()

int Load::getTarget ( const unsigned int  target) const

Get a target by index.

Parameters
targetthe target index in the list
Returns
the target or -1 if target index is out of bounds.

References TargetList::getIndexedTarget(), and targetList.

+ Here is the call graph for this function:

◆ getTargetList()

TargetList Load::getTargetList ( ) const

get the complete list

References targetList.

◆ getType()

std::string Load::getType ( ) const

get the type string, has to be impleted in subclasses

References typeString.

Referenced by Loads::ansysPrint(), and xmlPrint().

+ Here is the caller graph for this function:

◆ getUnit()

Unit Load::getUnit ( ) const

get the unit

References unit.

Referenced by xmlPrint().

+ Here is the caller graph for this function:

◆ getValue()

double Load::getValue ( const double  d = 0.0)

The current value at date d (default: d = 0.0).

eg: if we have :

# date value
00.510.0
11.5100.0

we want to have:

  • when t<0.5, val=0
  • when t=0.5, val=10
  • when t=1.0, val=55
  • when t>=1.5, val=100

Schematically:

   ^
   |
100+                        * * * * *
   |                 *
 10+         *
   |         *
   +-*-*-*-*-+-------+--------+------>
   0        0.5     1.0      1.5
   

References eventList.

◆ getValueEvent()

ValueEvent * Load::getValueEvent ( const unsigned int  i) const

Get a the ValueEvent.

References eventList.

Referenced by Translation::ansysPrint(), and xmlPrint().

+ Here is the caller graph for this function:

◆ isActive()

bool Load::isActive ( const double  t)

return true if the load is active at time t

References eventList.

◆ LoadFactory()

Load * Load::LoadFactory ( std::string  type)
static

static method to create a new load using a specific type (return nullptr if type is unknown)

Referenced by Loads::xmlRead().

+ Here is the caller graph for this function:

◆ numberOfTargets()

unsigned int Load::numberOfTargets ( ) const

get the number of target

References TargetList::getNumberOfTargets(), and targetList.

+ Here is the call graph for this function:

◆ numberOfValueEvents()

unsigned int Load::numberOfValueEvents ( ) const

get the nr of value event

References eventList.

Referenced by Translation::ansysPrint(), and xmlPrint().

+ Here is the caller graph for this function:

◆ setAllEvents()

void Load::setAllEvents ( std::vector< ValueEvent * > &  newList)

set all value events

References addEvent(), and deleteEventList().

+ Here is the call graph for this function:

◆ setDirection() [1/2]

void Load::setDirection ( const Direction d)

Set the direction using another direction.

References dir.

◆ setDirection() [2/2]

void Load::setDirection ( const double  x,
const double  y,
const double  z 
)

Set the direction using 3 coordinates.

References dir, and Direction::set().

Referenced by GenerateModel::saveMMLFiles(), and Loads::xmlRead().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTargetList()

void Load::setTargetList ( const TargetList t)

set the complete list

References targetList.

◆ setUnit()

void Load::setUnit ( const Unit  u)

set the unit

References unit.

Referenced by GenerateModel::saveMMLFiles(), and Loads::xmlRead().

+ Here is the caller graph for this function:

◆ xmlPrint()

void Load::xmlPrint ( std::ostream &  o) const

Print to an ostream.

References dir, getType(), getUnit(), Unit::getUnitName(), getValueEvent(), numberOfValueEvents(), targetList, TargetList::toString(), ValueEvent::xmlPrint(), and Direction::xmlPrint().

Referenced by Loads::xmlPrint().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  o,
Load   
)
friend

print to an output stream in XML format.

See also
loads.xsd

Member Data Documentation

◆ dir

Direction Load::dir
protected

◆ eventList

std::vector<ValueEvent*> Load::eventList
private

the list of different events

Referenced by addEvent(), deleteEventList(), getValue(), getValueEvent(), isActive(), and numberOfValueEvents().

◆ targetList

TargetList Load::targetList
private

◆ typeString

std::string Load::typeString
protected

◆ unit

Unit Load::unit
protected

The documentation for this class was generated from the following files: