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

This class implements a nonsymmetric matrix stored in a compacted (skyline) form. More...

#include <skylineu.h>

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

Public Member Functions

 SkylineUnsym (int n)
 Constructor. More...
 
 SkylineUnsym ()
 Constructor. More...
 
virtual ~SkylineUnsym ()
 Destructor. More...
 
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 *, int, const UnknownNumberingScheme &s)
 Builds internal structure of receiver. More...
 
int setInternalStructure (IntArray &a)
 
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 &) 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 toFloatMatrix (FloatMatrix &answer) const
 Converts receiving sparse matrix to a dense float matrix. More...
 
virtual void printYourself () const
 Prints receiver to stdout. Works only for relatively small matrices. More...
 
virtual void printStatistics () const
 Prints the receiver statistics (one-line) to stdout. More...
 
virtual void writeToFile (const char *fname) const
 Helpful for debugging, writes the matrix to given file. More...
 
virtual SparseMtrxType giveType () const
 Sparse matrix type identification. More...
 
virtual bool isAsymmetric () const
 Returns true if asymmetric. More...
 
virtual const char * giveClassName () 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...
 
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 Member Functions

void checkSizeTowards (const IntArray &)
 
void checkSizeTowards (const IntArray &rloc, const IntArray &cloc)
 
RowColumngiveRowColumn (int j) const
 
void growTo (int)
 
 SkylineUnsym (RowColumn **, int, int)
 

Protected Attributes

RowColumn ** rowColumns
 Row column segments. More...
 
int size
 Size of receiver. More...
 
int isFactorized
 Factorization flag. More...
 
- 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 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

oofem::SkylineUnsym::SkylineUnsym ( int  n)

Constructor.

Before any operation an internal profile must be built.

Parameters
nSize of matrix
See also
buildInternalStructure

Definition at line 56 of file skylineu.C.

References isFactorized, rowColumns, and size.

oofem::SkylineUnsym::SkylineUnsym ( )

Constructor.

Before any operation an internal profile must be built.

See also
buildInternalStructure

Definition at line 65 of file skylineu.C.

References isFactorized, rowColumns, and size.

Referenced by GiveCopy().

oofem::SkylineUnsym::~SkylineUnsym ( )
virtual

Destructor.

Definition at line 74 of file skylineu.C.

References rowColumns, and size.

oofem::SkylineUnsym::SkylineUnsym ( RowColumn **  newRowCol,
int  newSize,
int  isFact 
)
protected

Definition at line 793 of file skylineu.C.

References isFactorized, rowColumns, and size.

Member Function Documentation

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

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

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

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

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

Returns coefficient at position (i,j).

Implements oofem::SparseMtrx.

Definition at line 107 of file skylineu.C.

References oofem::RowColumn::atDiag(), oofem::RowColumn::atL(), oofem::RowColumn::atU(), giveRowColumn(), and oofem::SparseMtrx::version.

Referenced by assemble(), and toFloatMatrix().

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

Returns coefficient at position (i,j).

Implements oofem::SparseMtrx.

Definition at line 124 of file skylineu.C.

References oofem::RowColumn::atDiag(), oofem::RowColumn::atL(), oofem::RowColumn::atU(), and giveRowColumn().

FloatArray * oofem::SkylineUnsym::backSubstitutionWith ( FloatArray y) const
virtual

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

References oofem::RowColumn::atDiag(), oofem::RowColumn::atU(), oofem::RowColumn::dot(), giveRowColumn(), oofem::RowColumn::giveStart(), OOFEM_ERROR, size, and SkylineUnsym_TINY_PIVOT.

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

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

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

Determines, whether receiver can be factorized.

Implements oofem::SparseMtrx.

Definition at line 88 of file skylineu.h.

void oofem::SkylineUnsym::checkSizeTowards ( const IntArray loc)
protected
void oofem::SkylineUnsym::checkSizeTowards ( const IntArray rloc,
const IntArray cloc 
)
protected
virtual const char* oofem::SkylineUnsym::giveClassName ( ) const
inlinevirtual

Implements oofem::SparseMtrx.

Definition at line 100 of file skylineu.h.

SparseMtrx * oofem::SkylineUnsym::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 586 of file skylineu.C.

References oofem::RowColumn::GiveCopy(), giveRowColumn(), isFactorized, size, and SkylineUnsym().

RowColumn * oofem::SkylineUnsym::giveRowColumn ( int  j) const
protected
virtual SparseMtrxType oofem::SkylineUnsym::giveType ( ) const
inlinevirtual

Sparse matrix type identification.

Implements oofem::SparseMtrx.

Definition at line 98 of file skylineu.h.

References oofem::SMT_SkylineU.

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

Definition at line 672 of file skylineu.C.

References OOFEM_ERROR, rowColumns, and size.

Referenced by buildInternalStructure(), checkSizeTowards(), and setInternalStructure().

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

Returns true if asymmetric.

Implements oofem::SparseMtrx.

Definition at line 99 of file skylineu.h.

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

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

Reimplemented from oofem::SparseMtrx.

Definition at line 711 of file skylineu.C.

References giveRowColumn(), oofem::RowColumn::giveSize(), OOFEM_LOG_INFO, and size.

Referenced by buildInternalStructure(), and setInternalStructure().

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

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

Reimplemented from oofem::SparseMtrx.

Definition at line 739 of file skylineu.C.

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

void oofem::SkylineUnsym::times ( const FloatArray x,
FloatArray answer 
) const
virtual
void oofem::SkylineUnsym::times ( double  x)
virtual

Multiplies receiver by scalar value.

Parameters
xValue to multiply receiver.

Reimplemented from oofem::SparseMtrx.

Definition at line 632 of file skylineu.C.

References oofem::RowColumn::atDiag(), oofem::RowColumn::atL(), oofem::RowColumn::atU(), giveRowColumn(), oofem::RowColumn::giveStart(), size, and oofem::SparseMtrx::version.

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

References oofem::FloatArray::at(), oofem::RowColumn::atDiag(), oofem::RowColumn::atL(), oofem::RowColumn::dot(), giveRowColumn(), oofem::FloatArray::giveSize(), oofem::RowColumn::giveStart(), OOFEM_ERROR, oofem::FloatArray::resize(), size, and oofem::FloatArray::zero().

void oofem::SkylineUnsym::toFloatMatrix ( FloatMatrix answer) const
virtual

Converts receiving sparse matrix to a dense float matrix.

Reimplemented from oofem::SparseMtrx.

Definition at line 90 of file skylineu.C.

References at(), oofem::FloatMatrix::at(), giveRowColumn(), oofem::RowColumn::giveStart(), oofem::FloatMatrix::resize(), size, and oofem::FloatMatrix::zero().

Referenced by printYourself(), and writeToFile().

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

Helpful for debugging, writes the matrix to given file.

Reimplemented from oofem::SparseMtrx.

Definition at line 723 of file skylineu.C.

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

void oofem::SkylineUnsym::zero ( )
virtual

Zeroes the receiver.

Implements oofem::SparseMtrx.

Definition at line 749 of file skylineu.C.

References giveRowColumn(), isFactorized, size, oofem::SparseMtrx::version, and oofem::RowColumn::zero().

Member Data Documentation

int oofem::SkylineUnsym::isFactorized
protected

Factorization flag.

Definition at line 62 of file skylineu.h.

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

RowColumn** oofem::SkylineUnsym::rowColumns
protected

Row column segments.

Definition at line 58 of file skylineu.h.

Referenced by buildInternalStructure(), giveRowColumn(), growTo(), SkylineUnsym(), and ~SkylineUnsym().


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