OOFEM 3.0
Loading...
Searching...
No Matches
oofem::SpoolesSparseMtrx Class Reference

#include <spoolessparsemtrx.h>

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

Public Member Functions

 SpoolesSparseMtrx (int n=0, int m=0, int _sflag=SPOOLES_SYMMETRIC, int _type=SPOOLES_REAL)
virtual ~SpoolesSparseMtrx ()
void times (const FloatArray &x, FloatArray &answer) const override
void timesT (const FloatArray &x, FloatArray &answer) const override
void times (double x) override
int buildInternalStructure (EngngModel *eModel, int di, const UnknownNumberingScheme &s) override
int assemble (const IntArray &loc, const FloatMatrix &mat) override
int assemble (const IntArray &rloc, const IntArray &cloc, const FloatMatrix &mat) override
bool canBeFactorized () const override
 Determines, whether receiver can be factorized.
SparseMtrxfactorized () override
FloatArraybackSubstitutionWith (FloatArray &y) const override
void zero () override
 Zeroes the receiver.
double & at (int i, int j) override
 Returns coefficient at position (i,j).
double at (int i, int j) const override
 Returns coefficient at position (i,j).
void printStatistics () const override
 Prints the receiver statistics (one-line) to stdout.
void printYourself () const override
 Prints receiver to stdout. Works only for relatively small matrices.
SparseMtrxType giveType () const override
 Sparse matrix type identification.
bool isAsymmetric () const override
 Returns true if asymmetric.
InpMtx * giveInpMtrx ()
int giveValueType () const
int giveSymmetryFlag () const
Public Member Functions inherited from oofem::SparseMtrx
 SparseMtrx (int n=0, int m=0)
virtual ~SparseMtrx ()
 Destructor.
SparseMtrxVersionType giveVersion ()
 Return receiver version.
void checkBounds (int i, int j) const
int giveNumberOfRows () const
 Returns number of rows of receiver.
int giveNumberOfColumns () const
 Returns number of columns of receiver.
bool isSquare () const
 Returns nonzero if receiver is square matrix.
bool isNotEmpty () const
 Tests for empty matrix.
virtual std::unique_ptr< SparseMtrxclone () const
virtual void times (const FloatMatrix &B, FloatMatrix &answer) const
virtual void timesT (const FloatMatrix &B, FloatMatrix &answer) const
virtual void add (double x, SparseMtrx &m)
virtual void addDiagonal (double x, FloatArray &m)
virtual int buildInternalStructure (EngngModel *eModel, int n, int m, const IntArray &I, const IntArray &J)
virtual int buildInternalStructure (EngngModel *eModel, int di, const UnknownNumberingScheme &r_s, const UnknownNumberingScheme &c_s)
virtual int assembleBegin ()
 Starts assembling the elements.
virtual int assembleEnd ()
 Returns when assemble is completed.
virtual double computeNorm () const
 Returns the norm of receiver.
virtual std::unique_ptr< SparseMtrxgiveSubMatrix (const IntArray &rows, const IntArray &cols)
virtual bool isAllocatedAt (int i, int j) const
 Checks whether memory is allocated at position (i,j).
virtual void toFloatMatrix (FloatMatrix &answer) const
 Converts receiving sparse matrix to a dense float matrix.
virtual void writeToFile (const char *fname) const
 Helpful for debugging, writes the matrix to given file.
virtual const char * giveClassName () const =0
std::string errorInfo (const char *func) const
 Error printing helper.
FloatArray operator* (const FloatArray &x) const
 IML compatibility, \( A \cdot x\).
FloatArray trans_mult (const FloatArray &x) const
 IML compatibility, \( A^{\mathrm{T}} \cdot x\).

Protected Attributes

InpMtx * mtrx
int type
int sflag
Protected Attributes inherited from oofem::SparseMtrx
int nRows
 Number of rows.
int nColumns
 Number of columns.
SparseMtrxVersionType version

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

◆ SpoolesSparseMtrx()

oofem::SpoolesSparseMtrx::SpoolesSparseMtrx ( int n = 0,
int m = 0,
int _sflag = SPOOLES_SYMMETRIC,
int _type = SPOOLES_REAL )
inline

Definition at line 60 of file spoolessparsemtrx.h.

References mtrx, sflag, oofem::SparseMtrx::SparseMtrx(), and type.

◆ ~SpoolesSparseMtrx()

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

Definition at line 65 of file spoolessparsemtrx.h.

References mtrx.

Member Function Documentation

◆ assemble() [1/2]

int oofem::SpoolesSparseMtrx::assemble ( const IntArray & loc,
const FloatMatrix & mat )
overridevirtual

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 104 of file spoolessparsemtrx.C.

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

◆ assemble() [2/2]

int oofem::SpoolesSparseMtrx::assemble ( const IntArray & rloc,
const IntArray & cloc,
const FloatMatrix & mat )
overridevirtual

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 133 of file spoolessparsemtrx.C.

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

◆ at() [1/2]

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

Returns coefficient at position (i,j).

Implements oofem::SparseMtrx.

Definition at line 168 of file spoolessparsemtrx.C.

References OOFEM_ERROR.

◆ at() [2/2]

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

Returns coefficient at position (i,j).

Implements oofem::SparseMtrx.

Definition at line 161 of file spoolessparsemtrx.C.

References OOFEM_ERROR.

◆ backSubstitutionWith()

FloatArray * oofem::SpoolesSparseMtrx::backSubstitutionWith ( FloatArray & y) const
inlineoverridevirtual

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 79 of file spoolessparsemtrx.h.

◆ buildInternalStructure()

int oofem::SpoolesSparseMtrx::buildInternalStructure ( EngngModel * eModel,
int di,
const UnknownNumberingScheme & s )
overridevirtual

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 90 of file spoolessparsemtrx.C.

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

◆ canBeFactorized()

bool oofem::SpoolesSparseMtrx::canBeFactorized ( ) const
inlineoverridevirtual

Determines, whether receiver can be factorized.

Implements oofem::SparseMtrx.

Definition at line 77 of file spoolessparsemtrx.h.

◆ factorized()

SparseMtrx * oofem::SpoolesSparseMtrx::factorized ( )
inlineoverridevirtual

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 78 of file spoolessparsemtrx.h.

References oofem::SparseMtrx::SparseMtrx().

◆ giveInpMtrx()

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

Definition at line 89 of file spoolessparsemtrx.h.

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

◆ giveSymmetryFlag()

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

Definition at line 91 of file spoolessparsemtrx.h.

References sflag.

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

◆ giveType()

SparseMtrxType oofem::SpoolesSparseMtrx::giveType ( ) const
inlineoverridevirtual

Sparse matrix type identification.

Implements oofem::SparseMtrx.

Definition at line 85 of file spoolessparsemtrx.h.

References oofem::SMT_SpoolesMtrx.

◆ giveValueType()

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

Definition at line 90 of file spoolessparsemtrx.h.

References type.

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

◆ isAsymmetric()

bool oofem::SpoolesSparseMtrx::isAsymmetric ( ) const
inlineoverridevirtual

Returns true if asymmetric.

Implements oofem::SparseMtrx.

Definition at line 86 of file spoolessparsemtrx.h.

◆ printStatistics()

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

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

Reimplemented from oofem::SparseMtrx.

Definition at line 175 of file spoolessparsemtrx.C.

References mtrx.

◆ printYourself()

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

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

Reimplemented from oofem::SparseMtrx.

Definition at line 181 of file spoolessparsemtrx.C.

References mtrx.

◆ times() [1/2]

void oofem::SpoolesSparseMtrx::times ( const FloatArray & x,
FloatArray & answer ) const
overridevirtual

Evaluates \( y = A \cdot x \)

Parameters
xArray to be multiplied with receiver.
answery.

Reimplemented from oofem::SparseMtrx.

Definition at line 44 of file spoolessparsemtrx.C.

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

◆ times() [2/2]

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

Multiplies receiver by scalar value.

Parameters
xValue to multiply receiver.

Reimplemented from oofem::SparseMtrx.

Definition at line 63 of file spoolessparsemtrx.C.

References OOFEM_ERROR.

◆ timesT()

void oofem::SpoolesSparseMtrx::timesT ( const FloatArray & x,
FloatArray & answer ) const
overridevirtual

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 69 of file spoolessparsemtrx.C.

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

◆ zero()

void oofem::SpoolesSparseMtrx::zero ( )
overridevirtual

Zeroes the receiver.

Implements oofem::SparseMtrx.

Definition at line 155 of file spoolessparsemtrx.C.

References mtrx.

Member Data Documentation

◆ mtrx

InpMtx* oofem::SpoolesSparseMtrx::mtrx
protected

◆ sflag

int oofem::SpoolesSparseMtrx::sflag
protected

Definition at line 57 of file spoolessparsemtrx.h.

Referenced by giveSymmetryFlag(), SpoolesSparseMtrx(), times(), and timesT().

◆ type

int oofem::SpoolesSparseMtrx::type
protected

Definition at line 56 of file spoolessparsemtrx.h.

Referenced by buildInternalStructure(), giveValueType(), and SpoolesSparseMtrx().


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

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011