OOFEM
2.4
OOFEM.org - Object Oriented Finite Element Solver
|
Implementation of symmetric sparse matrix stored using compressed column/row storage. More...
#include <symcompcol.h>
Public Member Functions | |
SymCompCol (int n) | |
Constructor. More... | |
SymCompCol () | |
Constructor. More... | |
SymCompCol (const SymCompCol &S) | |
Copy constructor. More... | |
virtual | ~SymCompCol () |
Destructor. More... | |
virtual SparseMtrx * | GiveCopy () const |
Returns a newly allocated copy of receiver. More... | |
virtual void | times (const FloatArray &x, FloatArray &answer) const |
Evaluates . More... | |
virtual void | timesT (const FloatArray &x, FloatArray &answer) const |
Evaluates . More... | |
virtual void | times (double x) |
Multiplies receiver by scalar value. More... | |
virtual int | buildInternalStructure (EngngModel *, int, const UnknownNumberingScheme &) |
Builds internal structure of receiver. More... | |
virtual int | assemble (const IntArray &loc, const FloatMatrix &mat) |
Assembles sparse matrix from contribution of local elements. More... | |
virtual int | assemble (const IntArray &rloc, const IntArray &cloc, const FloatMatrix &mat) |
Assembles sparse matrix from contribution of local elements. More... | |
virtual bool | canBeFactorized () const |
Determines, whether receiver can be factorized. More... | |
virtual void | zero () |
Zeroes the receiver. More... | |
virtual double & | at (int i, int j) |
Returns coefficient at position (i,j). More... | |
virtual double | at (int i, int j) const |
Returns coefficient at position (i,j). More... | |
virtual const char * | giveClassName () const |
virtual SparseMtrxType | giveType () const |
Sparse matrix type identification. More... | |
virtual bool | isAntisymmetric () const |
const double & | val (int i) const |
const int & | row_ind (int i) const |
const int & | col_ptr (int i) const |
int | dim (int i) const |
Public Member Functions inherited from oofem::CompCol | |
CompCol (int n) | |
Constructor. More... | |
CompCol () | |
Constructor. More... | |
CompCol (const CompCol &S) | |
Copy constructor. More... | |
CompCol & | operator= (const CompCol &C) |
Assignment operator. More... | |
virtual | ~CompCol () |
Destructor. More... | |
virtual void | toFloatMatrix (FloatMatrix &answer) const |
Converts receiving sparse matrix to a dense float matrix. More... | |
virtual void | printYourself () const |
Prints receiver to stdout. Works only for relatively small matrices. More... | |
virtual bool | isAsymmetric () const |
Returns true if asymmetric. More... | |
FloatArray & | giveValues () |
IntArray & | giveRowIndex () |
IntArray & | giveColPtr () |
const int | giveNumberOfNonzeros () |
const double & | val (int i) const |
const int & | row_ind (int i) const |
const int & | col_ptr (int i) const |
int | dim (int i) const |
Public Member Functions inherited from oofem::SparseMtrx | |
SparseMtrx (int n, int m) | |
Constructor, creates (n,m) sparse matrix. More... | |
SparseMtrx () | |
Constructor. More... | |
virtual | ~SparseMtrx () |
Destructor. More... | |
SparseMtrxVersionType | giveVersion () |
Return receiver version. More... | |
void | checkBounds (int i, int j) const |
Checks size of receiver towards requested bounds. More... | |
int | giveNumberOfRows () const |
Returns number of rows of receiver. More... | |
int | giveNumberOfColumns () const |
Returns number of columns of receiver. More... | |
bool | isSquare () const |
Returns nonzero if receiver is square matrix. More... | |
bool | isNotEmpty () const |
Tests for empty matrix. More... | |
virtual void | times (const FloatMatrix &B, FloatMatrix &answer) const |
Evaluates . More... | |
virtual void | timesT (const FloatMatrix &B, FloatMatrix &answer) const |
Evaluates . More... | |
virtual void | add (double x, SparseMtrx &m) |
Adds x * m. More... | |
virtual void | addDiagonal (double x, FloatArray &m) |
Adds x * m (treats m as a diagonal matrix, stored as an array) More... | |
virtual int | buildInternalStructure (EngngModel *eModel, int n, int m, const IntArray &I, const IntArray &J) |
Builds internal structure of receiver based on I and J. More... | |
virtual int | buildInternalStructure (EngngModel *eModel, int di, const UnknownNumberingScheme &r_s, const UnknownNumberingScheme &c_s) |
Build internal structure of receiver. More... | |
virtual int | assembleBegin () |
Starts assembling the elements. More... | |
virtual int | assembleEnd () |
Returns when assemble is completed. More... | |
virtual SparseMtrx * | factorized () |
Returns the receiver factorized. More... | |
virtual FloatArray * | backSubstitutionWith (FloatArray &y) const |
Computes the solution of linear system where A is receiver. More... | |
virtual double | computeNorm () const |
Returns the norm of receiver. More... | |
virtual SparseMtrx * | giveSubMatrix (const IntArray &rows, const IntArray &cols) |
virtual bool | isAllocatedAt (int i, int j) const |
Checks whether memory is allocated at position (i,j). More... | |
virtual void | printStatistics () const |
Prints the receiver statistics (one-line) to stdout. More... | |
virtual void | writeToFile (const char *fname) const |
Helpful for debugging, writes the matrix to given file. More... | |
std::string | errorInfo (const char *func) const |
Error printing helper. More... | |
FloatArray | operator* (const FloatArray &x) const |
IML compatibility, . More... | |
FloatArray | trans_mult (const FloatArray &x) const |
IML compatibility, . More... | |
Protected Member Functions | |
double & | val (int i) |
int & | row_ind (int i) |
int & | col_ptr (int i) |
int | size (int i) const |
int | NumNonzeros () const |
int | base () const |
double | operator() (int i, int j) const |
implements 0-based access More... | |
double & | operator() (int i, int j) |
implements 0-based access More... | |
Protected Member Functions inherited from oofem::CompCol | |
double & | val (int i) |
int & | row_ind (int i) |
int & | col_ptr (int i) |
int | size (int i) const |
int | NumNonzeros () const |
int | base () const |
double | operator() (int i, int j) const |
implements 0-based access More... | |
double & | operator() (int i, int j) |
implements 0-based access More... | |
Additional Inherited Members | |
Public Types inherited from oofem::SparseMtrx | |
typedef long | SparseMtrxVersionType |
Protected Attributes inherited from oofem::CompCol | |
FloatArray | val_ |
IntArray | rowind_ |
IntArray | colptr_ |
int | base_ |
int | nz_ |
int | dim_ [2] |
Protected Attributes inherited from oofem::SparseMtrx | |
int | nRows |
Number of rows. More... | |
int | nColumns |
Number of columns. More... | |
SparseMtrxVersionType | version |
Allows to track if receiver changes. More... | |
Implementation of symmetric sparse matrix stored using compressed column/row storage.
Only the lower part is stored.
Definition at line 81 of file symcompcol.h.
oofem::SymCompCol::SymCompCol | ( | int | n | ) |
Constructor.
Before any operation an internal profile must be built.
n | Size of matrix |
Definition at line 90 of file symcompcol.C.
oofem::SymCompCol::SymCompCol | ( | void | ) |
Constructor.
Before any operation an internal profile must be built.
Definition at line 86 of file symcompcol.C.
Referenced by GiveCopy().
oofem::SymCompCol::SymCompCol | ( | const SymCompCol & | S | ) |
Copy constructor.
Definition at line 98 of file symcompcol.C.
|
inlinevirtual |
Destructor.
Definition at line 100 of file symcompcol.h.
|
virtual |
Assembles sparse matrix from contribution of local elements.
This method for each element adds its contribution to itself. Mapping between local element contribution and its global position is given by local code numbers of element.
loc | Location array. The values corresponding to zero loc array value are not assembled. |
mat | Contribution to be assembled using loc array. |
Reimplemented from oofem::CompCol.
Definition at line 232 of file symcompcol.C.
References oofem::CompCol::colptr_, dim(), oofem::FloatMatrix::giveNumberOfRows(), oofem::IntArray::giveSize(), oofem::SparseMtrx::nRows, OOFEM_ERROR, oofem::CompCol::rowind_, oofem::CompCol::val_, and oofem::SparseMtrx::version.
|
virtual |
Assembles sparse matrix from contribution of local elements.
This method for each element adds its contribution to itself. Mapping between local element contribution and its global position is given by row and column local code numbers.
rloc | Row location array. The values corresponding to zero loc array value are not assembled. |
cloc | Column location array. The values corresponding to zero loc array value are not assembled. |
mat | Contribution to be assembled using rloc and cloc arrays. The rloc position determines the row, the cloc position determines the corresponding column. |
Reimplemented from oofem::CompCol.
Definition at line 275 of file symcompcol.C.
References oofem::CompCol::colptr_, oofem::FloatMatrix::giveNumberOfColumns(), oofem::FloatMatrix::giveNumberOfRows(), oofem::SparseMtrx::nRows, OOFEM_ERROR, oofem::CompCol::rowind_, oofem::CompCol::val_, and oofem::SparseMtrx::version.
|
virtual |
Returns coefficient at position (i,j).
Reimplemented from oofem::CompCol.
Definition at line 327 of file symcompcol.C.
References oofem::CompCol::colptr_, OOFEM_ERROR, oofem::CompCol::rowind_, oofem::CompCol::val_, and oofem::SparseMtrx::version.
|
virtual |
Returns coefficient at position (i,j).
Reimplemented from oofem::CompCol.
Definition at line 349 of file symcompcol.C.
References oofem::CompCol::colptr_, oofem::CompCol::dim_, OOFEM_ERROR, oofem::CompCol::rowind_, and oofem::CompCol::val_.
|
inlineprotected |
Definition at line 135 of file symcompcol.h.
|
virtual |
Builds internal structure of receiver.
This method determines the internal profile of sparse matrix, allocates necessary space for storing nonzero coefficients and initializes receiver. In general, the profile of sparse matrix is determined using one (or more) loop over local code numbers of elements. This method must be called before any operation, like assembly, zeroing, or multiplication.
eModel | Pointer to corresponding engineering model. |
di | Domain index specify which domain to use. |
s | Determines unknown numbering scheme. |
Reimplemented from oofem::CompCol.
Definition at line 111 of file symcompcol.C.
References oofem::CompCol::colptr_, oofem::CompCol::dim_, oofem::Domain::giveBcs(), oofem::EngngModel::giveDomain(), oofem::Domain::giveElements(), oofem::ActiveBoundaryCondition::giveLocationArrays(), oofem::EngngModel::giveNumberOfDomainEquations(), oofem::SparseMtrx::nColumns, oofem::SparseMtrx::nRows, oofem::CompCol::nz_, OOFEM_LOG_INFO, oofem::IntArray::resize(), oofem::FloatArray::resize(), oofem::CompCol::rowind_, val(), oofem::CompCol::val_, oofem::SparseMtrx::version, and oofem::FloatArray::zero().
|
inlinevirtual |
Determines, whether receiver can be factorized.
Reimplemented from oofem::CompCol.
Definition at line 110 of file symcompcol.h.
|
inline |
Definition at line 121 of file symcompcol.h.
|
inlineprotected |
Definition at line 131 of file symcompcol.h.
|
inline |
Definition at line 122 of file symcompcol.h.
Referenced by assemble().
|
inlinevirtual |
Reimplemented from oofem::CompCol.
Definition at line 114 of file symcompcol.h.
|
virtual |
Returns a newly allocated copy of receiver.
Programmer must take care about proper deallocation of allocated space.
Reimplemented from oofem::CompCol.
Definition at line 102 of file symcompcol.C.
References SymCompCol().
|
inlinevirtual |
Sparse matrix type identification.
Reimplemented from oofem::CompCol.
Definition at line 115 of file symcompcol.h.
References oofem::SMT_SymCompCol.
|
inlinevirtual |
Definition at line 116 of file symcompcol.h.
|
inlineprotected |
Definition at line 134 of file symcompcol.h.
|
protected |
implements 0-based access
Definition at line 371 of file symcompcol.C.
References oofem::CompCol::colptr_, oofem::CompCol::dim_, OOFEM_ERROR, oofem::CompCol::rowind_, and oofem::CompCol::val_.
|
protected |
implements 0-based access
Definition at line 393 of file symcompcol.C.
References oofem::CompCol::colptr_, OOFEM_ERROR, oofem::CompCol::rowind_, oofem::CompCol::val_, and oofem::SparseMtrx::version.
|
inline |
Definition at line 120 of file symcompcol.h.
|
inlineprotected |
Definition at line 130 of file symcompcol.h.
|
inlineprotected |
Definition at line 133 of file symcompcol.h.
|
virtual |
Evaluates .
x | Array to be multiplied with receiver. |
answer | y. |
Reimplemented from oofem::CompCol.
Definition at line 195 of file symcompcol.C.
References oofem::CompCol::colptr_, oofem::CompCol::dim_, oofem::FloatArray::giveSize(), N, OOFEM_ERROR, oofem::FloatArray::resize(), oofem::CompCol::rowind_, oofem::CompCol::val_, and oofem::FloatArray::zero().
|
virtual |
Multiplies receiver by scalar value.
x | Value to multiply receiver. |
Reimplemented from oofem::CompCol.
Definition at line 222 of file symcompcol.C.
References oofem::FloatArray::times(), oofem::CompCol::val_, and oofem::SparseMtrx::version.
|
inlinevirtual |
Evaluates .
x | Array to be multiplied with transpose of the receiver. |
answer | y. |
Reimplemented from oofem::CompCol.
Definition at line 105 of file symcompcol.h.
|
inline |
Definition at line 119 of file symcompcol.h.
Referenced by buildInternalStructure().
|
inlineprotected |
Definition at line 129 of file symcompcol.h.
|
virtual |
Zeroes the receiver.
Reimplemented from oofem::CompCol.
Definition at line 315 of file symcompcol.C.
References oofem::CompCol::val_, oofem::SparseMtrx::version, and oofem::FloatArray::zero().