OOFEM 3.0
Loading...
Searching...
No Matches
dyncomprow.h
Go to the documentation of this file.
1/*
2 *
3 * ##### ##### ###### ###### ### ###
4 * ## ## ## ## ## ## ## ### ##
5 * ## ## ## ## #### #### ## # ##
6 * ## ## ## ## ## ## ## ##
7 * ## ## ## ## ## ## ## ##
8 * ##### ##### ## ###### ## ##
9 *
10 *
11 * OOFEM : Object Oriented Finite Element Code
12 *
13 * Copyright (C) 1993 - 2025 Borek Patzak
14 *
15 *
16 *
17 * Czech Technical University, Faculty of Civil Engineering,
18 * Department of Structural Mechanics, 166 29 Prague, Czech Republic
19 *
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License as published by the Free Software Foundation; either
23 * version 2.1 of the License, or (at your option) any later version.
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28 * Lesser General Public License for more details.
29 *
30 * You should have received a copy of the GNU Lesser General Public
31 * License along with this library; if not, write to the Free Software
32 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33 */
34
35/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
36/* Compressed row sparse matrix (O-based, Fortran) */
37/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
38
39
40#ifndef dyncomprow_h
41#define dyncomprow_h
42
43#include "sparsemtrx.h"
44#include "intarray.h"
45
46#define _IFT_DynCompRow_Name "dcsr"
47
48namespace oofem {
49// alloc chunk for columns
50#define DynCompRow_CHUNK 8
51
52
58{
59protected:
61 std::vector<FloatArray> rows;
63 std::vector<IntArray> colind;
66
68 int base;
69
70public:
74 DynCompRow(int n=0);
76 DynCompRow(const DynCompRow & S);
78 DynCompRow &operator = ( const DynCompRow & C );
80 virtual ~DynCompRow() {}
81
82 std::unique_ptr<SparseMtrx> clone() const override;
83 void times(const FloatArray &x, FloatArray &answer) const override;
84 void timesT(const FloatArray &x, FloatArray &answer) const override;
85 void times(double x) override;
86 int buildInternalStructure(EngngModel *, int, const UnknownNumberingScheme &) override;
87 int assemble(const IntArray &loc, const FloatMatrix &mat) override;
88 int assemble(const IntArray &rloc, const IntArray &cloc, const FloatMatrix &mat) override;
89 bool canBeFactorized() const override { return false; }
90 void zero() override;
91 const char* giveClassName() const override { return "DynCompRow"; }
92 SparseMtrxType giveType() const override { return SMT_DynCompRow; }
93 bool isAsymmetric() const override { return true; }
94 void printStatistics() const override;
95 double &at(int i, int j) override;
96 double at(int i, int j) const override;
97
102 void ILUPYourself(int part_fill = 5, double drop_tol = 1.e-8);
103 void ILUPsolve(const FloatArray &x, FloatArray &y) const;
104 void ILUPtrans_solve(const FloatArray &x, FloatArray &y) const;
105
106 /*******************************/
107 /* Access and info functions */
108 /*******************************/
110 const IntArray &col_ind(int i) const { return colind[ i ]; }
112 const FloatArray &row(int i) const { return rows[ i ]; }
113
114protected:
115
116 /***********************************/
117 /* General access function (slow) */
118 /***********************************/
120 double operator() (int i, int j) const;
122 double &operator() (int i, int j);
123
125 int giveColIndx(int row, int col) const;
127 int insertColInRow(int row, int col);
128
129 void checkSizeTowards(IntArray &);
130 void checkSizeTowards(const IntArray &rloc, const IntArray &cloc);
131 void growTo(int);
132
133 void qsortRow(IntArray &ind, IntArray &ir, FloatArray &val, int l, int r);
134 int qsortRowPartition(IntArray &ind, IntArray &ir, FloatArray &val, int l, int r);
135};
136} // end namespace oofem
137#endif // dyncomprow_h
SparseMtrxType giveType() const override
Sparse matrix type identification.
Definition dyncomprow.h:92
std::vector< FloatArray > rows
data values per column
Definition dyncomprow.h:61
std::vector< IntArray > colind
row_ind per column
Definition dyncomprow.h:63
const IntArray & col_ind(int i) const
Returns col index for i-th row.
Definition dyncomprow.h:110
IntArray diag
pointers to the diagonal elements; needed only for ILU
Definition dyncomprow.h:65
int base
index base: offset of first element
Definition dyncomprow.h:68
virtual ~DynCompRow()
Destructor.
Definition dyncomprow.h:80
DynCompRow(int n=0)
Definition dyncomprow.C:57
const char * giveClassName() const override
Definition dyncomprow.h:91
bool canBeFactorized() const override
Determines, whether receiver can be factorized.
Definition dyncomprow.h:89
bool isAsymmetric() const override
Returns true if asymmetric.
Definition dyncomprow.h:93
const FloatArray & row(int i) const
Returns row values.
Definition dyncomprow.h:112
SparseMtrx(int n=0, int m=0)
Definition sparsemtrx.h:89
#define S(p)
Definition mdm.C:469
FloatArrayF< N > assemble(const FloatArrayF< M > &x, int const (&c)[M])
Assemble components into zero matrix.
FloatMatrixF< N, M > zero()
Constructs a zero matrix (this is the default behavior when constructing a matrix,...
@ SMT_DynCompRow
Dynamically growing compressed row.
#define OOFEM_EXPORT
Definition oofemcfg.h:7

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