3 #ifndef DUNE_ISTL_SUPERMATRIX_HH 4 #define DUNE_ISTL_SUPERMATRIX_HH 9 #define SUPERLU_NTYPE 1 13 #include "slu_sdefs.h" 17 #include "slu_ddefs.h" 21 #include "slu_cdefs.h" 25 #include "slu_zdefs.h" 30 #include <dune/common/fmatrix.hh> 31 #include <dune/common/fvector.hh> 32 #include <dune/common/typetraits.hh> 52 static void create(SuperMatrix *
mat,
int n,
int m,
int offset,
53 float *values,
int *rowindex,
int* colindex,
54 Stype_t stype, Dtype_t dtype, Mtype_t mtype)
56 sCreate_CompCol_Matrix(mat, n, m, offset, values, rowindex, colindex,
64 static void print(
char* name, SuperMatrix*
mat)
66 sPrint_CompCol_Matrix(name, mat);
75 static void create(SuperMatrix *
mat,
int n,
int m,
int offset,
76 double *values,
int *rowindex,
int* colindex,
77 Stype_t stype, Dtype_t dtype, Mtype_t mtype)
79 dCreate_CompCol_Matrix(mat, n, m, offset, values, rowindex, colindex,
87 static void print(
char* name, SuperMatrix*
mat)
89 dPrint_CompCol_Matrix(name, mat);
98 static void create(SuperMatrix *
mat,
int n,
int m,
int offset,
99 std::complex<float> *values,
int *rowindex,
int* colindex,
100 Stype_t stype, Dtype_t dtype, Mtype_t mtype)
102 cCreate_CompCol_Matrix(mat, n, m, offset, reinterpret_cast< ::complex*>(values),
103 rowindex, colindex, stype, dtype, mtype);
110 static void print(
char* name, SuperMatrix*
mat)
112 cPrint_CompCol_Matrix(name, mat);
121 static void create(SuperMatrix *
mat,
int n,
int m,
int offset,
122 std::complex<double> *values,
int *rowindex,
int* colindex,
123 Stype_t stype, Dtype_t dtype, Mtype_t mtype)
125 zCreate_CompCol_Matrix(mat, n, m, offset, reinterpret_cast<doublecomplex*>(values),
126 rowindex, colindex, stype, dtype, mtype);
133 static void print(
char* name, SuperMatrix*
mat)
135 zPrint_CompCol_Matrix(name, mat);
152 std::is_same<T,float>::value ? SLU_S :
153 ( std::is_same<T,std::complex<double> >::value ? SLU_Z :
154 ( std::is_same<T,std::complex<float> >::value ? SLU_C : SLU_D ));
203 template<
class B,
class TA,
int n,
int m>
207 template<
class M,
class X,
class TM,
class TD,
class T1>
231 if (this->N_+this->M_*this->Nnz_ != 0)
236 operator SuperMatrix&()
242 operator const SuperMatrix&()
const 251 ::create(&A, this->N_, this->M_, this->colstart[this->N_],
252 this->values,this->rowindex, this->colstart, SLU_NC,
261 ::create(&A, this->N_, this->M_, this->colstart[this->N_],
262 this->values,this->rowindex, this->colstart, SLU_NC,
273 virtual void setMatrix(
const Matrix&
mat,
const std::set<std::size_t>& mrs)
275 if(this->N_+this->M_+this->Nnz_!=0)
277 this->N_=mrs.size()*n;
278 this->M_=mrs.size()*m;
298 SUPERLU_FREE(A.Store);
304 template<
class T,
class A,
int n,
int m>
308 template<
class I,
class S,
class D>
325 ::create(&slumat->A, slumat->N_, slumat->M_, slumat->colstart[this->cols],
326 slumat->values,slumat->rowindex, slumat->colstart, SLU_NC,
330 SuperLUMatrix* slumat;
333 #endif // HAVE_SUPERLU virtual ~SuperLUMatrix()
Destructor.
Definition: supermatrix.hh:229
Initializer for SuperLU Matrices representing the subdomains.
Definition: overlappingschwarz.hh:42
float float_type
Definition: supermatrix.hh:181
virtual void free()
free allocated space.
Definition: supermatrix.hh:295
virtual void setMatrix(const Matrix &mat)
Initialize data from given matrix.
Definition: supermatrix.hh:285
void copyToColCompMatrix(F &initializer, const MRS &mrs)
Definition: colcompmatrix.hh:428
A::size_type size_type
The type for the index access and the size.
Definition: bcrsmatrix.hh:446
SuperLUMatrix< BCRSMatrix< FieldMatrix< B, n, m >, TA > > & operator=(const SuperLUMatrix< BCRSMatrix< FieldMatrix< B, n, m >, TA > > &mat)
Definition: supermatrix.hh:257
SuperMatrixInitializer()
Definition: supermatrix.hh:318
SuperLUMatrix(const Matrix &mat)
Constructor that initializes the data.
Definition: supermatrix.hh:222
Inititializer for the ColCompMatrix as needed by OverlappingSchwarz.
Definition: colcompmatrix.hh:153
SuperLUMatrix()
Definition: supermatrix.hh:225
Provides access to an iterator over an arbitrary subset of matrix rows.
Definition: colcompmatrix.hh:59
double float_type
Definition: supermatrix.hh:174
Definition: supermatrix.hh:41
Definition: colcompmatrix.hh:160
float float_type
Definition: supermatrix.hh:167
Definition: supermatrix.hh:147
Matrix::size_type size_type
Definition: supermatrix.hh:216
BCRSMatrix< FieldMatrix< B, n, m >, TA > Matrix
The type of the matrix to convert.
Definition: supermatrix.hh:212
Definition: matrixutils.hh:25
Utility class for converting an ISTL Matrix into a SuperLU Matrix.
Definition: supermatrix.hh:190
Dune::SuperLUMatrix< Matrix > SuperLUMatrix
Definition: supermatrix.hh:312
A sparse block matrix with compressed row storage.
Definition: bcrsmatrix.hh:411
Matrix & mat
Definition: matrixmatrix.hh:343
static const Dtype_t type
Definition: supermatrix.hh:143
Definition: basearray.hh:19
static void print(char *name, SuperMatrix *mat)
Definition: supermatrix.hh:87
This file implements a vector space as a tensor product of a given vector space. The number of compon...
double float_type
Definition: supermatrix.hh:160
SuperLUMatrix< BCRSMatrix< FieldMatrix< B, n, m >, TA > > & operator=(const BCRSMatrix< FieldMatrix< B, n, m >, TA > &mat)
Definition: supermatrix.hh:247
Definition: superlu.hh:59
Definition: supermatrix.hh:194
Implementation of the BCRSMatrix class.
size_type N() const
number of rows (counted in blocks)
Definition: bcrsmatrix.hh:1892
virtual void createMatrix() const
Definition: supermatrix.hh:321
Utility class for converting an ISTL Matrix into a column-compressed matrix.
Definition: colcompmatrix.hh:144
Provides access to an iterator over all matrix rows.
Definition: colcompmatrix.hh:21
size_type M() const
number of columns (counted in blocks)
Definition: bcrsmatrix.hh:1898
SuperMatrixInitializer(SuperLUMatrix &lum)
Definition: supermatrix.hh:314
Sequential overlapping Schwarz preconditioner.
Definition: colcompmatrix.hh:157
virtual void setMatrix(const Matrix &mat, const std::set< std::size_t > &mrs)
Initialize data from a given set of matrix rows and columns.
Definition: supermatrix.hh:273
static void create(SuperMatrix *mat, int n, int m, int offset, double *values, int *rowindex, int *colindex, Stype_t stype, Dtype_t dtype, Mtype_t mtype)
Definition: supermatrix.hh:75
Definition: supermatrix.hh:141
Definition: supermatrix.hh:45