OOFEM
2.4
OOFEM.org - Object Oriented Finite Element Solver
|
This class implements a nonsymmetric matrix stored in a compacted (skyline) form. More...
#include <skylineu.h>
Public Member Functions | |
SkylineUnsym (int n) | |
Constructor. More... | |
SkylineUnsym () | |
Constructor. More... | |
virtual | ~SkylineUnsym () |
Destructor. More... | |
virtual SparseMtrx * | GiveCopy () const |
Returns a newly allocated copy of receiver. More... | |
virtual void | times (const FloatArray &x, FloatArray &answer) const |
Evaluates . More... | |
virtual void | timesT (const FloatArray &x, FloatArray &answer) const |
Evaluates . 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 SparseMtrx * | factorized () |
Returns the receiver factorized. More... | |
virtual FloatArray * | backSubstitutionWith (FloatArray &) const |
Computes the solution of linear system 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 . More... | |
virtual void | timesT (const FloatMatrix &B, FloatMatrix &answer) const |
Evaluates . 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 SparseMtrx * | giveSubMatrix (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, . More... | |
FloatArray | trans_mult (const FloatArray &x) const |
IML compatibility, . More... | |
Protected Member Functions | |
void | checkSizeTowards (const IntArray &) |
void | checkSizeTowards (const IntArray &rloc, const IntArray &cloc) |
RowColumn * | giveRowColumn (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 |
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.
oofem::SkylineUnsym::SkylineUnsym | ( | int | n | ) |
Constructor.
Before any operation an internal profile must be built.
n | Size of matrix |
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.
Definition at line 65 of file skylineu.C.
References isFactorized, rowColumns, and size.
Referenced by GiveCopy().
|
virtual |
|
protected |
Definition at line 793 of file skylineu.C.
References isFactorized, rowColumns, and size.
|
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.
loc | Location array. The values corresponding to zero loc array value are not assembled. |
mat | Contribution to be assembled using loc array. |
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.
|
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.
rloc | Row location array. The values corresponding to zero loc array value are not assembled. |
cloc | Column location array. The values corresponding to zero loc array value are not assembled. |
mat | Contribution to be assembled using rloc and cloc arrays. The rloc position determines the row, the cloc position determines the corresponding column. |
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.
|
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().
|
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().
|
virtual |
Computes the solution of linear system where A is receiver.
Solution vector x overwrites the right hand side vector y. Receiver must be in factorized form.
y | Right hand side on input, solution on output. |
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.
|
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.
eModel | Pointer to corresponding engineering model. |
di | Domain index specify which domain to use. |
s | Determines unknown numbering scheme. |
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.
|
inlinevirtual |
Determines, whether receiver can be factorized.
Implements oofem::SparseMtrx.
Definition at line 88 of file skylineu.h.
|
protected |
Definition at line 409 of file skylineu.C.
References oofem::IntArray::at(), oofem::RowColumn::checkSizeTowards(), giveRowColumn(), oofem::IntArray::giveSize(), growTo(), oofem::max(), and size.
Referenced by assemble().
|
protected |
Definition at line 217 of file skylineu.C.
References oofem::IntArray::at(), oofem::RowColumn::checkSizeTowards(), giveRowColumn(), oofem::IntArray::giveSize(), growTo(), oofem::max(), and size.
|
virtual |
Returns the receiver factorized.
form is used.
Reimplemented from oofem::SparseMtrx.
Definition at line 454 of file skylineu.C.
References oofem::FloatArray::at(), oofem::RowColumn::atDiag(), oofem::RowColumn::atL(), oofem::RowColumn::atU(), oofem::RowColumn::dot(), oofem::Timer::getUtime(), giveRowColumn(), oofem::RowColumn::giveStart(), isFactorized, oofem::max(), OOFEM_LOG_DEBUG, OOFEM_WARNING, oofem::FloatArray::resize(), size, SkylineUnsym_TINY_PIVOT, oofem::Timer::startTimer(), oofem::Timer::stopTimer(), and oofem::FloatArray::zero().
|
inlinevirtual |
Implements oofem::SparseMtrx.
Definition at line 100 of file skylineu.h.
|
virtual |
Returns a newly allocated copy of receiver.
Programmer must take care about proper deallocation of allocated space.
Reimplemented from oofem::SparseMtrx.
Definition at line 586 of file skylineu.C.
References oofem::RowColumn::GiveCopy(), giveRowColumn(), isFactorized, size, and SkylineUnsym().
|
protected |
Definition at line 654 of file skylineu.C.
References OOFEM_ERROR, rowColumns, and size.
Referenced by at(), backSubstitutionWith(), buildInternalStructure(), checkSizeTowards(), factorized(), GiveCopy(), printStatistics(), setInternalStructure(), times(), timesT(), toFloatMatrix(), and zero().
|
inlinevirtual |
Sparse matrix type identification.
Implements oofem::SparseMtrx.
Definition at line 98 of file skylineu.h.
References oofem::SMT_SkylineU.
|
protected |
Definition at line 672 of file skylineu.C.
References OOFEM_ERROR, rowColumns, and size.
Referenced by buildInternalStructure(), checkSizeTowards(), and setInternalStructure().
|
inlinevirtual |
|
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().
|
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().
int oofem::SkylineUnsym::setInternalStructure | ( | IntArray & | a | ) |
Definition at line 371 of file skylineu.C.
References oofem::IntArray::at(), giveRowColumn(), oofem::IntArray::giveSize(), oofem::RowColumn::growTo(), growTo(), oofem::SparseMtrx::nColumns, oofem::SparseMtrx::nRows, printStatistics(), oofem::IntArray::resize(), size, oofem::SparseMtrx::version, and oofem::IntArray::zero().
|
virtual |
Evaluates .
x | Array to be multiplied with receiver. |
answer | y. |
Reimplemented from oofem::SparseMtrx.
Definition at line 606 of file skylineu.C.
References oofem::FloatArray::at(), oofem::RowColumn::atDiag(), oofem::RowColumn::atU(), oofem::RowColumn::dot(), giveRowColumn(), oofem::FloatArray::giveSize(), oofem::RowColumn::giveStart(), OOFEM_ERROR, oofem::FloatArray::resize(), size, and oofem::FloatArray::zero().
|
virtual |
Multiplies receiver by scalar value.
x | Value 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.
|
virtual |
Evaluates .
x | Array to be multiplied with transpose of the receiver. |
answer | y. |
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().
|
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().
|
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().
|
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().
|
protected |
Factorization flag.
Definition at line 62 of file skylineu.h.
Referenced by factorized(), GiveCopy(), SkylineUnsym(), and zero().
|
protected |
Row column segments.
Definition at line 58 of file skylineu.h.
Referenced by buildInternalStructure(), giveRowColumn(), growTo(), SkylineUnsym(), and ~SkylineUnsym().
|
protected |
Size of receiver.
Definition at line 60 of file skylineu.h.
Referenced by backSubstitutionWith(), buildInternalStructure(), checkSizeTowards(), factorized(), GiveCopy(), giveRowColumn(), growTo(), printStatistics(), setInternalStructure(), SkylineUnsym(), times(), timesT(), toFloatMatrix(), zero(), and ~SkylineUnsym().