waves
Basic FE playground
Matrices.h
Go to the documentation of this file.
1 #ifndef KATOPTRON_MATRICES_H
2 #define KATOPTRON_MATRICES_H
3 
4 #include "katoptron.h"
5 
6 #include "Map.h"
7 #include "Graph.h"
8 
9 #include <Tpetra_Map.hpp>
10 #include <Tpetra_Vector.hpp>
11 #include <Tpetra_CrsGraph.hpp>
12 #include <Tpetra_CrsMatrix.hpp>
13 #include <Teuchos_RCP.hpp>
14 
15 #include <Xpetra_BlockedMap.hpp>
16 #include <Xpetra_BlockedCrsMatrix.hpp>
17 #include <Stokhos_MueLu_MP_Vector.hpp>
18 
19 namespace katoptron
20 {
21 
31 template <typename scalar>
32 class Matrices
33 {
34  /*
35  2x2 block matrix:
36  ----------------
37 
38  *-----*-----*
39  | A | B_1 |
40  *-----*-----*
41  | B_2 | C |
42  *-----*-----*
43 
44  B includes the values of B_2 if the contact is fully closed.
45  B_T includes the values of B_1 if the contact is fully closed.
46  B_G includes the values of B with the M matrix included regardless if we have a Signorini problem or not.
47  */
48 public:
49  //
50  // Convenience typedefs
51  //
57  typedef Tpetra::CrsGraph<local_ordinal_type, global_ordinal_type, node_type> tpetra_graph_type;
58  typedef Tpetra::CrsMatrix<scalar, local_ordinal_type, global_ordinal_type, node_type> tpetra_crs_type;
59 
60  typedef Xpetra::Matrix<scalar, local_ordinal_type, global_ordinal_type, node_type> xpetra_mat_type;
61  typedef Xpetra::CrsMatrix<scalar, local_ordinal_type, global_ordinal_type, node_type> xpetra_crs_type;
62  typedef Xpetra::CrsMatrixWrap<scalar, local_ordinal_type, global_ordinal_type, node_type> xpetra_wcrs_type;
63  typedef Xpetra::BlockedCrsMatrix<scalar, local_ordinal_type, global_ordinal_type, node_type> xpetra_bcrs_type;
64  typedef Xpetra::TpetraCrsMatrix<scalar, local_ordinal_type, global_ordinal_type, node_type> xpetra_tcrs_type;
65 
66  Teuchos::RCP<tpetra_crs_type> K;
67  Teuchos::RCP<tpetra_crs_type> S;
68  Teuchos::RCP<tpetra_crs_type> L;
69  Teuchos::RCP<tpetra_crs_type> B;
70  Teuchos::RCP<tpetra_crs_type> B_T;
71  Teuchos::RCP<tpetra_crs_type> B_1;
72  Teuchos::RCP<tpetra_crs_type> B_2;
73  Teuchos::RCP<tpetra_crs_type> B_G;
74  Teuchos::RCP<tpetra_crs_type> C;
75  Teuchos::RCP<tpetra_crs_type> Cb;
76 
77  Teuchos::RCP<xpetra_crs_type> xA;
78  Teuchos::RCP<xpetra_crs_type> xB;
79  Teuchos::RCP<xpetra_crs_type> xB_T;
80  Teuchos::RCP<xpetra_crs_type> xC;
81 
82  Teuchos::RCP<xpetra_wcrs_type> xwA;
83  Teuchos::RCP<xpetra_wcrs_type> xwB;
84  Teuchos::RCP<xpetra_wcrs_type> xwB_T;
85  Teuchos::RCP<xpetra_wcrs_type> xwC;
86 
87  Teuchos::RCP<xpetra_bcrs_type> blockedMatrix;
88 
89  Teuchos::RCP<xpetra_mat_type> A;
90 
91  Matrices(Teuchos::RCP<Graph> graph);
92 };
93 
105 template <typename scalar>
106 Matrices<scalar>::Matrices(Teuchos::RCP<Graph> graph)
107 {
108  if (graph->K != Teuchos::null)
109  {
110  K = Teuchos::rcp(new tpetra_crs_type(graph->K));
111  K->fillComplete();
112  }
113  if (graph->S != Teuchos::null)
114  {
115  S = Teuchos::rcp(new tpetra_crs_type(graph->S));
116  S->fillComplete(graph->S->getDomainMap(), graph->S->getRangeMap());
117  }
118  if (graph->L != Teuchos::null)
119  {
120  L = Teuchos::rcp(new tpetra_crs_type(graph->L));
121  L->fillComplete();
122  }
123 }
124 }; // namespace katoptron
125 
126 #endif //KATOPTRON_MATRICES_H
katoptron::Matrices::xB
Teuchos::RCP< xpetra_crs_type > xB
Definition: Matrices.h:78
katoptron::Map::local_ordinal_type
int local_ordinal_type
Definition: Map.h:27
Graph.h
katoptron::Matrices::B_T
Teuchos::RCP< tpetra_crs_type > B_T
Definition: Matrices.h:70
katoptron::Matrices::xpetra_wcrs_type
Xpetra::CrsMatrixWrap< scalar, local_ordinal_type, global_ordinal_type, node_type > xpetra_wcrs_type
Definition: Matrices.h:62
katoptron::Matrices::xpetra_tcrs_type
Xpetra::TpetraCrsMatrix< scalar, local_ordinal_type, global_ordinal_type, node_type > xpetra_tcrs_type
Definition: Matrices.h:64
katoptron::Matrices::xwA
Teuchos::RCP< xpetra_wcrs_type > xwA
Definition: Matrices.h:82
katoptron::Matrices::tpetra_map_type
Map::tpetra_map_type tpetra_map_type
Definition: Matrices.h:55
katoptron::Matrices::xpetra_bmap_type
Map::xpetra_bmap_type xpetra_bmap_type
Definition: Matrices.h:56
katoptron::Map::global_ordinal_type
int global_ordinal_type
Definition: Map.h:28
katoptron::Matrices::Cb
Teuchos::RCP< tpetra_crs_type > Cb
Definition: Matrices.h:75
katoptron::Matrices::xC
Teuchos::RCP< xpetra_crs_type > xC
Definition: Matrices.h:80
katoptron::Matrices::tpetra_graph_type
Tpetra::CrsGraph< local_ordinal_type, global_ordinal_type, node_type > tpetra_graph_type
Definition: Matrices.h:57
katoptron::Matrices
Class which includes all the Trilinos matrices (Tpetra matrices and Xpetra matrices) used in the simu...
Definition: Matrices.h:32
katoptron::Matrices::B_2
Teuchos::RCP< tpetra_crs_type > B_2
Definition: Matrices.h:72
katoptron::Matrices::global_ordinal_type
Map::global_ordinal_type global_ordinal_type
Definition: Matrices.h:53
katoptron::Matrices::S
Teuchos::RCP< tpetra_crs_type > S
Definition: Matrices.h:67
katoptron::Matrices::K
Teuchos::RCP< tpetra_crs_type > K
Definition: Matrices.h:66
katoptron::Matrices::xpetra_crs_type
Xpetra::CrsMatrix< scalar, local_ordinal_type, global_ordinal_type, node_type > xpetra_crs_type
Definition: Matrices.h:61
katoptron::Matrices::xA
Teuchos::RCP< xpetra_crs_type > xA
Definition: Matrices.h:77
katoptron::Matrices::blockedMatrix
Teuchos::RCP< xpetra_bcrs_type > blockedMatrix
Definition: Matrices.h:87
katoptron::Matrices::node_type
Map::node_type node_type
Definition: Matrices.h:54
katoptron::Matrices::C
Teuchos::RCP< tpetra_crs_type > C
Definition: Matrices.h:74
katoptron::Matrices::local_ordinal_type
Map::local_ordinal_type local_ordinal_type
Definition: Matrices.h:52
katoptron
katoptron namespace
Definition: Algebraic.h:18
katoptron::Matrices::A
Teuchos::RCP< xpetra_mat_type > A
Definition: Matrices.h:89
katoptron::Matrices::tpetra_crs_type
Tpetra::CrsMatrix< scalar, local_ordinal_type, global_ordinal_type, node_type > tpetra_crs_type
Definition: Matrices.h:58
katoptron::Matrices::xpetra_mat_type
Xpetra::Matrix< scalar, local_ordinal_type, global_ordinal_type, node_type > xpetra_mat_type
Definition: Matrices.h:60
katoptron::Map::xpetra_bmap_type
Xpetra::BlockedMap< local_ordinal_type, global_ordinal_type, node_type > xpetra_bmap_type
Definition: Map.h:33
katoptron::Map::tpetra_map_type
Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type > tpetra_map_type
Definition: Map.h:30
katoptron::Map::node_type
KokkosClassic::DefaultNode::DefaultNodeType node_type
Definition: Map.h:29
katoptron.h
katoptron::Matrices::xwC
Teuchos::RCP< xpetra_wcrs_type > xwC
Definition: Matrices.h:85
katoptron::Matrices::B_1
Teuchos::RCP< tpetra_crs_type > B_1
Definition: Matrices.h:71
katoptron::Matrices::B
Teuchos::RCP< tpetra_crs_type > B
Definition: Matrices.h:69
katoptron::Matrices::xpetra_bcrs_type
Xpetra::BlockedCrsMatrix< scalar, local_ordinal_type, global_ordinal_type, node_type > xpetra_bcrs_type
Definition: Matrices.h:63
katoptron::Matrices::xwB_T
Teuchos::RCP< xpetra_wcrs_type > xwB_T
Definition: Matrices.h:84
Map.h
katoptron::Matrices::xB_T
Teuchos::RCP< xpetra_crs_type > xB_T
Definition: Matrices.h:79
katoptron::Matrices::xwB
Teuchos::RCP< xpetra_wcrs_type > xwB
Definition: Matrices.h:83
katoptron::Matrices::L
Teuchos::RCP< tpetra_crs_type > L
Definition: Matrices.h:68
katoptron::Matrices::B_G
Teuchos::RCP< tpetra_crs_type > B_G
Definition: Matrices.h:73
katoptron::Matrices::Matrices
Matrices(Teuchos::RCP< Graph > graph)
Matrices constructor.
Definition: Matrices.h:106