5#ifndef DUNE_ISTL_SUPERMATRIX_HH
6#define DUNE_ISTL_SUPERMATRIX_HH
12#include <dune/common/fmatrix.hh>
13#include <dune/common/fvector.hh>
14#include <dune/common/typetraits.hh>
32#if __has_include("slu_sdefs.h")
36 static void create(SuperMatrix *
mat,
int n,
int m,
int offset,
37 float *values,
int *rowindex,
int* colindex,
38 Stype_t stype, Dtype_t dtype, Mtype_t mtype)
40 sCreate_CompCol_Matrix(
mat, n, m, offset, values, rowindex, colindex,
46 struct SuperMatrixPrinter<float>
48 static void print(
char* name, SuperMatrix*
mat)
50 sPrint_CompCol_Matrix(name,
mat);
55#if __has_include("slu_ddefs.h")
57 struct SuperMatrixCreateSparseChooser<double>
59 static void create(SuperMatrix *
mat,
int n,
int m,
int offset,
60 double *values,
int *rowindex,
int* colindex,
61 Stype_t stype, Dtype_t dtype, Mtype_t mtype)
63 dCreate_CompCol_Matrix(
mat, n, m, offset, values, rowindex, colindex,
69 struct SuperMatrixPrinter<double>
71 static void print(
char* name, SuperMatrix*
mat)
73 dPrint_CompCol_Matrix(name,
mat);
78#if __has_include("slu_cdefs.h")
80 struct SuperMatrixCreateSparseChooser<
std::complex<float> >
82 static void create(SuperMatrix *
mat,
int n,
int m,
int offset,
83 std::complex<float> *values,
int *rowindex,
int* colindex,
84 Stype_t stype, Dtype_t dtype, Mtype_t mtype)
86 cCreate_CompCol_Matrix(
mat, n, m, offset,
reinterpret_cast< ::complex*
>(values),
87 rowindex, colindex, stype, dtype, mtype);
92 struct SuperMatrixPrinter<
std::complex<float> >
94 static void print(
char* name, SuperMatrix*
mat)
96 cPrint_CompCol_Matrix(name,
mat);
101#if __has_include("slu_zdefs.h")
103 struct SuperMatrixCreateSparseChooser<
std::complex<double> >
105 static void create(SuperMatrix *
mat,
int n,
int m,
int offset,
106 std::complex<double> *values,
int *rowindex,
int* colindex,
107 Stype_t stype, Dtype_t dtype, Mtype_t mtype)
109 zCreate_CompCol_Matrix(
mat, n, m, offset,
reinterpret_cast<doublecomplex*
>(values),
110 rowindex, colindex, stype, dtype, mtype);
115 struct SuperMatrixPrinter<
std::complex<double> >
117 static void print(
char* name, SuperMatrix*
mat)
119 zPrint_CompCol_Matrix(name,
mat);
136 std::is_same<T,float>::value ? SLU_S :
137 ( std::is_same<T,std::complex<double> >::value ? SLU_Z :
138 ( std::is_same<T,std::complex<float> >::value ? SLU_C : SLU_D ));
184 template<
class M,
class X,
class TM,
class TD,
class T1>
187 template<
class T,
bool flag>
193 template<
class B,
class TA>
195 :
public ISTL::Impl::BCCSMatrix<typename BCRSMatrix<B,TA>::field_type, int>
197 template<
class M,
class X,
class TM,
class TD,
class T1>
221 if (this->N_+this->M_*this->Nnz_ != 0)
226 operator SuperMatrix&()
232 operator const SuperMatrix&()
const
239 if (this->N_ + this->M_ + this->Nnz_!=0)
245 ISTL::Impl::BCCSMatrixInitializer<Matrix, int> initializer(*
this);
247 copyToBCCSMatrix(initializer,
mat);
250 ::create(&A, this->N_, this->M_, this->colstart[this->N_],
251 this->values,this->rowindex, this->colstart, SLU_NC,
258 if (this->N_ + this->M_ + this->Nnz_!=0)
264 ISTL::Impl::BCCSMatrixInitializer<Matrix, int> initializer(*
this);
266 copyToBCCSMatrix(initializer,
mat);
269 ::create(&A, this->N_, this->M_, this->colstart[this->N_],
270 this->values,this->rowindex, this->colstart, SLU_NC,
283 if(this->N_+this->M_+this->Nnz_!=0)
289 copyToBCCSMatrix(initializer, ISTL::Impl::MatrixRowSubset<
Matrix,std::set<std::size_t> >(
mat,mrs));
299 copyToBCCSMatrix(initializer,
mat);
305 ISTL::Impl::BCCSMatrix<typename BCRSMatrix<B,TA>::field_type,
int>::free();
306 SUPERLU_FREE(A.Store);
312 template<
class B,
class A>
314 :
public ISTL::Impl::BCCSMatrixInitializer<BCRSMatrix<B,A>, int>
316 template<
class I,
class S,
class D>
331 ISTL::Impl::BCCSMatrixInitializer<BCRSMatrix<B,A>,
int>::createMatrix();
333 ::create(&slumat->A, slumat->N_, slumat->M_, slumat->colstart[this->cols],
334 slumat->values,slumat->rowindex, slumat->colstart, SLU_NC,
This file implements a vector space as a tensor product of a given vector space. The number of compon...
Implementation of the BCRSMatrix class.
Matrix & mat
Definition matrixmatrix.hh:347
Definition allocator.hh:11
Initializer for SuperLU Matrices representing the subdomains.
Definition overlappingschwarz.hh:47
static auto coldim(const M &A)
Definition matrixutils.hh:219
static auto rowdim(const M &A)
Definition matrixutils.hh:214
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
A::size_type size_type
The type for the index access and the size.
Definition bcrsmatrix.hh:500
Sequential overlapping Schwarz preconditioner.
Definition overlappingschwarz.hh:755
Definition overlappingschwarz.hh:694
SuperLu Solver.
Definition superlu.hh:271
Definition supermatrix.hh:26
Definition supermatrix.hh:30
Definition supermatrix.hh:126
static const Dtype_t type
Definition supermatrix.hh:127
Definition supermatrix.hh:132
double float_type
Definition supermatrix.hh:144
float float_type
Definition supermatrix.hh:151
double float_type
Definition supermatrix.hh:158
float float_type
Definition supermatrix.hh:165
Utility class for converting an ISTL Matrix into a SuperLU Matrix.
Definition supermatrix.hh:175
Definition supermatrix.hh:179
virtual void free()
free allocated space.
Definition supermatrix.hh:303
SuperLUMatrix< BCRSMatrix< B, TA > > & operator=(const SuperLUMatrix< BCRSMatrix< B, TA > > &mat)
Definition supermatrix.hh:256
SuperLUMatrix< BCRSMatrix< B, TA > > & operator=(const BCRSMatrix< B, TA > &mat)
Definition supermatrix.hh:237
SuperLUMatrix(const Matrix &mat)
Constructor that initializes the data.
Definition supermatrix.hh:212
virtual void setMatrix(const Matrix &mat)
Initialize data from given matrix.
Definition supermatrix.hh:293
SuperLUMatrix()
Definition supermatrix.hh:215
Matrix::size_type size_type
Definition supermatrix.hh:206
BCRSMatrix< B, TA > Matrix
The type of the matrix to convert.
Definition supermatrix.hh:202
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:281
virtual ~SuperLUMatrix()
Destructor.
Definition supermatrix.hh:219
Dune::SuperLUMatrix< Matrix > SuperLUMatrix
Definition supermatrix.hh:320
BCRSMatrix< B, A > Matrix
Definition supermatrix.hh:319
SuperMatrixInitializer()
Definition supermatrix.hh:326
virtual void createMatrix() const
Definition supermatrix.hh:329
SuperMatrixInitializer(SuperLUMatrix &lum)
Definition supermatrix.hh:322