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

#include <skylineu.h>

Inheritance diagram for oofem::SkylineUnsym:
Collaboration diagram for oofem::SkylineUnsym:

Public Member Functions

 SkylineUnsym (int n=0)
 SkylineUnsym (const SkylineUnsym &s)
virtual ~SkylineUnsym ()
 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 &s) override
int setInternalStructure (IntArray &a)
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 &) 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 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.
void printStatistics () const override
 Prints the receiver statistics (one-line) to stdout.
void writeToFile (const char *fname) const override
 Helpful for debugging, writes the matrix to given file.
SparseMtrxType giveType () const override
 Sparse matrix type identification.
bool isAsymmetric () const override
 Returns true if asymmetric.
const char * giveClassName () const override
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 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).
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

void checkSizeTowards (const IntArray &)
void checkSizeTowards (const IntArray &rloc, const IntArray &cloc)
void growTo (int)
 SkylineUnsym (int n, std::vector< RowColumn > data, bool isFact)

Protected Attributes

std::vector< RowColumnrowColumns
 Row column segments.
int isFactorized
 Factorization flag.
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 implements a nonsymmetric matrix stored in a compacted (skyline) form. Its shape is symmetric, but not its coefficients. The Skyline contains 'size' row-column segments, each of them of any size; these are stored in the attribute 'rowColumns'.

Definition at line 54 of file skylineu.h.

Constructor & Destructor Documentation

◆ SkylineUnsym() [1/3]

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

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

Parameters
nSize of matrix
See also
buildInternalStructure

Definition at line 60 of file skylineu.C.

References isFactorized, and oofem::SparseMtrx::SparseMtrx().

Referenced by SkylineUnsym().

◆ SkylineUnsym() [2/3]

oofem::SkylineUnsym::SkylineUnsym ( const SkylineUnsym & s)

◆ ~SkylineUnsym()

virtual oofem::SkylineUnsym::~SkylineUnsym ( )
inlinevirtual

Destructor.

Definition at line 71 of file skylineu.h.

◆ SkylineUnsym() [3/3]

oofem::SkylineUnsym::SkylineUnsym ( int n,
std::vector< RowColumn > data,
bool isFact )
protected

Member Function Documentation

◆ assemble() [1/2]

int oofem::SkylineUnsym::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 124 of file skylineu.C.

References oofem::FloatMatrix::at(), oofem::IntArray::at(), at(), checkSizeTowards(), oofem::FloatMatrix::giveNumberOfRows(), oofem::IntArray::giveSize(), OOFEM_ERROR, and oofem::SparseMtrx::version.

◆ assemble() [2/2]

int oofem::SkylineUnsym::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 158 of file skylineu.C.

References oofem::FloatMatrix::at(), oofem::IntArray::at(), at(), checkSizeTowards(), oofem::IntArray::giveSize(), and oofem::SparseMtrx::version.

◆ at() [1/2]

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

Returns coefficient at position (i,j).

Implements oofem::SparseMtrx.

Definition at line 111 of file skylineu.C.

References rowColumns.

◆ at() [2/2]

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

Returns coefficient at position (i,j).

Implements oofem::SparseMtrx.

Definition at line 96 of file skylineu.C.

References rowColumns, and oofem::SparseMtrx::version.

Referenced by assemble(), assemble(), and toFloatMatrix().

◆ backSubstitutionWith()

FloatArray * oofem::SkylineUnsym::backSubstitutionWith ( FloatArray & y) const
overridevirtual

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 462 of file skylineu.C.

References oofem::FloatArray::at(), oofem::diag(), oofem::SparseMtrx::giveNumberOfColumns(), oofem::FloatArray::giveSize(), OOFEM_ERROR, rowColumns, and SkylineUnsym_TINY_PIVOT.

◆ buildInternalStructure()

int oofem::SkylineUnsym::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 214 of file skylineu.C.

References oofem::IntArray::at(), oofem::Domain::giveBc(), oofem::EngngModel::giveDomain(), oofem::Domain::giveElement(), oofem::ActiveBoundaryCondition::giveLocationArrays(), oofem::Domain::giveNumberOfBoundaryConditions(), oofem::EngngModel::giveNumberOfDomainEquations(), oofem::Domain::giveNumberOfElements(), oofem::IntArray::giveSize(), growTo(), oofem::min(), oofem::SparseMtrx::nColumns, oofem::SparseMtrx::nRows, printStatistics(), rowColumns, oofem::EngngModel::useNonlocalStiffnessOption(), and oofem::SparseMtrx::version.

◆ canBeFactorized()

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

Determines, whether receiver can be factorized.

Implements oofem::SparseMtrx.

Definition at line 82 of file skylineu.h.

◆ checkSizeTowards() [1/2]

void oofem::SkylineUnsym::checkSizeTowards ( const IntArray & loc)
protected

Definition at line 368 of file skylineu.C.

References growTo(), oofem::max(), and rowColumns.

Referenced by assemble(), and assemble().

◆ checkSizeTowards() [2/2]

void oofem::SkylineUnsym::checkSizeTowards ( const IntArray & rloc,
const IntArray & cloc )
protected

◆ clone()

std::unique_ptr< SparseMtrx > oofem::SkylineUnsym::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::SparseMtrx.

Definition at line 74 of file skylineu.C.

◆ factorized()

SparseMtrx * oofem::SkylineUnsym::factorized ( )
overridevirtual

◆ giveClassName()

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

Implements oofem::SparseMtrx.

Definition at line 94 of file skylineu.h.

◆ giveType()

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

Sparse matrix type identification.

Implements oofem::SparseMtrx.

Definition at line 92 of file skylineu.h.

References oofem::SMT_SkylineU.

◆ growTo()

void oofem::SkylineUnsym::growTo ( int n)
protected

◆ isAsymmetric()

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

Returns true if asymmetric.

Implements oofem::SparseMtrx.

Definition at line 93 of file skylineu.h.

◆ printStatistics()

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

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

Reimplemented from oofem::SparseMtrx.

Definition at line 552 of file skylineu.C.

References oofem::SparseMtrx::giveNumberOfRows(), OOFEM_LOG_INFO, and rowColumns.

Referenced by buildInternalStructure(), and setInternalStructure().

◆ printYourself()

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

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

Reimplemented from oofem::SparseMtrx.

Definition at line 580 of file skylineu.C.

References oofem::FloatMatrix::printYourself(), rowColumns, and toFloatMatrix().

◆ setInternalStructure()

◆ times() [1/2]

void oofem::SkylineUnsym::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 501 of file skylineu.C.

References oofem::FloatArray::at(), oofem::SparseMtrx::giveNumberOfColumns(), oofem::SparseMtrx::giveNumberOfRows(), oofem::FloatArray::giveSize(), OOFEM_ERROR, oofem::FloatArray::resize(), rowColumns, and oofem::FloatArray::zero().

◆ times() [2/2]

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

Multiplies receiver by scalar value.

Parameters
xValue to multiply receiver.

Reimplemented from oofem::SparseMtrx.

Definition at line 523 of file skylineu.C.

References oofem::SparseMtrx::giveNumberOfColumns(), rowColumns, and oofem::SparseMtrx::version.

◆ timesT()

void oofem::SkylineUnsym::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 603 of file skylineu.C.

References oofem::FloatArray::at(), oofem::SparseMtrx::giveNumberOfColumns(), oofem::SparseMtrx::giveNumberOfRows(), oofem::FloatArray::giveSize(), OOFEM_ERROR, oofem::FloatArray::resize(), rowColumns, and oofem::FloatArray::zero().

◆ toFloatMatrix()

void oofem::SkylineUnsym::toFloatMatrix ( FloatMatrix & answer) const
overridevirtual

Converts receiving sparse matrix to a dense float matrix.

Reimplemented from oofem::SparseMtrx.

Definition at line 81 of file skylineu.C.

References oofem::FloatMatrix::at(), at(), oofem::SparseMtrx::giveNumberOfColumns(), oofem::SparseMtrx::giveNumberOfRows(), oofem::FloatMatrix::resize(), rowColumns, and oofem::FloatMatrix::zero().

Referenced by printYourself(), and writeToFile().

◆ writeToFile()

void oofem::SkylineUnsym::writeToFile ( const char * fname) const
overridevirtual

Helpful for debugging, writes the matrix to given file.

Reimplemented from oofem::SparseMtrx.

Definition at line 564 of file skylineu.C.

References oofem::FloatMatrix::at(), oofem::SparseMtrx::nColumns, oofem::SparseMtrx::nRows, and toFloatMatrix().

◆ zero()

void oofem::SkylineUnsym::zero ( )
overridevirtual

Zeroes the receiver.

Implements oofem::SparseMtrx.

Definition at line 591 of file skylineu.C.

References isFactorized, rowColumns, and oofem::SparseMtrx::version.

Member Data Documentation

◆ isFactorized

int oofem::SkylineUnsym::isFactorized
protected

Factorization flag.

Definition at line 60 of file skylineu.h.

Referenced by factorized(), SkylineUnsym(), SkylineUnsym(), and zero().

◆ rowColumns


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