Project: | Siconos |
---|---|
Internal Release Number: | 1.0 |
Last update: | September 15, 2005 |
Related Documents: |
What for? | vectors and matrices handling. |
---|---|
Feature sets: | F-2003 and F-2.303 |
Depencies: | Lapack, Blas, Lapack++. |
Sources directory name: | Kernel/src/utils/SiconosAlgebra |
// Best way: use copy constructor
SiconosMatrix *M2 = new
SiconosMatrix(*M1);
C vs Fortran
vectors and matrices ordering:
Platform and plugin functions are coded in
C/C++ , but double pointers
representing vectors and matrices given in
parameters are
column-oriented (FORTRAN format), in order to be used simply with
FORTRAN
computation libraries, e.g. Blas, through Siconos/Numerics.
Example :
1 2
3 4
M
= 5 6
7 8
9 10 11 12
1 |
5 | 9 | 2 | 6 | 10 | 3 | 7 | 11 | 4 | 8 | 12 |
int getMatrixElement(int i, int j, int n, int m, int MFor[])
{
// i and j are the coordinates of the element in the matrix M
// n is the number of lines of M
// m is the number of columns of M
// MFor is the array representing the matrix M
return MFor[i + j * n];
}
If we try to get the element M(1,3)
printf("searched element is : \%d", getMatrixElement(1, 3, 3, 4, MFor));The result displayed on the screen is : searched element is : 8.
What for? | to save variable values (ie SiconosVector) for previous time steps |
---|---|
Depencies: | SiconosVector |
Sources directory name: | Kernel/src/ utils/SiconosMemory |
This object is based on a STL container, deque, of
SiconosVector.
The size (maximum number of saved vectors) is usually fixed. When a new
vector is saved, it enters in first position, other are translated.
If
the SiconosMemory object is full, the first saved vector is deleted.
For example, SiconosMemory is useful for integrators that require
several preceding time steps values for state of the dynamical system.
The class is designed to avoid useless copies of SiconosVectors, using
pointers and push_front/push_back function of deque object.
What for? | object for exceptions handling and throwing |
---|---|
Depencies: | none |
Sources directory name: | Kernel/src/ utils/Siconos/Exception |
Seven objects: RuntimeException, XMLException, SiconosMemoryException,
SiconosMatrixException, SiconosVectorException,
SiconosSharedLibraryException, SiconosException.
The six first are derived classes from the last
one.
Example:
main cpp-file with exception handling:
int main(int argc, char* argv[])
try // main program commands ...
catch (SiconosException e)
cout « e.report() « endl;
catch(...)
cout « "Exception caught in exampleFile" « endl;