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

#include <symcompcol.h>

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

Public Member Functions

 SymCompCol (int n=0)
 SymCompCol (const SymCompCol &S)
 Copy constructor.
virtual ~SymCompCol ()
 Destructor.
std::unique_ptr< SparseMtrxclone () const override
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 *, int, const UnknownNumberingScheme &) 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.
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).
const char * giveClassName () const override
SparseMtrxType giveType () const override
 Sparse matrix type identification.
bool isAsymmetric () const override
 Returns true if asymmetric.
Public Member Functions inherited from oofem::CompCol
 CompCol (int n=0)
 CompCol (const CompCol &S)
 Copy constructor.
CompColoperator= (const CompCol &C)
 Assignment operator.
virtual ~CompCol ()
 Destructor.
void toFloatMatrix (FloatMatrix &answer) const override
 Converts receiving sparse matrix to a dense float matrix.
void printYourself () const override
 Prints receiver to stdout. Works only for relatively small matrices.
FloatArraygiveValues ()
IntArraygiveRowIndex ()
IntArraygiveColPtr ()
const int giveNumberOfNonzeros ()
const double & values (int i) const
const int & row_ind (int i) const
const int & col_ptr (int i) 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 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 SparseMtrxfactorized ()
virtual FloatArraybackSubstitutionWith (FloatArray &y) const
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 printStatistics () const
 Prints the receiver statistics (one-line) to stdout.
virtual void writeToFile (const char *fname) const
 Helpful for debugging, writes the matrix to given file.
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 Member Functions

double operator() (int i, int j) const
 implements 0-based access
double & operator() (int i, int j)
 implements 0-based access
Protected Member Functions inherited from oofem::CompCol
double operator() (int i, int j) const
 implements 0-based access
double & operator() (int i, int j)
 implements 0-based access

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
Protected Attributes inherited from oofem::SparseMtrx
int nRows
 Number of rows.
int nColumns
 Number of columns.
SparseMtrxVersionType version

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

◆ SymCompCol() [1/2]

oofem::SymCompCol::SymCompCol ( int n = 0)

Constructor. Before any operation an internal profile must be built.

Parameters
nSize of matrix
See also
buildInternalStructure

Definition at line 84 of file symcompcol.C.

References oofem::CompCol::CompCol().

Referenced by SymCompCol().

◆ SymCompCol() [2/2]

oofem::SymCompCol::SymCompCol ( const SymCompCol & S)

Copy constructor.

Definition at line 88 of file symcompcol.C.

References oofem::CompCol::CompCol(), S, and SymCompCol().

◆ ~SymCompCol()

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

Destructor.

Definition at line 94 of file symcompcol.h.

Member Function Documentation

◆ assemble() [1/2]

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

Reimplemented from oofem::CompCol.

Definition at line 232 of file symcompcol.C.

References oofem::CompCol::colptr, oofem::FloatMatrix::giveNumberOfRows(), oofem::IntArray::giveSize(), oofem::SparseMtrx::nRows, OOFEM_ERROR, oofem::CompCol::rowind, oofem::CompCol::val, and oofem::SparseMtrx::version.

◆ assemble() [2/2]

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

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.

◆ at() [1/2]

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

◆ at() [2/2]

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

Returns coefficient at position (i,j).

Reimplemented from oofem::CompCol.

Definition at line 321 of file symcompcol.C.

References oofem::CompCol::colptr, OOFEM_ERROR, oofem::CompCol::rowind, oofem::CompCol::val, and oofem::SparseMtrx::version.

◆ buildInternalStructure()

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

Reimplemented from oofem::CompCol.

Definition at line 98 of file symcompcol.C.

References oofem::CompCol::colptr, oofem::Domain::giveBcs(), oofem::EngngModel::giveDomain(), oofem::Domain::giveElement(), oofem::Domain::giveElements(), oofem::ActiveBoundaryCondition::giveLocationArrays(), oofem::EngngModel::giveNumberOfDomainEquations(), oofem::SparseMtrx::nColumns, oofem::SparseMtrx::nRows, oofem::CompCol::nz, OOFEM_LOG_INFO, oofem::CompCol::rowind, oofem::CompCol::val, and oofem::SparseMtrx::version.

◆ canBeFactorized()

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

Determines, whether receiver can be factorized.

Reimplemented from oofem::CompCol.

Definition at line 103 of file symcompcol.h.

◆ clone()

std::unique_ptr< SparseMtrx > oofem::SymCompCol::clone ( ) const
overridevirtual

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 92 of file symcompcol.C.

◆ giveClassName()

const char * oofem::SymCompCol::giveClassName ( ) const
inlineoverridevirtual

Reimplemented from oofem::CompCol.

Definition at line 107 of file symcompcol.h.

◆ giveType()

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

Sparse matrix type identification.

Reimplemented from oofem::CompCol.

Definition at line 108 of file symcompcol.h.

References oofem::SMT_SymCompCol.

◆ isAsymmetric()

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

Returns true if asymmetric.

Reimplemented from oofem::CompCol.

Definition at line 109 of file symcompcol.h.

◆ operator()() [1/2]

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

implements 0-based access

Definition at line 377 of file symcompcol.C.

References oofem::CompCol::colptr, OOFEM_ERROR, oofem::CompCol::rowind, oofem::CompCol::val, and oofem::SparseMtrx::version.

◆ operator()() [2/2]

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

◆ times() [1/2]

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

Evaluates \( y = A \cdot x \)

Parameters
xArray to be multiplied with receiver.
answery.

Reimplemented from oofem::CompCol.

Definition at line 201 of file symcompcol.C.

References oofem::CompCol::colptr, oofem::SparseMtrx::giveNumberOfColumns(), oofem::SparseMtrx::giveNumberOfRows(), oofem::FloatArray::giveSize(), OOFEM_ERROR, oofem::FloatArray::resize(), oofem::CompCol::rowind, oofem::sum(), oofem::CompCol::val, and oofem::FloatArray::zero().

Referenced by timesT().

◆ times() [2/2]

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

Multiplies receiver by scalar value.

Parameters
xValue to multiply receiver.

Reimplemented from oofem::CompCol.

Definition at line 224 of file symcompcol.C.

References oofem::CompCol::val, and oofem::SparseMtrx::version.

◆ timesT()

void oofem::SymCompCol::timesT ( const FloatArray & x,
FloatArray & answer ) const
inlineoverridevirtual

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 98 of file symcompcol.h.

References times().

◆ zero()

void oofem::SymCompCol::zero ( )
overridevirtual

Zeroes the receiver.

Reimplemented from oofem::CompCol.

Definition at line 313 of file symcompcol.C.

References oofem::CompCol::val, and oofem::SparseMtrx::version.


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