OOFEM 3.0
Loading...
Searching...
No Matches
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 - 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// 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
80namespace oofem {
85{
86protected:
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
95public:
99 CompCol(int n=0);
101 CompCol(const CompCol & S);
103 CompCol &operator = ( const CompCol & C );
105 virtual ~CompCol() { }
106
107 // Overloaded methods:
108 std::unique_ptr<SparseMtrx> clone() const override;
109 void times(const FloatArray &x, FloatArray &answer) const override;
110 void timesT(const FloatArray &x, FloatArray &answer) const override;
111 void times(double x) override;
112 int buildInternalStructure(EngngModel *, int, const UnknownNumberingScheme &s) override;
113 int assemble(const IntArray &loc, const FloatMatrix &mat) override;
114 int assemble(const IntArray &rloc, const IntArray &cloc, const FloatMatrix &mat) override;
115 bool canBeFactorized() const override { return false; }
116 void zero() override;
117 double &at(int i, int j) override;
118 double at(int i, int j) const override;
119 void toFloatMatrix(FloatMatrix &answer) const override;
120 void printYourself() const override;
121 const char* giveClassName() const override { return "CompCol"; }
122 SparseMtrxType giveType() const override { return SMT_CompCol; }
123 bool isAsymmetric() const override { return true; }
124
125 // Breaks encapsulation, but access is needed for PARDISO and SuperLU solvers;
126 FloatArray &giveValues() { return val; }
129
130 // Methods needed by SuperLU interface
131 const int giveNumberOfNonzeros() {return nz;}
132
133 const double &values(int i) const { return val[i]; }
134 const int &row_ind(int i) const { return rowind[i]; }
135 const int &col_ptr(int i) const { return colptr[i]; }
136
137protected:
138 /***********************************/
139 /* General access function (slow) */
140 /***********************************/
142 double operator() (int i, int j) const;
144 double &operator() (int i, int j);
145};
146} // end namespace oofem
147#endif // compcol_h
FloatArray val
Definition compcol.h:88
FloatArray & giveValues()
Definition compcol.h:126
IntArray & giveColPtr()
Definition compcol.h:128
const int & row_ind(int i) const
Definition compcol.h:134
bool isAsymmetric() const override
Returns true if asymmetric.
Definition compcol.h:123
CompCol(int n=0)
Definition compcol.C:88
bool canBeFactorized() const override
Determines, whether receiver can be factorized.
Definition compcol.h:115
const int & col_ptr(int i) const
Definition compcol.h:135
const int giveNumberOfNonzeros()
Definition compcol.h:131
const char * giveClassName() const override
Definition compcol.h:121
IntArray colptr
Definition compcol.h:90
const double & values(int i) const
Definition compcol.h:133
IntArray rowind
Definition compcol.h:89
SparseMtrxType giveType() const override
Sparse matrix type identification.
Definition compcol.h:122
IntArray & giveRowIndex()
Definition compcol.h:127
virtual ~CompCol()
Destructor.
Definition compcol.h:105
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_CompCol
Compressed column.
#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