OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
oofem::SymCompCol Class Reference

Implementation of symmetric sparse matrix stored using compressed column/row storage. More...

#include <symcompcol.h>

+ Inheritance diagram for oofem::SymCompCol:
+ Collaboration diagram for oofem::SymCompCol:

Public Member Functions

 SymCompCol (int n)
 Constructor. More...
 
 SymCompCol ()
 Constructor. More...
 
 SymCompCol (const SymCompCol &S)
 Copy constructor. More...
 
virtual ~SymCompCol ()
 Destructor. More...
 
virtual SparseMtrxGiveCopy () const
 Returns a newly allocated copy of receiver. More...
 
virtual void times (const FloatArray &x, FloatArray &answer) const
 Evaluates $ y = A \cdot x $. More...
 
virtual void timesT (const FloatArray &x, FloatArray &answer) const
 Evaluates $ y = A^{\mathrm{T}} \cdot x $. 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...
 
CompColoperator= (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...
 
FloatArraygiveValues ()
 
IntArraygiveRowIndex ()
 
IntArraygiveColPtr ()
 
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 $ C = A^{\mathrm{T}} \cdot B $. More...
 
virtual void timesT (const FloatMatrix &B, FloatMatrix &answer) const
 Evaluates $ C = A^{\mathrm{T}} \cdot B $. 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 SparseMtrxfactorized ()
 Returns the receiver factorized. More...
 
virtual FloatArraybackSubstitutionWith (FloatArray &y) const
 Computes the solution of linear system $ A\cdot x = y $ where A is receiver. More...
 
virtual double computeNorm () const
 Returns the norm of receiver. More...
 
virtual SparseMtrxgiveSubMatrix (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, $ A \cdot x$. More...
 
FloatArray trans_mult (const FloatArray &x) const
 IML compatibility, $ A^{\mathrm{T}} \cdot x$. 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...
 

Detailed Description

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.

Constructor & Destructor Documentation

oofem::SymCompCol::SymCompCol ( int  n)

Constructor.

Before any operation an internal profile must be built.

Parameters
nSize of matrix
See also
buildInternalStructure

Definition at line 90 of file symcompcol.C.

oofem::SymCompCol::SymCompCol ( void  )

Constructor.

Before any operation an internal profile must be built.

See also
buildInternalStructure

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.

virtual oofem::SymCompCol::~SymCompCol ( )
inlinevirtual

Destructor.

Definition at line 100 of file symcompcol.h.

Member Function Documentation

int oofem::SymCompCol::assemble ( const IntArray loc,
const FloatMatrix mat 
)
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.

Parameters
locLocation array. The values corresponding to zero loc array value are not assembled.
matContribution to be assembled using loc array.
Returns
Zero iff successful.

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.

int oofem::SymCompCol::assemble ( const IntArray rloc,
const IntArray cloc,
const FloatMatrix mat 
)
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.

Parameters
rlocRow location array. The values corresponding to zero loc array value are not assembled.
clocColumn location array. The values corresponding to zero loc array value are not assembled.
matContribution to be assembled using rloc and cloc arrays. The rloc position determines the row, the cloc position determines the corresponding column.
Returns
Zero iff successful.

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.

double & oofem::SymCompCol::at ( int  i,
int  j 
)
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.

double oofem::SymCompCol::at ( int  i,
int  j 
) const
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_.

int oofem::SymCompCol::base ( ) const
inlineprotected

Definition at line 135 of file symcompcol.h.

int oofem::SymCompCol::buildInternalStructure ( EngngModel eModel,
int  di,
const UnknownNumberingScheme s 
)
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.

Parameters
eModelPointer to corresponding engineering model.
diDomain index specify which domain to use.
sDetermines unknown numbering scheme.
Returns
Zero iff successful.

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().

virtual bool oofem::SymCompCol::canBeFactorized ( ) const
inlinevirtual

Determines, whether receiver can be factorized.

Reimplemented from oofem::CompCol.

Definition at line 110 of file symcompcol.h.

const int& oofem::SymCompCol::col_ptr ( int  i) const
inline

Definition at line 121 of file symcompcol.h.

int& oofem::SymCompCol::col_ptr ( int  i)
inlineprotected

Definition at line 131 of file symcompcol.h.

int oofem::SymCompCol::dim ( int  i) const
inline

Definition at line 122 of file symcompcol.h.

Referenced by assemble().

virtual const char* oofem::SymCompCol::giveClassName ( ) const
inlinevirtual

Reimplemented from oofem::CompCol.

Definition at line 114 of file symcompcol.h.

SparseMtrx * oofem::SymCompCol::GiveCopy ( ) const
virtual

Returns a newly allocated copy of receiver.

Programmer must take care about proper deallocation of allocated space.

Returns
Newly allocated copy of receiver.

Reimplemented from oofem::CompCol.

Definition at line 102 of file symcompcol.C.

References SymCompCol().

virtual SparseMtrxType oofem::SymCompCol::giveType ( ) const
inlinevirtual

Sparse matrix type identification.

Reimplemented from oofem::CompCol.

Definition at line 115 of file symcompcol.h.

References oofem::SMT_SymCompCol.

virtual bool oofem::SymCompCol::isAntisymmetric ( ) const
inlinevirtual

Definition at line 116 of file symcompcol.h.

int oofem::SymCompCol::NumNonzeros ( ) const
inlineprotected

Definition at line 134 of file symcompcol.h.

double oofem::SymCompCol::operator() ( int  i,
int  j 
) const
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_.

double & oofem::SymCompCol::operator() ( int  i,
int  j 
)
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.

const int& oofem::SymCompCol::row_ind ( int  i) const
inline

Definition at line 120 of file symcompcol.h.

int& oofem::SymCompCol::row_ind ( int  i)
inlineprotected

Definition at line 130 of file symcompcol.h.

int oofem::SymCompCol::size ( int  i) const
inlineprotected

Definition at line 133 of file symcompcol.h.

void oofem::SymCompCol::times ( const FloatArray x,
FloatArray answer 
) const
virtual

Evaluates $ y = A \cdot x $.

Parameters
xArray to be multiplied with receiver.
answery.

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().

void oofem::SymCompCol::times ( double  x)
virtual

Multiplies receiver by scalar value.

Parameters
xValue 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.

virtual void oofem::SymCompCol::timesT ( const FloatArray x,
FloatArray answer 
) const
inlinevirtual

Evaluates $ y = A^{\mathrm{T}} \cdot x $.

Parameters
xArray to be multiplied with transpose of the receiver.
answery.

Reimplemented from oofem::CompCol.

Definition at line 105 of file symcompcol.h.

const double& oofem::SymCompCol::val ( int  i) const
inline

Definition at line 119 of file symcompcol.h.

Referenced by buildInternalStructure().

double& oofem::SymCompCol::val ( int  i)
inlineprotected

Definition at line 129 of file symcompcol.h.

void oofem::SymCompCol::zero ( )
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().


The documentation for this class was generated from the following files:

This page is part of the OOFEM documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:42 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011