Computer Assisted Medical Intervention Tool Kit  version 6.0
Loading...
Searching...
No Matches
Load Class Reference

Class that describes a load to be used in the simulation. More...

#include <Load.h>

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

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)

Protected Attributes

Direction dir
std::string typeString
Unit unit

Friends

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

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.

References typeString.

Referenced by LoadFactory(), and operator<<.

◆ ~Load()

Load::~Load ( )
virtual

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

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

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

◆ addTarget() [1/2]

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

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

Referenced by Loads::xmlRead().

◆ addTarget() [2/2]

void Load::addTarget ( unsigned int target)

add a new target

◆ 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().

◆ 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.

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

◆ getDirection() [1/2]

Direction Load::getDirection ( ) const

get direction object (a copy)

References dir.

◆ getDirection() [2/2]

◆ 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.

Referenced by TranslationConstraint< DataTypes >::projectPosition(), and TranslationConstraint< DataTypes >::projectResponse().

◆ getTargetList()

TargetList Load::getTargetList ( ) const

get the complete list

◆ getType()

std::string Load::getType ( ) const

get the type string, has to be impleted in subclasses

References typeString.

Referenced by Loads::ansysPrint(), TranslationConstraint< DataTypes >::TranslationConstraint(), and xmlPrint().

◆ getUnit()

Unit Load::getUnit ( ) const

get the unit

References unit.

Referenced by xmlPrint().

◆ getValue()

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

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

eg: if we have :

#datevalue
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
   

Referenced by TranslationConstraint< DataTypes >::projectPosition(), TranslationConstraint< DataTypes >::projectResponse(), and TranslationConstraint< sofa::defaulttype::Vec3Types >::TranslationConstraint().

◆ getValueEvent()

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

Get a the ValueEvent.

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

◆ isActive()

bool Load::isActive ( const double t)

return true if the load is active at time t

◆ 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)

References Load().

Referenced by Loads::xmlRead().

◆ numberOfTargets()

◆ numberOfValueEvents()

unsigned int Load::numberOfValueEvents ( ) const

get the nr of value event

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

◆ setAllEvents()

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

set all value events

References addEvent().

◆ 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.

Referenced by Loads::xmlRead().

◆ setTargetList()

void Load::setTargetList ( const TargetList & t)

set the complete list

◆ setUnit()

void Load::setUnit ( const Unit u)

set the unit

References unit.

Referenced by Loads::xmlRead().

◆ xmlPrint()

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

◆ operator<<

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

print to an output stream in XML format.

See also
loads.xsd

References Load().

Member Data Documentation

◆ dir

◆ typeString

◆ unit


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