OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
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 - 2013 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 
48 namespace oofem {
49 // alloc chunk for columns
50 #define DynCompRow_CHUNK 8
51 
52 
57 class OOFEM_EXPORT DynCompRow : public SparseMtrx
58 {
59 protected:
60 
61  FloatArray **rows_; // data values per column
62  IntArray **colind_; // row_ind per column
63  IntArray diag_rowptr_; // pointers to the diagonal elements; needed only for ILU
64 
65  int base_; // index base: offset of first element
66 
67 public:
71  DynCompRow(int n);
75  DynCompRow();
77  DynCompRow(const DynCompRow & S);
79  DynCompRow &operator = ( const DynCompRow & C );
81  virtual ~DynCompRow();
82 
83  // Overloaded methods:
84  SparseMtrx *GiveCopy() const;
85  virtual void times(const FloatArray &x, FloatArray &answer) const;
86  virtual void timesT(const FloatArray &x, FloatArray &answer) const;
87  virtual void times(double x);
88  virtual int buildInternalStructure(EngngModel *, int, const UnknownNumberingScheme &);
89  virtual int assemble(const IntArray &loc, const FloatMatrix &mat);
90  virtual int assemble(const IntArray &rloc, const IntArray &cloc, const FloatMatrix &mat);
91  virtual bool canBeFactorized() const { return false; }
92  virtual void zero();
93  virtual const char* giveClassName() const { return "DynCompRow"; }
94  virtual SparseMtrxType giveType() const { return SMT_DynCompRow; }
95  virtual bool isAsymmetric() const { return true; }
96  virtual void printStatistics() const;
97  virtual double &at(int i, int j);
98  virtual double at(int i, int j) const;
99 
104  void ILUPYourself(int part_fill = 5, double drop_tol = 1.e-8);
105  void ILUPsolve(const FloatArray &x, FloatArray &y) const;
106  void ILUPtrans_solve(const FloatArray &x, FloatArray &y) const;
107 
108  /*******************************/
109  /* Access and info functions */
110  /*******************************/
112  const IntArray *col_ind(int i) const { return colind_ [ i ]; }
114  const FloatArray *row(int i) const { return rows_ [ i ]; }
115 
116 protected:
117 
118  /***********************************/
119  /* General access function (slow) */
120  /***********************************/
122  double operator() (int i, int j) const;
124  double &operator() (int i, int j);
125 
127  int giveColIndx(int row, int col) const;
129  int insertColInRow(int row, int col);
130 
131  void checkSizeTowards(IntArray &);
132  void checkSizeTowards(const IntArray &rloc, const IntArray &cloc);
133  void growTo(int);
134 
135  void qsortRow(IntArray &ind, IntArray &ir, FloatArray &val, int l, int r);
136  int qsortRowPartition(IntArray &ind, IntArray &ir, FloatArray &val, int l, int r);
137 };
138 } // end namespace oofem
139 #endif // dyncomprow_h
const FloatArray * row(int i) const
Returns row values.
Definition: dyncomprow.h:114
Base class for all matrices stored in sparse format.
Definition: sparsemtrx.h:60
virtual SparseMtrxType giveType() const
Sparse matrix type identification.
Definition: dyncomprow.h:94
#define S(p)
Definition: mdm.C:481
Class implementing an array of integers.
Definition: intarray.h:61
IntArray ** colind_
Definition: dyncomprow.h:62
Implementation of sparse matrix stored in compressed column storage.
Definition: dyncomprow.h:57
SparseMtrxType
Enumerative type used to identify the sparse matrix type.
virtual bool canBeFactorized() const
Determines, whether receiver can be factorized.
Definition: dyncomprow.h:91
Abstract base class allowing to control the way, how equations are assigned to individual DOFs...
virtual const char * giveClassName() const
Definition: dyncomprow.h:93
Class representing vector of real numbers.
Definition: floatarray.h:82
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
Dynamically growing compressed row.
const IntArray * col_ind(int i) const
Returns col index for i-th row.
Definition: dyncomprow.h:112
FloatArray ** rows_
Definition: dyncomprow.h:61
Abstract base class representing the "problem" under consideration.
Definition: engngm.h:181
the oofem namespace is to define a context or scope in which all oofem names are defined.
IntArray diag_rowptr_
Definition: dyncomprow.h:63
virtual bool isAsymmetric() const
Returns true if asymmetric.
Definition: dyncomprow.h:95

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:28 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011