OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
compcol.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 // Inspired by SPARSELib++
37 /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
38 /* ******** *** SparseLib++ */
39 /* ******* ** *** *** *** v. 1.5c */
40 /* ***** *** ******** ******** */
41 /* ***** *** ******** ******** R. Pozo */
42 /* ** ******* *** ** *** *** K. Remington */
43 /* ******** ******** A. Lumsdaine */
44 /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
45 /* */
46 /* */
47 /* SparseLib++ : Sparse Matrix Library */
48 /* */
49 /* National Institute of Standards and Technology */
50 /* University of Notre Dame */
51 /* Authors: R. Pozo, K. Remington, A. Lumsdaine */
52 /* */
53 /* NOTICE */
54 /* */
55 /* Permission to use, copy, modify, and distribute this software and */
56 /* its documentation for any purpose and without fee is hereby granted */
57 /* provided that the above notice appear in all copies and supporting */
58 /* documentation. */
59 /* */
60 /* Neither the Institutions (National Institute of Standards and Technology, */
61 /* University of Notre Dame) nor the Authors make any representations about */
62 /* the suitability of this software for any purpose. This software is */
63 /* provided ``as is'' without expressed or implied warranty. */
64 /* */
65 /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
66 
67 /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
68 /* Compressed column sparse matrix (O-based, Fortran) */
69 /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
70 
71 
72 #ifndef compcol_h
73 #define compcol_h
74 
75 #include "sparsemtrx.h"
76 #include "intarray.h"
77 
78 #define _IFT_CompCol_Name "csc"
79 
80 namespace oofem {
81 /*
82  * Implementation of sparse matrix stored in compressed column storage.
83  */
84 class OOFEM_EXPORT CompCol : public SparseMtrx
85 {
86 protected:
87 
88  FloatArray val_; // data values (nz_ elements)
89  IntArray rowind_; // row_ind (nz_ elements)
90  IntArray colptr_; // col_ptr (dim_[1]+1 elements)
91 
92  int base_; // index base: offset of first element
93  int nz_; // number of nonzeros
94  int dim_ [ 2 ]; // number of rows, cols
95 
96 public:
100  CompCol(int n);
104  CompCol();
106  CompCol(const CompCol & S);
108  CompCol &operator = ( const CompCol & C );
110  virtual ~CompCol() { }
111 
112  // Overloaded methods:
113  SparseMtrx *GiveCopy() const;
114  virtual void times(const FloatArray &x, FloatArray &answer) const;
115  virtual void timesT(const FloatArray &x, FloatArray &answer) const;
116  virtual void times(double x);
117  virtual int buildInternalStructure(EngngModel *, int, const UnknownNumberingScheme &s);
118  virtual int assemble(const IntArray &loc, const FloatMatrix &mat);
119  virtual int assemble(const IntArray &rloc, const IntArray &cloc, const FloatMatrix &mat);
120  virtual bool canBeFactorized() const { return false; }
121  virtual void zero();
122  virtual double &at(int i, int j);
123  virtual double at(int i, int j) const;
124  virtual void toFloatMatrix(FloatMatrix &answer) const;
125  virtual void printYourself() const;
126  virtual const char* giveClassName() const { return "CompCol"; }
127  virtual SparseMtrxType giveType() const { return SMT_CompCol; }
128  virtual bool isAsymmetric() const { return true; }
129 
130  // Breaks encapsulation, but access is needed for PARDISO and SuperLU solvers;
131  FloatArray &giveValues() { return val_; }
132  IntArray &giveRowIndex() { return rowind_; }
133  IntArray &giveColPtr() { return colptr_; }
134 
135  // Methods needed by SuperLU interface
136  const int giveNumberOfNonzeros() {return nz_;}
137 
138  const double &val(int i) const { return val_(i); }
139  const int &row_ind(int i) const { return rowind_(i); }
140  const int &col_ptr(int i) const { return colptr_(i); }
141  int dim(int i) const { return dim_ [ i ]; }
142 
143 protected:
144  /*******************************/
145  /* Access and info functions */
146  /*******************************/
147 
148  double &val(int i) { return val_(i); }
149  int &row_ind(int i) { return rowind_(i); }
150  int &col_ptr(int i) { return colptr_(i); }
151 
152  int size(int i) const { return dim_ [ i ]; }
153  int NumNonzeros() const { return nz_; }
154  int base() const { return base_; }
155 
156  /***********************************/
157  /* General access function (slow) */
158  /***********************************/
160  double operator() (int i, int j) const;
162  double &operator() (int i, int j);
163 };
164 } // end namespace oofem
165 #endif // compcol_h
IntArray & giveRowIndex()
Definition: compcol.h:132
IntArray & giveColPtr()
Definition: compcol.h:133
Base class for all matrices stored in sparse format.
Definition: sparsemtrx.h:60
virtual const char * giveClassName() const
Definition: compcol.h:126
const int & row_ind(int i) const
Definition: compcol.h:139
virtual ~CompCol()
Destructor.
Definition: compcol.h:110
int base() const
Definition: compcol.h:154
int size(int i) const
Definition: compcol.h:152
int NumNonzeros() const
Definition: compcol.h:153
virtual bool canBeFactorized() const
Determines, whether receiver can be factorized.
Definition: compcol.h:120
Compressed column.
#define S(p)
Definition: mdm.C:481
const int & col_ptr(int i) const
Definition: compcol.h:140
Class implementing an array of integers.
Definition: intarray.h:61
FloatArray & giveValues()
Definition: compcol.h:131
int & row_ind(int i)
Definition: compcol.h:149
virtual bool isAsymmetric() const
Returns true if asymmetric.
Definition: compcol.h:128
SparseMtrxType
Enumerative type used to identify the sparse matrix type.
Abstract base class allowing to control the way, how equations are assigned to individual DOFs...
int dim(int i) const
Definition: compcol.h:141
IntArray rowind_
Definition: compcol.h:89
virtual SparseMtrxType giveType() const
Sparse matrix type identification.
Definition: compcol.h:127
Class representing vector of real numbers.
Definition: floatarray.h:82
Implementation of matrix containing floating point numbers.
Definition: floatmatrix.h:94
const double & val(int i) const
Definition: compcol.h:138
double & val(int i)
Definition: compcol.h:148
Abstract base class representing the "problem" under consideration.
Definition: engngm.h:181
IntArray colptr_
Definition: compcol.h:90
the oofem namespace is to define a context or scope in which all oofem names are defined.
const int giveNumberOfNonzeros()
Definition: compcol.h:136
int & col_ptr(int i)
Definition: compcol.h:150
FloatArray val_
Definition: compcol.h:88

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