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

This class provides an sparse matrix interface to SPOOLES InpMtrx. More...

#include <spoolessparsemtrx.h>

+ Inheritance diagram for oofem::SpoolesSparseMtrx:
+ Collaboration diagram for oofem::SpoolesSparseMtrx:

Public Member Functions

 SpoolesSparseMtrx (int _type, int _nent, int _sflag, int n, int m)
 
 SpoolesSparseMtrx ()
 
virtual ~SpoolesSparseMtrx ()
 
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 *eModel, int di, 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 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 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 printStatistics () const
 Prints the receiver statistics (one-line) to stdout. More...
 
virtual void printYourself () const
 Prints receiver to stdout. Works only for relatively small matrices. More...
 
virtual SparseMtrxType giveType () const
 Sparse matrix type identification. More...
 
virtual bool isAsymmetric () const
 Returns true if asymmetric. More...
 
InpMtx * giveInpMtrx ()
 
int giveValueType () const
 
int giveSymmetryFlag () 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 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 toFloatMatrix (FloatMatrix &answer) const
 Converts receiving sparse matrix to a dense float matrix. More...
 
virtual void writeToFile (const char *fname) const
 Helpful for debugging, writes the matrix to given file. More...
 
virtual const char * giveClassName () const =0
 
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 Attributes

InpMtx * mtrx
 
int type
 
int nent
 
int sflag
 
- 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

This class provides an sparse matrix interface to SPOOLES InpMtrx.

Definition at line 52 of file spoolessparsemtrx.h.

Constructor & Destructor Documentation

oofem::SpoolesSparseMtrx::SpoolesSparseMtrx ( int  _type,
int  _nent,
int  _sflag,
int  n,
int  m 
)
inline

Definition at line 61 of file spoolessparsemtrx.h.

oofem::SpoolesSparseMtrx::SpoolesSparseMtrx ( )
inline

Definition at line 67 of file spoolessparsemtrx.h.

virtual oofem::SpoolesSparseMtrx::~SpoolesSparseMtrx ( )
inlinevirtual

Definition at line 73 of file spoolessparsemtrx.h.

Member Function Documentation

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

Definition at line 111 of file spoolessparsemtrx.C.

References oofem::IntArray::at(), oofem::FloatMatrix::at(), oofem::FloatMatrix::giveNumberOfRows(), mtrx, and oofem::SparseMtrx::version.

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

Definition at line 143 of file spoolessparsemtrx.C.

References oofem::IntArray::at(), oofem::FloatMatrix::at(), oofem::FloatMatrix::giveNumberOfColumns(), oofem::FloatMatrix::giveNumberOfRows(), mtrx, and oofem::SparseMtrx::version.

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

Returns coefficient at position (i,j).

Implements oofem::SparseMtrx.

Definition at line 174 of file spoolessparsemtrx.C.

References OOFEM_ERROR.

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

Returns coefficient at position (i,j).

Implements oofem::SparseMtrx.

Definition at line 181 of file spoolessparsemtrx.C.

References OOFEM_ERROR.

virtual FloatArray* oofem::SpoolesSparseMtrx::backSubstitutionWith ( FloatArray y) const
inlinevirtual

Computes the solution of linear system $ A\cdot x = y $ where A is receiver.

Solution vector x overwrites the right hand side vector y. Receiver must be in factorized form.

Parameters
yRight hand side on input, solution on output.
Returns
Pointer to y array.

Reimplemented from oofem::SparseMtrx.

Definition at line 89 of file spoolessparsemtrx.h.

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

Definition at line 97 of file spoolessparsemtrx.C.

References oofem::EngngModel::giveNumberOfDomainEquations(), mtrx, oofem::SparseMtrx::nColumns, nent, oofem::SparseMtrx::nRows, and type.

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

Determines, whether receiver can be factorized.

Implements oofem::SparseMtrx.

Definition at line 87 of file spoolessparsemtrx.h.

virtual SparseMtrx* oofem::SpoolesSparseMtrx::factorized ( )
inlinevirtual

Returns the receiver factorized.

$ L^{\mathrm{T}} \cdot D \cdot L $ form is used.

Returns
pointer to the receiver

Reimplemented from oofem::SparseMtrx.

Definition at line 88 of file spoolessparsemtrx.h.

SparseMtrx * oofem::SpoolesSparseMtrx::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.

Definition at line 44 of file spoolessparsemtrx.C.

References OOFEM_ERROR.

InpMtx* oofem::SpoolesSparseMtrx::giveInpMtrx ( )
inline

Definition at line 99 of file spoolessparsemtrx.h.

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

int oofem::SpoolesSparseMtrx::giveSymmetryFlag ( ) const
inline

Definition at line 101 of file spoolessparsemtrx.h.

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

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

Sparse matrix type identification.

Implements oofem::SparseMtrx.

Definition at line 95 of file spoolessparsemtrx.h.

References oofem::SMT_SpoolesMtrx.

int oofem::SpoolesSparseMtrx::giveValueType ( ) const
inline

Definition at line 100 of file spoolessparsemtrx.h.

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

virtual bool oofem::SpoolesSparseMtrx::isAsymmetric ( ) const
inlinevirtual

Returns true if asymmetric.

Implements oofem::SparseMtrx.

Definition at line 96 of file spoolessparsemtrx.h.

void oofem::SpoolesSparseMtrx::printStatistics ( ) const
virtual

Prints the receiver statistics (one-line) to stdout.

Reimplemented from oofem::SparseMtrx.

Definition at line 188 of file spoolessparsemtrx.C.

References mtrx.

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

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

Reimplemented from oofem::SparseMtrx.

Definition at line 194 of file spoolessparsemtrx.C.

References mtrx.

void oofem::SpoolesSparseMtrx::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.

Definition at line 51 of file spoolessparsemtrx.C.

References oofem::SparseMtrx::giveNumberOfColumns(), oofem::FloatArray::givePointer(), mtrx, OOFEM_ERROR, oofem::FloatArray::resize(), sflag, and oofem::FloatArray::zero().

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

Multiplies receiver by scalar value.

Parameters
xValue to multiply receiver.

Reimplemented from oofem::SparseMtrx.

Definition at line 70 of file spoolessparsemtrx.C.

References OOFEM_ERROR.

void oofem::SpoolesSparseMtrx::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.

Definition at line 76 of file spoolessparsemtrx.C.

References oofem::SparseMtrx::giveNumberOfRows(), oofem::FloatArray::givePointer(), mtrx, OOFEM_ERROR, oofem::FloatArray::resize(), sflag, and oofem::FloatArray::zero().

void oofem::SpoolesSparseMtrx::zero ( )
virtual

Zeroes the receiver.

Implements oofem::SparseMtrx.

Definition at line 168 of file spoolessparsemtrx.C.

References mtrx.

Member Data Documentation

InpMtx* oofem::SpoolesSparseMtrx::mtrx
protected
int oofem::SpoolesSparseMtrx::nent
protected

Definition at line 57 of file spoolessparsemtrx.h.

Referenced by buildInternalStructure().

int oofem::SpoolesSparseMtrx::sflag
protected

Definition at line 58 of file spoolessparsemtrx.h.

Referenced by times(), and timesT().

int oofem::SpoolesSparseMtrx::type
protected

Definition at line 56 of file spoolessparsemtrx.h.

Referenced by buildInternalStructure().


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