Class BlockVector

Defined in Program listing for file kernel/src/utils/SiconosAlgebra/BlockVector.hpp

class BlockVector

“Block” vector : container (list) of SiconosVector

A block vector is a stl vector that handles pointers to SiconosVector.

Insertion of NULL SP::SiconosVector is not allowed.

Public Functions

BlockVector()

default contructor

BlockVector(const BlockVector &v)

copy contructor

Parameters

BlockVector(SP::SiconosVector v1, SP::SiconosVector v2)

contructor with a 2 SiconosVectors

Parameters
  • v1: first vector
  • v2: second vector

BlockVector(unsigned int numberOfBlocks, unsigned int dim)

contructor with a BlockVector of n (numberOfBlocks) blocks of the same size (dim) filled with a new vector

Parameters
  • numberOfBlocks: number of blocks
  • dim: dimension of the vector

BlockVector(unsigned int numberOfBlocks)

contructor with a BlockVector of n (numberOfBlocks) blocks that point on NULL

Parameters
  • numberOfBlocks: number of blocks

~BlockVector()

destructor

VectorOfVectors::iterator begin()

iterator equal to _vect.begin

Return
a VectorOfVectors::iterator

VectorOfVectors::const_iterator begin() const

const iterator equal to _vect.begin

Return
a VectorOfVectors::iterator

void display(void) const

display data on standard output

VectorOfVectors::iterator end()

iterator equal to vect.end

Return
a VectorOfVectors::iterator

VectorOfVectors::const_iterator end() const

const iterator equal to _vect.end

Return
a VectorOfVectors::iterator

void fill(double a)

set all values of the vector component to value.

Parameters
  • a: double

VectorOfVectors getAllVect() const

get _vect, ie all the vectors of the object

Return
a VectorOfVectors

unsigned int getNumVectorAtPos(unsigned int pos) const

get the number of the vector that handles element at position “pos”

Return
unsigned int number of the searched vector
Parameters
  • pos: unsigned int, position of the element

Index getTabIndex() const

get the index tab

Return
a standard vector of int

double getValue(unsigned int i) const

return the element vector[i]

Return
a double
Parameters
  • i: an unsigned int

void insert(const SiconosVector &v)

Insert a subvector in this vector: allocation and copy.

Parameters

void insertPtr(SP::SiconosVector v)

Insert a pointer to a subvector in this vector: no reallocation nor copy.

Parameters

double normInf() const

compute the infinite norm of the vector

Return
a double

unsigned int numberOfBlocks() const

get the number of Blocks

Return
unsigned int

double &operator()(unsigned int i)

get the element at position i (warning: absolute position.)

Return
a reference to a double
Parameters
  • i: an unsigned integer

double operator()(unsigned int i) const

get the element at position i (warning: absolute position.)

Return
a double
Parameters
  • i: an unsigned integer

BlockVector &operator=(const BlockVector &vIn)

operator =

Return
BlockVector&
Parameters
  • vIn: the vector to be copied

BlockVector &operator=(const double *data)

Equality operator with raw double* data on the right-hand side.

Return
BlockVector&
Parameters

BlockVector &operator=(const SiconosVector &vIn)

operator =

Return
BlockVector&
Parameters
  • vIn: the vector to be copied

SP::SiconosVector operator[](unsigned int pos)

get the vector at position i(ie this for Simple and block i for BlockVector)

Return
a SP::SiconosVector
Parameters
  • pos: block number

SPC::SiconosVector operator[](unsigned int pos) const

get the vector at position i(ie this for Simple and block i for BlockVector)

Return
a SP::SiconosVector
Parameters
  • pos: block number

void setAllVect(VectorOfVectors &v)

set the vector array of _vect

Parameters
  • v: a VectorOfVectors

void setBlock(const SiconosVector &input, unsigned int size_block, unsigned int start_in, unsigned int start_out)

Set a subblock of the current vector with the content (copy) of a SiconosVector.

Parameters
  • input: the vector to be copied
  • size_block: size of the block to be copied
  • start_in: starting position in input vector of the block to be copied
  • start_out: starting position in current vector of the block to be filled in.

void setValue(unsigned int i, double value)

set the element vector[i]

Parameters
  • i: an unsigned int
  • value:

void setVector(unsigned int pos, const SiconosVector &v)

set i-eme SiconosVector of _vect (copy)

Parameters

void setVectorPtr(unsigned int pos, SP::SiconosVector v)

set i-eme SiconosVector of _vect (pointer link)

Parameters

unsigned int size() const

get the vector size, ie the total number of (double) elements in the vector

Return
unsigned int

const SP::Index tabIndex() const

get a pointer to the index tab

Return
SP::Index

Index::iterator tabIndexBegin()

get an iterator that points to the first element of tabIndex

Return
an Index::iterator

Index::const_iterator tabIndexBegin() const

get an iterator that points to the first element of tabIndex

Return
an Index::iterator

Index::iterator tabIndexEnd()

get an iterator that points to tabIndex.end()

Return
an Index::iterator

Index::const_iterator tabIndexEnd() const

get an iterator that points to tabIndex.end()

Return
an Index::iterator

std::string toString() const

put data of the vector into a std::string

Return
std::string

SP::SiconosVector vector(unsigned int pos)

return i-eme SiconosVector of _vect

Return
a pointer to a SiconosVector
Parameters
  • pos: block number

SPC::SiconosVector vector(unsigned int pos) const

return i-eme SiconosVector of _vect

Return
a pointer to a SiconosVector
Parameters
  • pos: block number

void zero()

sets all the values of the vector to 0.0

Friends

std::ostream &operator<<(std::ostream &os, const BlockVector &bv)

send data of the matrix to an ostream

Return
The same output stream
Parameters