Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_BlockedTpetraLinearObjContainer.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Panzer: A partial differential equation assembly
4 // engine for strongly coupled complex multiphysics systems
5 //
6 // Copyright 2011 NTESS and the Panzer contributors.
7 // SPDX-License-Identifier: BSD-3-Clause
8 // *****************************************************************************
9 // @HEADER
10 
11 #ifndef __Panzer_BlockedTpetraLinearObjContainer_hpp__
12 #define __Panzer_BlockedTpetraLinearObjContainer_hpp__
13 
14 #include "PanzerDiscFE_config.hpp"
15 
16 // Tpetra includes
17 #include "Tpetra_Vector.hpp"
18 #include "Tpetra_CrsMatrix.hpp"
19 
20 #include "Teuchos_RCP.hpp"
21 
24 #include "Panzer_NodeType.hpp"
25 
26 #include "Thyra_PhysicallyBlockedLinearOpBase.hpp"
27 #include "Thyra_ProductVectorBase.hpp"
28 #include "Thyra_TpetraThyraWrappers.hpp"
29 
30 #include <unordered_map>
31 
32 namespace panzer {
33 
37 template <typename ScalarT,typename LocalOrdinalT,typename GlobalOrdinalT,typename NodeT=panzer::TpetraNodeType>
38 class BlockedTpetraLinearObjContainer : public LinearObjContainer
39  , public ThyraObjContainer<ScalarT> {
40 public:
43 
44  typedef Tpetra::Map<LocalOrdinalT,GlobalOrdinalT,NodeT> MapType;
45 
47  bool checkCompatibility() const;
48 
49  virtual void clear();
50 
52  void initializeMatrix(ScalarT value);
53 
54  void setMapsForBlocks(const std::vector<Teuchos::RCP<const MapType> > & blockMaps)
55  { blockMaps_ = blockMaps; }
56 
58  { return blockMaps_[i]; }
59 
60  inline void set_x(const Teuchos::RCP<VectorType> & in) { set_x_th(in); }
61  inline Teuchos::RCP<VectorType> get_x() const { return get_x_th(); }
62 
63  inline void set_dxdt(const Teuchos::RCP<VectorType> & in) { set_dxdt_th(in); }
64  inline Teuchos::RCP<VectorType> get_dxdt() const { return get_dxdt_th(); }
65 
66  inline void set_f(const Teuchos::RCP<VectorType> & in) { set_f_th(in); }
67  inline Teuchos::RCP<VectorType> get_f() const { return get_f_th(); }
68 
69  inline void set_A(const Teuchos::RCP<CrsMatrixType> & in) { set_A_th(in); }
70  inline Teuchos::RCP<CrsMatrixType> get_A() const { return get_A_th(); }
71 
72  // Inherited from LinearObjContainer
73  virtual void initialize();
74 
75  // Inherited from ThyraObjContainer
76 
77  void set_x_th(const Teuchos::RCP<VectorType> & in) { x = in; }
78  Teuchos::RCP<VectorType> get_x_th() const { return x; }
79 
80  void set_dxdt_th(const Teuchos::RCP<VectorType> & in) { dxdt = in; }
82 
83  void set_f_th(const Teuchos::RCP<VectorType> & in) { f = in; }
84  Teuchos::RCP<VectorType> get_f_th() const { return f; }
85 
86  void set_A_th(const Teuchos::RCP<CrsMatrixType> & in) { A = in; }
88 
89  void beginFill();
90  void endFill();
91 
92 private:
95 
96  std::vector<Teuchos::RCP<const MapType> > blockMaps_;
97 };
98 
99 }
100 
102 
103 #endif
void set_x_th(const Teuchos::RCP< VectorType > &in)
bool checkCompatibility() const
Make sure row and column spaces match up.
std::vector< Teuchos::RCP< const MapType > > blockMaps_
void set_f_th(const Teuchos::RCP< VectorType > &in)
void set_dxdt(const Teuchos::RCP< VectorType > &in)
void initializeMatrix(ScalarT value)
Put a particular scalar in the matrix.
Tpetra::Map< LocalOrdinalT, GlobalOrdinalT, NodeT > MapType
void set_dxdt_th(const Teuchos::RCP< VectorType > &in)
Teuchos::RCP< const MapType > getMapForBlock(std::size_t i) const
void set_A_th(const Teuchos::RCP< CrsMatrixType > &in)
void setMapsForBlocks(const std::vector< Teuchos::RCP< const MapType > > &blockMaps)
void set_A(const Teuchos::RCP< CrsMatrixType > &in)