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

#include <compcol.h>

+ Inheritance diagram for oofem::CompCol:
+ Collaboration diagram for oofem::CompCol:

Public Member Functions

 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...
 
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 &s)
 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 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 const char * giveClassName () const
 
virtual SparseMtrxType giveType () const
 Sparse matrix type identification. 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 Attributes

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

Additional Inherited Members

- Public Types inherited from oofem::SparseMtrx
typedef long SparseMtrxVersionType
 

Detailed Description

Definition at line 84 of file compcol.h.

Constructor & Destructor Documentation

oofem::CompCol::CompCol ( int  n)

Constructor.

Before any operation an internal profile must be built.

See also
buildInternalStructure

Definition at line 93 of file compcol.C.

References dim_.

oofem::CompCol::CompCol ( void  )

Constructor.

Before any operation an internal profile must be built.

See also
buildInternalStructure

Definition at line 86 of file compcol.C.

References dim_.

Referenced by GiveCopy().

oofem::CompCol::CompCol ( const CompCol S)

Copy constructor.

Definition at line 104 of file compcol.C.

References dim_, oofem::SparseMtrx::nColumns, and oofem::SparseMtrx::nRows.

virtual oofem::CompCol::~CompCol ( )
inlinevirtual

Destructor.

Definition at line 110 of file compcol.h.

Member Function Documentation

int oofem::CompCol::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.

Implements oofem::SparseMtrx.

Reimplemented in oofem::SymCompCol.

Definition at line 257 of file compcol.C.

References colptr_, dim(), oofem::FloatMatrix::giveNumberOfRows(), oofem::IntArray::giveSize(), oofem::SparseMtrx::nRows, OOFEM_ERROR, rowind_, val_, and oofem::SparseMtrx::version.

int oofem::CompCol::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.

Implements oofem::SparseMtrx.

Reimplemented in oofem::SymCompCol.

Definition at line 300 of file compcol.C.

References colptr_, oofem::FloatMatrix::giveNumberOfColumns(), oofem::FloatMatrix::giveNumberOfRows(), oofem::SparseMtrx::nRows, OOFEM_ERROR, rowind_, val_, and oofem::SparseMtrx::version.

double & oofem::CompCol::at ( int  i,
int  j 
)
virtual

Returns coefficient at position (i,j).

Implements oofem::SparseMtrx.

Reimplemented in oofem::SymCompCol.

Definition at line 359 of file compcol.C.

References colptr_, OOFEM_ERROR, rowind_, val_, and oofem::SparseMtrx::version.

double oofem::CompCol::at ( int  i,
int  j 
) const
virtual

Returns coefficient at position (i,j).

Implements oofem::SparseMtrx.

Reimplemented in oofem::SymCompCol.

Definition at line 375 of file compcol.C.

References colptr_, dim_, OOFEM_ERROR, rowind_, and val_.

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

Definition at line 154 of file compcol.h.

int oofem::CompCol::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.

Implements oofem::SparseMtrx.

Reimplemented in oofem::SymCompCol.

Definition at line 175 of file compcol.C.

References colptr_, dim_, oofem::Domain::giveBcs(), oofem::EngngModel::giveDomain(), oofem::Domain::giveElements(), oofem::ActiveBoundaryCondition::giveLocationArrays(), oofem::EngngModel::giveNumberOfDomainEquations(), oofem::SparseMtrx::nColumns, oofem::SparseMtrx::nRows, nz_, OOFEM_LOG_DEBUG, oofem::IntArray::resize(), oofem::FloatArray::resize(), rowind_, val_, oofem::SparseMtrx::version, and oofem::FloatArray::zero().

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

Determines, whether receiver can be factorized.

Implements oofem::SparseMtrx.

Reimplemented in oofem::SymCompCol.

Definition at line 120 of file compcol.h.

const int& oofem::CompCol::col_ptr ( int  i) const
inline
int& oofem::CompCol::col_ptr ( int  i)
inlineprotected

Definition at line 150 of file compcol.h.

int oofem::CompCol::dim ( int  i) const
inline
virtual const char* oofem::CompCol::giveClassName ( ) const
inlinevirtual

Implements oofem::SparseMtrx.

Reimplemented in oofem::SymCompCol.

Definition at line 126 of file compcol.h.

IntArray& oofem::CompCol::giveColPtr ( )
inline
SparseMtrx * oofem::CompCol::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::SparseMtrx.

Reimplemented in oofem::SymCompCol.

Definition at line 139 of file compcol.C.

References CompCol().

const int oofem::CompCol::giveNumberOfNonzeros ( )
inline

Definition at line 136 of file compcol.h.

Referenced by oofem::SuperLUSolver::solve().

IntArray& oofem::CompCol::giveRowIndex ( )
inline
virtual SparseMtrxType oofem::CompCol::giveType ( ) const
inlinevirtual

Sparse matrix type identification.

Implements oofem::SparseMtrx.

Reimplemented in oofem::SymCompCol.

Definition at line 127 of file compcol.h.

References oofem::SMT_CompCol.

FloatArray& oofem::CompCol::giveValues ( )
inline
virtual bool oofem::CompCol::isAsymmetric ( ) const
inlinevirtual

Returns true if asymmetric.

Implements oofem::SparseMtrx.

Definition at line 128 of file compcol.h.

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

Definition at line 153 of file compcol.h.

double oofem::CompCol::operator() ( int  i,
int  j 
) const
protected

implements 0-based access

Definition at line 391 of file compcol.C.

References colptr_, dim_, OOFEM_ERROR, rowind_, and val_.

double & oofem::CompCol::operator() ( int  i,
int  j 
)
protected

implements 0-based access

Definition at line 407 of file compcol.C.

References colptr_, OOFEM_ERROR, rowind_, val_, and oofem::SparseMtrx::version.

CompCol & oofem::CompCol::operator= ( const CompCol C)

Assignment operator.

Definition at line 120 of file compcol.C.

References base_, colptr_, dim_, oofem::SparseMtrx::nColumns, oofem::SparseMtrx::nRows, nz_, rowind_, val_, and oofem::SparseMtrx::version.

void oofem::CompCol::printYourself ( ) const
virtual

Prints receiver to stdout. Works only for relatively small matrices.

Reimplemented from oofem::SparseMtrx.

Definition at line 352 of file compcol.C.

const int& oofem::CompCol::row_ind ( int  i) const
inline
int& oofem::CompCol::row_ind ( int  i)
inlineprotected

Definition at line 149 of file compcol.h.

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

Definition at line 152 of file compcol.h.

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

Evaluates $ y = A \cdot x $.

Parameters
xArray to be multiplied with receiver.
answery.

Reimplemented from oofem::SparseMtrx.

Reimplemented in oofem::SymCompCol.

Definition at line 146 of file compcol.C.

References colptr_, dim_, oofem::FloatArray::giveSize(), N, OOFEM_ERROR, oofem::FloatArray::resize(), rowind_, val_, and oofem::FloatArray::zero().

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

Multiplies receiver by scalar value.

Parameters
xValue to multiply receiver.

Reimplemented from oofem::SparseMtrx.

Reimplemented in oofem::SymCompCol.

Definition at line 167 of file compcol.C.

References oofem::FloatArray::times(), val_, and oofem::SparseMtrx::version.

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

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

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

Reimplemented from oofem::SparseMtrx.

Reimplemented in oofem::SymCompCol.

Definition at line 422 of file compcol.C.

References colptr_, dim_, oofem::FloatArray::giveSize(), N, OOFEM_ERROR, oofem::FloatArray::resize(), rowind_, val_, and oofem::FloatArray::zero().

void oofem::CompCol::toFloatMatrix ( FloatMatrix answer) const
virtual

Converts receiving sparse matrix to a dense float matrix.

Reimplemented from oofem::SparseMtrx.

Definition at line 349 of file compcol.C.

const double& oofem::CompCol::val ( int  i) const
inline
double& oofem::CompCol::val ( int  i)
inlineprotected

Definition at line 148 of file compcol.h.

void oofem::CompCol::zero ( )
virtual

Zeroes the receiver.

Implements oofem::SparseMtrx.

Reimplemented in oofem::SymCompCol.

Definition at line 340 of file compcol.C.

References val_, oofem::SparseMtrx::version, and oofem::FloatArray::zero().

Member Data Documentation

int oofem::CompCol::base_
protected

Definition at line 92 of file compcol.h.

Referenced by operator=().

int oofem::CompCol::nz_
protected

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:34 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011