Class SiconosMemory#
Defined in Program listing for file kernel/src/utils/SiconosMemory/SiconosMemory.hpp
-
class SiconosMemory : public MemoryContainer#
Interface to stl container of SiconosVector.
This class is used as a backup during simulation, to save vectors (e.g. state) computed during previous time steps.
The size of the container is fixed, with a first-in first-out mechanism used through swap method.
All saved vectors must have the same dimension.
This class must be reviewed and backup should probably be moved to graph rather than in this object.
Public Functions
-
SiconosMemory() = default#
creates an empty SiconosMemory.
-
SiconosMemory(const unsigned int size, const unsigned int vectorSize)#
creates a SiconosMemory
- Parameters:
size – number of elements in the container
vectorSize – size of each vector in the container
-
SiconosMemory(const SiconosMemory &mem)#
creates a SiconosMemory, copy constructor Required because of resize call in DS initMemory function.
- Parameters:
mem – a SiconosMemory
-
inline ~SiconosMemory()#
destructor
-
void operator=(const SiconosMemory&)#
Assignment.
-
const SiconosVector &getSiconosVector(const unsigned int) const#
To get SiconosVector number i of the memory.
- Parameters:
int – i: the position in the memory of the wanted SiconosVector
- Returns:
a SP::SiconosVector
-
SiconosVector &getSiconosVectorMutable(const unsigned int)#
To get SiconosVector number i of the memory as mutable reference.
Use should be avoided whenever possible. (Used in LinearSMC::actuate)
- Parameters:
int – i: the position in the memory of the wanted SiconosVector
- Returns:
a SP::SiconosVector
-
void setMemorySize(const unsigned int steps, const unsigned int vectorSize)#
set size of the SiconosMemory (number of vectors and size of vector)
- Parameters:
steps – the max size for this SiconosMemory, size of the container
vectorSize – size of each vector of the container
-
inline MemoryContainer::size_type nbVectorsInMemory() const#
gives the numbers of SiconosVectors currently stored in the memory
- Returns:
int >= 0
-
void swap(const SiconosVector &v)#
puts a SiconosVector into the memory
- Parameters:
v – the SiconosVector we want to put in memory
-
void swap(SP::SiconosVector v)#
puts a SiconosVector into the memory
- Parameters:
v – the SiconosVector we want to put in memory, or do nothing if v is null
-
void display() const#
displays the data of the memory object