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

#include <skyline.h>

Inheritance diagram for oofem::Skyline:
Collaboration diagram for oofem::Skyline:

Public Member Functions

 Skyline (int n=0)
 Skyline (const Skyline &s)
 Skyline (int n, FloatArray mtrx, IntArray adr)
virtual ~Skyline ()
 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
void add (double x, SparseMtrx &m) override
int buildInternalStructure (EngngModel *, int, const UnknownNumberingScheme &) override
std::unique_ptr< SparseMtrxgiveSubMatrix (const IntArray &rows, const IntArray &cols) 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.
void rbmodes (FloatMatrix &r, int &nse, IntArray &se, double limit, int tc)
void ldl_feti_sky (FloatArray &x, FloatArray &y, int nse, double limit, IntArray &se)
double & at (int, int) override
 Returns coefficient at position (i,j).
double at (int i, int j) const override
 Returns coefficient at position (i,j).
bool isAllocatedAt (int i, int j) const override
 Checks whether memory is allocated at position (i,j).
int giveNumberOfNonZeros () const
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 writeToFile (const char *fname) const override
 Helpful for debugging, writes the matrix to given file.
int giveAllocatedSize ()
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 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 void printStatistics () const
 Prints the receiver statistics (one-line) to stdout.
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

FloatArray mtrx
 Vector of stored coefficients.
IntArray adr
 Integer array holding addresses of diagonal members.
int isFactorized
 Flag indicating whether factorized.
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

Class implementing sparse matrix stored in skyline form. This class assumes symmetric form of matrix to be stored, i.e., only upper half part is therefore stored. Coefficients are stored in one dimensional float array, containing for each column the values from the diagonal to the last nonzero entry. This requires to remember the addresses of diagonal members in such array (adr attribute)

Attribute 'isFactorized' is True if the skyline is already in U(T).D.U factorized form, else it is False. Attribute adr is array of diagonal members, it's size is size+1 (adr[0]=neni, adr[1]=1) Attribute mtrx is matrix values to skyline stored in a array form (but we start from index 1)

Tasks:

  • building its internal storage structure (method 'buildInternalStructure')
  • store and localize local matrices (method 'localize')
  • performing standard operations : multiplication by array (method 'times')
  • possible factorization and backSubstitution (recognized by nonzero result of canBeFactorized) (methods 'factorize' and 'backSubstitution')
  • setting all coefficients to zero (method 'zero')
See also
SparseMtrx class

Definition at line 68 of file skyline.h.

Constructor & Destructor Documentation

◆ Skyline() [1/3]

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

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

See also
builInternalStructure

Definition at line 62 of file skyline.C.

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

Referenced by add(), and Skyline().

◆ Skyline() [2/3]

oofem::Skyline::Skyline ( const Skyline & s)

◆ Skyline() [3/3]

oofem::Skyline::Skyline ( int n,
FloatArray mtrx,
IntArray adr )

Definition at line 75 of file skyline.C.

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

◆ ~Skyline()

virtual oofem::Skyline::~Skyline ( )
inlinevirtual

Destructor.

Definition at line 87 of file skyline.h.

Member Function Documentation

◆ add()

void oofem::Skyline::add ( double x,
SparseMtrx & m )
overridevirtual

Adds x * m.

Parameters
xValue to multiply m by.
mMatrix to add (should of the same matrix type).

Reimplemented from oofem::SparseMtrx.

Definition at line 550 of file skyline.C.

References mtrx, Skyline(), oofem::SparseMtrx::SparseMtrx(), and oofem::SparseMtrx::version.

◆ assemble() [1/2]

int oofem::Skyline::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 189 of file skyline.C.

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

◆ assemble() [2/2]

int oofem::Skyline::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 226 of file skyline.C.

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

◆ at() [1/2]

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

Returns coefficient at position (i,j).

Implements oofem::SparseMtrx.

Definition at line 122 of file skyline.C.

References adr, oofem::SparseMtrx::giveNumberOfRows(), mtrx, and OOFEM_ERROR.

◆ at() [2/2]

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

Returns coefficient at position (i,j).

Implements oofem::SparseMtrx.

Definition at line 89 of file skyline.C.

References adr, oofem::SparseMtrx::giveNumberOfRows(), mtrx, OOFEM_ERROR, and oofem::SparseMtrx::version.

Referenced by assemble(), and giveSubMatrix().

◆ backSubstitutionWith()

FloatArray * oofem::Skyline::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 248 of file skyline.C.

References adr, oofem::FloatArray::at(), oofem::SparseMtrx::giveNumberOfRows(), oofem::FloatArray::giveSize(), and mtrx.

◆ buildInternalStructure()

int oofem::Skyline::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 306 of file skyline.C.

References adr, oofem::IntArray::at(), oofem::Domain::giveBcs(), oofem::EngngModel::giveDomain(), oofem::Domain::giveElement(), oofem::Domain::giveElements(), oofem::ActiveBoundaryCondition::giveLocationArrays(), oofem::EngngModel::giveNumberOfDomainEquations(), oofem::UnknownNumberingScheme::giveRequiredNumberOfDomainEquation(), oofem::UnknownNumberingScheme::isDefault(), oofem::min(), mtrx, oofem::SparseMtrx::nColumns, oofem::SparseMtrx::nRows, and oofem::SparseMtrx::version.

◆ canBeFactorized()

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

Determines, whether receiver can be factorized.

Implements oofem::SparseMtrx.

Definition at line 107 of file skyline.h.

◆ clone()

std::unique_ptr< SparseMtrx > oofem::Skyline::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 82 of file skyline.C.

◆ factorized()

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

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 429 of file skyline.C.

References adr, oofem::Timer::getUtime(), giveNumberOfNonZeros(), oofem::SparseMtrx::giveNumberOfRows(), isFactorized, mtrx, OOFEM_LOG_DEBUG, oofem::SparseMtrx::SparseMtrx(), oofem::Timer::startTimer(), and oofem::Timer::stopTimer().

◆ giveAllocatedSize()

int oofem::Skyline::giveAllocatedSize ( )
inline

Definition at line 142 of file skyline.h.

References oofem::FloatArray::giveSize().

◆ giveClassName()

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

Implements oofem::SparseMtrx.

Definition at line 147 of file skyline.h.

◆ giveNumberOfNonZeros()

int oofem::Skyline::giveNumberOfNonZeros ( ) const
inline

Definition at line 138 of file skyline.h.

References oofem::FloatArray::giveSize().

Referenced by factorized(), giveSubMatrix(), and rbmodes().

◆ giveSubMatrix()

std::unique_ptr< SparseMtrx > oofem::Skyline::giveSubMatrix ( const IntArray & rows,
const IntArray & cols )
overridevirtual

◆ giveType()

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

Sparse matrix type identification.

Implements oofem::SparseMtrx.

Definition at line 144 of file skyline.h.

References oofem::SMT_Skyline.

◆ isAllocatedAt()

bool oofem::Skyline::isAllocatedAt ( int i,
int j ) const
overridevirtual

Checks whether memory is allocated at position (i,j).

Reimplemented from oofem::SparseMtrx.

Definition at line 148 of file skyline.C.

References adr.

Referenced by giveSubMatrix().

◆ isAsymmetric()

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

Returns true if asymmetric.

Implements oofem::SparseMtrx.

Definition at line 145 of file skyline.h.

◆ ldl_feti_sky()

void oofem::Skyline::ldl_feti_sky ( FloatArray & x,
FloatArray & y,
int nse,
double limit,
IntArray & se )

Solves the singular system of equations, the receiver should be factorized using rbmodes service.

Parameters
xsolution vector
yright hand side
nsenumber of rigid body motions
limitdetermines the linear dependence or independence
seindexes of singular equations

Definition at line 775 of file skyline.C.

References adr, oofem::FloatArray::at(), oofem::IntArray::at(), oofem::SparseMtrx::giveNumberOfRows(), and mtrx.

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

◆ printYourself()

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

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

Reimplemented from oofem::SparseMtrx.

Definition at line 560 of file skyline.C.

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

◆ rbmodes()

void oofem::Skyline::rbmodes ( FloatMatrix & r,
int & nse,
IntArray & se,
double limit,
int tc )

Splits the receiver to LDLT form, and computes the rigid body motions.

Parameters
rmatrix containing the rigid body motions base vectors.
nsenumber of rigid body motions
searray containing indexes of singular eqs.
limitdetermines linear dependence or independence
tctype of calculation = 1 = Decomposition to LDL form = 2 = ? konstruovani baze prostoru ? Ker A = 3 = Decomposition to LDL form and ? konstruovani baze prostoru ? Ker A

Definition at line 634 of file skyline.C.

References adr, oofem::FloatArray::at(), oofem::FloatMatrix::at(), oofem::IntArray::at(), oofem::FloatMatrix::clear(), giveNumberOfNonZeros(), oofem::SparseMtrx::giveNumberOfRows(), mtrx, OOFEM_LOG_INFO, oofem::FloatMatrix::resize(), and oofem::FloatMatrix::zero().

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

◆ setInternalStructure()

int oofem::Skyline::setInternalStructure ( IntArray a)

Allocates and builds internal structure according to given array holding addresses of diagonal members values (adr).

Definition at line 292 of file skyline.C.

References adr, mtrx, oofem::SparseMtrx::nColumns, oofem::SparseMtrx::nRows, and oofem::SparseMtrx::version.

◆ times() [1/2]

void oofem::Skyline::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 500 of file skyline.C.

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

Referenced by timesT().

◆ times() [2/2]

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

Multiplies receiver by scalar value.

Parameters
xValue to multiply receiver.

Reimplemented from oofem::SparseMtrx.

Definition at line 541 of file skyline.C.

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

◆ timesT()

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

Definition at line 92 of file skyline.h.

References times().

◆ toFloatMatrix()

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

Converts receiving sparse matrix to a dense float matrix.

Reimplemented from oofem::SparseMtrx.

Definition at line 163 of file skyline.C.

References adr, oofem::FloatMatrix::at(), oofem::SparseMtrx::giveNumberOfColumns(), mtrx, OOFEM_ERROR, oofem::FloatMatrix::resize(), oofem::FloatMatrix::symmetrized(), and oofem::FloatMatrix::zero().

Referenced by printYourself(), and writeToFile().

◆ writeToFile()

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

Helpful for debugging, writes the matrix to given file.

Reimplemented from oofem::SparseMtrx.

Definition at line 569 of file skyline.C.

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

◆ zero()

void oofem::Skyline::zero ( )
overridevirtual

Zeroes the receiver.

Implements oofem::SparseMtrx.

Definition at line 584 of file skyline.C.

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

Member Data Documentation

◆ adr

IntArray oofem::Skyline::adr
protected

Integer array holding addresses of diagonal members.

Definition at line 74 of file skyline.h.

Referenced by assemble(), at(), at(), backSubstitutionWith(), buildInternalStructure(), factorized(), isAllocatedAt(), ldl_feti_sky(), rbmodes(), setInternalStructure(), Skyline(), Skyline(), times(), and toFloatMatrix().

◆ isFactorized

int oofem::Skyline::isFactorized
protected

Flag indicating whether factorized.

Definition at line 76 of file skyline.h.

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

◆ mtrx

FloatArray oofem::Skyline::mtrx
protected

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