Finite Element Domain Decomposition Library
FEDDLib
Loading...
Searching...
No Matches
BlockMatrix_decl.hpp
1#ifndef BLOCKMATRIX_DECL_hpp
2#define BLOCKMATRIX_DECL_hpp
3
4#include <Teuchos_Tuple.hpp>
5#include <Thyra_BlockedLinearOpBase.hpp>
6#include <Thyra_DefaultBlockedLinearOp_decl.hpp>
7
8#include "feddlib/core/General/DefaultTypeDefs.hpp"
9#include "feddlib/core/General/SmallMatrix.hpp"
10#include "BlockMap.hpp"
11#include "BlockMultiVector.hpp"
12#include "Matrix.hpp"
13
22
23namespace FEDD {
24template <class SC = default_sc, class LO = default_lo, class GO = default_go, class NO = default_no>
25class BlockMatrix {
26
27public:
28
29 typedef Matrix<SC,LO,GO,NO> Matrix_Type;
30 typedef Teuchos::RCP<Matrix_Type> MatrixPtr_Type;
31 typedef Teuchos::RCP<const Matrix_Type> MatrixConstPtr_Type;
32
33 typedef typename Matrix_Type::Map_Type Map_Type;
34 typedef typename Matrix_Type::MapPtr_Type MapPtr_Type;
35 typedef typename Matrix_Type::MapConstPtr_Type MapConstPtr_Type;
36
37 typedef typename Matrix_Type::MultiVector_Type MultiVector_Type;
38 typedef typename Matrix_Type::MultiVectorPtr_Type MultiVectorPtr_Type;
39 typedef typename Matrix_Type::MultiVectorConstPtr_Type MultiVectorConstPtr_Type;
40
41 typedef BlockMultiVector<SC,LO,GO,NO> BlockMultiVector_Type;
42 typedef Teuchos::RCP<BlockMultiVector_Type> BlockMultiVectorPtr_Type;
43
44 typedef BlockMatrix<SC,LO,GO,NO> BlockMatrix_Type;
45 typedef Teuchos::RCP<BlockMatrix_Type> BlockMatrixPtr_Type;
46
47 typedef BlockMap<LO,GO,NO> BlockMap_Type;
48 typedef Teuchos::RCP<BlockMap_Type> BlockMapPtr_Type;
49
50 typedef Teuchos::Tuple<GO, 2> GOTuple_Type;
51 typedef Teuchos::Tuple<LO, 2> LOTuple_Type;
52
53 BlockMatrix();
54
55 BlockMatrix(UN size);
56
57 // TODO
58 BlockMatrix(BlockMatrixPtr_Type bMatrixIn);
59
60 ~BlockMatrix();
61
62 int size() const;
63
64 void resize(UN size);
65
66 MatrixPtr_Type getBlock(int i, int j);
67
68 MatrixConstPtr_Type getBlockConst(int i, int j) const;
69
70 bool blockExists(int i, int j) const;
71
72 void addBlock(const MatrixPtr_Type& matrix, int i, int j);
73
74 void merge();
75
76 void mergeBlockNew(UN blockRow, UN blockCol);
77
78 void determineLocalOffsets();
79
80 void determineGlobalOffsets();
81
82 void print(Teuchos::EVerbosityLevel verbLevel=Teuchos::VERB_EXTREME);
83
84 void printMerge(Teuchos::EVerbosityLevel verbLevel=Teuchos::VERB_EXTREME);
85
86 void writeMM(std::string fN="blockMat") const;
87
88 Teuchos::RCP<const Thyra::LinearOpBase<SC> > getThyraLinOp();
89
90 Teuchos::RCP<const Thyra::BlockedLinearOpBase<SC> > getThyraLinBlockOp() const;
91
92 void apply(const BlockMultiVector_Type& X,
93 BlockMultiVector_Type& Y ) const;
94
95 void apply(const BlockMultiVector_Type& X,
96 BlockMultiVector_Type& Y,
97 const SmallMatrix<SC>& coeff) const;
98
99 void addMatrix( const SmallMatrix<SC>& coeffAlpha, const BlockMatrixPtr_Type& matrix, const SmallMatrix<SC>& coeffbeta );
100
101 MatrixPtr_Type getMergedMatrix();
102
103 BlockMapPtr_Type getMap();
104protected:
105
106 SmallMatrix<MatrixPtr_Type> blockMatrix_;
107 BlockMapPtr_Type blockMap_;
108 MatrixPtr_Type mergedMatrix_;
109 MapPtr_Type mergedMap_;
110 Teuchos::RCP<SmallMatrix<GOTuple_Type> > globalBlockOffsets_;
111 Teuchos::RCP<SmallMatrix<LOTuple_Type> > localBlockOffsets_;
112};
113
114}
115#endif
Block Variant of Map class.
Definition BlockMap_decl.hpp:38
Definition BlockMultiVector_decl.hpp:25
Definition Matrix_decl.hpp:30
This class represents a templated small Matrix of type T. Primarily created for 2x2 and 3x3 matrices....
Definition SmallMatrix.hpp:20
Adaptive Mesh Refinement.
Definition AdaptiveMeshRefinement_decl.hpp:36