File kernel/src/utils/SiconosMemory/SiconosMemory.hpp

Go to the source code of this file

class SiconosMemory

Typedefs

typedef std::vector<SiconosVector> MemoryContainer

Container used to save vectors in SiconosMemory.

typedef std::vector<SiconosMemory> VectorOfMemories
class SiconosMemory : public MemoryContainer
#include <SiconosMemory.hpp>

This class is a backup for vectors of previous time step.

There is a max number of saved vector (memorySize) and all the vector (simple or block) should have the same size.

Public Functions

SiconosMemory()

default constructor.

SiconosMemory(const unsigned int size, const unsigned int vectorSize)

constructor with size parameter.

Parameters
  • size: size of the MemoryContainer

  • vectorSize: the size of the SiconosVector to store

SiconosMemory(const MemoryContainer &deque)

constructor with deque parameter.

Parameters
  • deque: MemoryContainer, the deque of siconosVector which must be stored _size is set to the size of the deque given in parameters

SiconosMemory(const unsigned int size, const MemoryContainer &deque)

constructor with size and deque parameter.

Parameters
  • size: int , the size of the memory

  • deque: MemoryContainer, the deque of siconosVector which must be stored this constructor is useful if the deque given in parameters has a size lower than the normal size of the memory

SiconosMemory(const SiconosMemory &Mem)

Copy constructor.

Parameters

~SiconosMemory()

destructor

void display() const

displays the data of the memory object

unsigned int getMemorySize() const

gives the size of the memory

Return

int >= 0

const SiconosVector &getSiconosVector(const unsigned int) const

To get SiconosVector number i of the memory.

Return

a SP::SiconosVector

Parameters

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)

Return

a SP::SiconosVector

Parameters

unsigned int nbVectorsInMemory() const

gives the numbers of SiconosVectors currently stored in the memory

Return

int >= 0

void operator=(const SiconosMemory&)

Assignment.

void operator=(const MemoryContainer &V)

Assignment from container Assumes all entries are valid SiconosVectors.

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

void setVectorMemory(const MemoryContainer &v, MemoryContainer::size_type size)

fill the memory with a vector of siconosVector

Parameters
  • v: MemoryContainer

  • size: of the input container

void swap(const SiconosVector &v)

puts a SiconosVector into the memory

Parameters

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

Private Functions

ACCEPT_SERIALIZATION(SiconosMemory)

serialization hooks

Private Members

MemoryContainer::size_type _indx

index to avoid removal and creation of vectors

MemoryContainer::size_type _nbVectorsInMemory

the real number of SiconosVectors saved in the Memory (ie the ones for which memory has been allocated)