|
OOFEM 3.0
|
#include <dyncomprow.h>
Public Member Functions | |
| DynCompRow (int n=0) | |
| DynCompRow (const DynCompRow &S) | |
| Copy constructor. | |
| DynCompRow & | operator= (const DynCompRow &C) |
| Assignment operator. | |
| virtual | ~DynCompRow () |
| Destructor. | |
| std::unique_ptr< SparseMtrx > | clone () 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. | |
| const char * | giveClassName () const override |
| SparseMtrxType | giveType () const override |
| Sparse matrix type identification. | |
| bool | isAsymmetric () const override |
| Returns true if asymmetric. | |
| void | printStatistics () const override |
| Prints the receiver statistics (one-line) to stdout. | |
| 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 | ILUPYourself (int part_fill=5, double drop_tol=1.e-8) |
| void | ILUPsolve (const FloatArray &x, FloatArray &y) const |
| void | ILUPtrans_solve (const FloatArray &x, FloatArray &y) const |
| const IntArray & | col_ind (int i) const |
| Returns col index for i-th row. | |
| const FloatArray & | row (int i) const |
| Returns row values. | |
| 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 SparseMtrx * | factorized () |
| virtual FloatArray * | backSubstitutionWith (FloatArray &y) const |
| virtual double | computeNorm () const |
| Returns the norm of receiver. | |
| virtual std::unique_ptr< 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). | |
| virtual void | toFloatMatrix (FloatMatrix &answer) const |
| Converts receiving sparse matrix to a dense float matrix. | |
| virtual void | printYourself () const |
| Prints receiver to stdout. Works only for relatively small matrices. | |
| 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 | |
| int | giveColIndx (int row, int col) const |
| returns the column index of given column at given row, else returns zero. | |
| int | insertColInRow (int row, int col) |
| insert column entry into row, preserving order of column indexes, returns the index of new row. | |
| void | checkSizeTowards (IntArray &) |
| void | checkSizeTowards (const IntArray &rloc, const IntArray &cloc) |
| void | growTo (int) |
| void | qsortRow (IntArray &ind, IntArray &ir, FloatArray &val, int l, int r) |
| int | qsortRowPartition (IntArray &ind, IntArray &ir, FloatArray &val, int l, int r) |
Protected Attributes | |
| std::vector< FloatArray > | rows |
| data values per column | |
| std::vector< IntArray > | colind |
| row_ind per column | |
| IntArray | diag |
| pointers to the diagonal elements; needed only for ILU | |
| int | base |
| index base: offset of first element | |
| 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 |
Implementation of sparse matrix stored in compressed column storage. Designed to allow simple dynamic runtime grow of receiver.
Definition at line 57 of file dyncomprow.h.
| oofem::DynCompRow::DynCompRow | ( | int | n = 0 | ) |
Constructor. Before any operation an internal profile must be built.
Definition at line 57 of file dyncomprow.C.
References base, and oofem::SparseMtrx::SparseMtrx().
Referenced by DynCompRow(), and operator=().
| oofem::DynCompRow::DynCompRow | ( | const DynCompRow & | S | ) |
Copy constructor.
Definition at line 62 of file dyncomprow.C.
References base, colind, diag, DynCompRow(), oofem::SparseMtrx::nColumns, oofem::SparseMtrx::nRows, rows, S, oofem::SparseMtrx::SparseMtrx(), and oofem::SparseMtrx::version.
|
inlinevirtual |
Destructor.
Definition at line 80 of file dyncomprow.h.
|
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.
| 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 218 of file dyncomprow.C.
References at(), oofem::FloatMatrix::at(), oofem::IntArray::at(), oofem::FloatMatrix::giveNumberOfRows(), oofem::IntArray::giveSize(), OOFEM_ERROR, and oofem::SparseMtrx::version.
|
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.
| 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 244 of file dyncomprow.C.
References oofem::IntArray::giveSize(), insertColInRow(), rows, and oofem::SparseMtrx::version.
|
overridevirtual |
Returns coefficient at position (i,j).
Implements oofem::SparseMtrx.
Definition at line 306 of file dyncomprow.C.
References giveColIndx(), oofem::SparseMtrx::nColumns, oofem::SparseMtrx::nRows, OOFEM_ERROR, and rows.
|
overridevirtual |
Returns coefficient at position (i,j).
Implements oofem::SparseMtrx.
Definition at line 292 of file dyncomprow.C.
References giveColIndx(), OOFEM_ERROR, rows, and oofem::SparseMtrx::version.
Referenced by assemble(), giveColIndx(), ILUPsolve(), ILUPtrans_solve(), ILUPYourself(), and insertColInRow().
|
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.
| 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 119 of file dyncomprow.C.
References oofem::IntArray::at(), colind, oofem::Timer::getUtime(), oofem::Domain::giveBcs(), oofem::EngngModel::giveDomain(), oofem::Domain::giveElement(), oofem::Domain::giveElements(), oofem::ActiveBoundaryCondition::giveLocationArrays(), oofem::EngngModel::giveNumberOfDomainEquations(), oofem::IntArray::giveSize(), growTo(), insertColInRow(), OOFEM_LOG_DEBUG, rows, oofem::Timer::startTimer(), oofem::Timer::stopTimer(), and oofem::SparseMtrx::version.
|
inlineoverridevirtual |
Determines, whether receiver can be factorized.
Implements oofem::SparseMtrx.
Definition at line 89 of file dyncomprow.h.
Definition at line 396 of file dyncomprow.C.
References oofem::IntArray::giveSize(), growTo(), insertColInRow(), and oofem::max().
|
protected |
Definition at line 371 of file dyncomprow.C.
References oofem::IntArray::giveSize(), growTo(), insertColInRow(), and oofem::max().
|
overridevirtual |
Returns a newly allocated copy of receiver. Programmer must take care about proper deallocation of allocated space.
Reimplemented from oofem::SparseMtrx.
Definition at line 85 of file dyncomprow.C.
|
inline |
|
inlineoverridevirtual |
Implements oofem::SparseMtrx.
Definition at line 91 of file dyncomprow.h.
|
protected |
returns the column index of given column at given row, else returns zero.
Definition at line 437 of file dyncomprow.C.
References at(), colind, and row().
Referenced by at(), at(), ILUPYourself(), operator()(), and operator()().
|
inlineoverridevirtual |
Sparse matrix type identification.
Implements oofem::SparseMtrx.
Definition at line 92 of file dyncomprow.h.
References oofem::SMT_DynCompRow.
|
protected |
Definition at line 427 of file dyncomprow.C.
References colind, oofem::SparseMtrx::nColumns, oofem::SparseMtrx::nRows, and rows.
Referenced by buildInternalStructure(), checkSizeTowards(), and checkSizeTowards().
| void oofem::DynCompRow::ILUPsolve | ( | const FloatArray & | x, |
| FloatArray & | y ) const |
Definition at line 771 of file dyncomprow.C.
References at(), colind, diag, oofem::FloatArray::giveSize(), oofem::FloatArray::resize(), rows, and oofem::FloatArray::zero().
| void oofem::DynCompRow::ILUPtrans_solve | ( | const FloatArray & | x, |
| FloatArray & | y ) const |
Definition at line 801 of file dyncomprow.C.
References at(), colind, diag, oofem::FloatArray::giveSize(), oofem::FloatArray::resize(), and rows.
| void oofem::DynCompRow::ILUPYourself | ( | int | part_fill = 5, |
| double | drop_tol = 1.e-8 ) |
Performs LU factorization on yourself; modifies receiver This routine computes the L and U factors of the ILU(p).
Definition at line 533 of file dyncomprow.C.
References at(), oofem::FloatArray::at(), oofem::IntArray::at(), colind, diag, oofem::Timer::getUtime(), giveColIndx(), oofem::FloatArray::giveSize(), oofem::IntArray::giveSize(), ILU_ROW_CHUNK, oofem::SparseMtrx::nColumns, oofem::SparseMtrx::nRows, OOFEM_ERROR, OOFEM_LOG_DEBUG, qsortRow(), oofem::FloatArray::resize(), oofem::IntArray::resize(), oofem::FloatArray::resizeWithValues(), oofem::IntArray::resizeWithValues(), rows, oofem::Timer::startTimer(), oofem::Timer::stopTimer(), and oofem::SparseMtrx::version.
|
protected |
insert column entry into row, preserving order of column indexes, returns the index of new row.
Definition at line 471 of file dyncomprow.C.
References at(), colind, DynCompRow_CHUNK, row(), and rows.
Referenced by assemble(), buildInternalStructure(), checkSizeTowards(), and checkSizeTowards().
|
inlineoverridevirtual |
Returns true if asymmetric.
Implements oofem::SparseMtrx.
Definition at line 93 of file dyncomprow.h.
|
protected |
implements 0-based access
Definition at line 336 of file dyncomprow.C.
References giveColIndx(), OOFEM_ERROR, rows, and oofem::SparseMtrx::version.
|
protected |
implements 0-based access
Definition at line 321 of file dyncomprow.C.
References giveColIndx(), oofem::SparseMtrx::nColumns, oofem::SparseMtrx::nRows, OOFEM_ERROR, and rows.
| DynCompRow & oofem::DynCompRow::operator= | ( | const DynCompRow & | C | ) |
Assignment operator.
Definition at line 72 of file dyncomprow.C.
References base, colind, diag, DynCompRow(), oofem::SparseMtrx::nColumns, oofem::SparseMtrx::nRows, rows, and oofem::SparseMtrx::version.
|
overridevirtual |
Prints the receiver statistics (one-line) to stdout.
Reimplemented from oofem::SparseMtrx.
Definition at line 281 of file dyncomprow.C.
References oofem::SparseMtrx::nRows, row(), and rows.
|
protected |
Definition at line 827 of file dyncomprow.C.
References qsortRow(), and qsortRowPartition().
Referenced by ILUPYourself(), and qsortRow().
|
protected |
Definition at line 840 of file dyncomprow.C.
Referenced by qsortRow().
|
inline |
Returns row values.
Definition at line 112 of file dyncomprow.h.
References rows.
Referenced by giveColIndx(), insertColInRow(), printStatistics(), times(), and zero().
|
overridevirtual |
Evaluates \( y = A \cdot x \)
| x | Array to be multiplied with receiver. |
| answer | y. |
Reimplemented from oofem::SparseMtrx.
Definition at line 91 of file dyncomprow.C.
References colind, oofem::FloatArray::giveSize(), oofem::SparseMtrx::nColumns, oofem::SparseMtrx::nRows, OOFEM_ERROR, oofem::FloatArray::resize(), rows, and oofem::FloatArray::zero().
|
overridevirtual |
Multiplies receiver by scalar value.
| x | Value to multiply receiver. |
Reimplemented from oofem::SparseMtrx.
Definition at line 110 of file dyncomprow.C.
References row(), rows, and oofem::SparseMtrx::version.
|
overridevirtual |
Evaluates \( y = A^{\mathrm{T}} \cdot x \)
| x | Array to be multiplied with transpose of the receiver. |
| answer | y. |
Reimplemented from oofem::SparseMtrx.
Definition at line 351 of file dyncomprow.C.
References colind, oofem::FloatArray::giveSize(), oofem::SparseMtrx::nColumns, oofem::SparseMtrx::nRows, OOFEM_ERROR, oofem::FloatArray::resize(), rows, and oofem::FloatArray::zero().
|
overridevirtual |
Zeroes the receiver.
Implements oofem::SparseMtrx.
Definition at line 271 of file dyncomprow.C.
References row(), rows, and oofem::SparseMtrx::version.
|
protected |
index base: offset of first element
Definition at line 68 of file dyncomprow.h.
Referenced by DynCompRow(), DynCompRow(), and operator=().
|
protected |
row_ind per column
Definition at line 63 of file dyncomprow.h.
Referenced by buildInternalStructure(), col_ind(), DynCompRow(), giveColIndx(), growTo(), ILUPsolve(), ILUPtrans_solve(), ILUPYourself(), insertColInRow(), operator=(), times(), and timesT().
|
protected |
pointers to the diagonal elements; needed only for ILU
Definition at line 65 of file dyncomprow.h.
Referenced by DynCompRow(), ILUPsolve(), ILUPtrans_solve(), ILUPYourself(), and operator=().
|
protected |
data values per column
Definition at line 61 of file dyncomprow.h.
Referenced by assemble(), at(), at(), buildInternalStructure(), DynCompRow(), growTo(), ILUPsolve(), ILUPtrans_solve(), ILUPYourself(), insertColInRow(), operator()(), operator()(), operator=(), printStatistics(), row(), times(), times(), timesT(), and zero().