Panzer  Version of the Day
Panzer_L2Projection.hpp
Go to the documentation of this file.
1 // @HEADER
2 // @HEADER
3 
4 #ifndef PANZER_L2_PROJECTION_HPP
5 #define PANZER_L2_PROJECTION_HPP
6 
7 #include "Teuchos_RCP.hpp"
8 #include "Phalanx_KokkosDeviceTypes.hpp"
9 #include "PanzerCore_config.hpp"
12 #include "Tpetra_Map.hpp" // for KokkosDeviceWrapperNode
13 #include "Tpetra_CrsMatrix_fwd.hpp"
14 #include "Tpetra_MultiVector_fwd.hpp"
15 #include <vector>
16 #include <string>
17 #include <unordered_map>
18 
19 namespace Teuchos {
20  template<typename T> class MpiComm;
21 }
22 
23 namespace panzer {
24 
25  class BasisDescriptor;
26  class IntegrationDescriptor;
27  class ConnManager;
28  class DOFManager;
29  class GlobalIndexer;
30  class WorksetContainer;
31 
35  class L2Projection {
36 
39  Teuchos::RCP<const Teuchos::MpiComm<int>> comm_;
40  Teuchos::RCP<const panzer::ConnManager> connManager_;
41  std::vector<std::string> elementBlockNames_;
42  mutable Teuchos::RCP<panzer::WorksetContainer> worksetContainer_;
44  Teuchos::RCP<panzer::DOFManager> targetGlobalIndexer_;
45 
46  public:
47 
49  L2Projection() : setupCalled_(false) {}
50 
60  void setup(const panzer::BasisDescriptor& targetBasis,
61  const panzer::IntegrationDescriptor& integrationDescriptor,
62  const Teuchos::RCP<const Teuchos::MpiComm<int>>& comm,
63  const Teuchos::RCP<const panzer::ConnManager>& connManager,
64  const std::vector<std::string>& elementBlockNames,
65  const Teuchos::RCP<panzer::WorksetContainer> worksetContainer = Teuchos::null);
66 
68  Teuchos::RCP<panzer::GlobalIndexer> getTargetGlobalIndexer() const;
69 
77  Teuchos::RCP<Tpetra::CrsMatrix<double,panzer::LocalOrdinal,panzer::GlobalOrdinal,Kokkos::Compat::KokkosDeviceWrapperNode<PHX::Device>>>
78  buildMassMatrix(bool use_lumping=false,
79  const std::unordered_map<std::string,double>* elementBlockMultipliers = nullptr);
80 
103  Teuchos::RCP<Tpetra::MultiVector<double,panzer::LocalOrdinal,panzer::GlobalOrdinal,Kokkos::Compat::KokkosDeviceWrapperNode<PHX::Device>>>
105 
123  Teuchos::RCP<Tpetra::CrsMatrix<double,panzer::LocalOrdinal,panzer::GlobalOrdinal,Kokkos::Compat::KokkosDeviceWrapperNode<PHX::Device>>>
124  buildRHSMatrix(const panzer::GlobalIndexer& sourceDOFManager,
125  const Teuchos::RCP<const Tpetra::Map<panzer::LocalOrdinal,panzer::GlobalOrdinal,Kokkos::Compat::KokkosDeviceWrapperNode<PHX::Device>>>& ownedSourceMap,
126  const std::string& sourceFieldName,
127  const panzer::BasisDescriptor& sourceBasisDescriptor,
128  const int vectorOrGradientDirectionIndex = -1);
129  };
130 
131 }
132 
133 #endif
Unified set of tools for building objects for lumped and consistent L2 projects between bases.
panzer::IntegrationDescriptor integrationDescriptor_
panzer::BasisDescriptor targetBasisDescriptor_
Teuchos::RCP< Tpetra::CrsMatrix< double, panzer::LocalOrdinal, panzer::GlobalOrdinal, Kokkos::Compat::KokkosDeviceWrapperNode< PHX::Device > > > buildMassMatrix(bool use_lumping=false, const std::unordered_map< std::string, double > *elementBlockMultipliers=nullptr)
Allocates, fills and returns a mass matrix for L2 projection onto a target basis.
Teuchos::RCP< panzer::GlobalIndexer > getTargetGlobalIndexer() const
Returns the target global indexer. Will be null if setup() has not been called.
void setup(const panzer::BasisDescriptor &targetBasis, const panzer::IntegrationDescriptor &integrationDescriptor, const Teuchos::RCP< const Teuchos::MpiComm< int >> &comm, const Teuchos::RCP< const panzer::ConnManager > &connManager, const std::vector< std::string > &elementBlockNames, const Teuchos::RCP< panzer::WorksetContainer > worksetContainer=Teuchos::null)
Setup base objects for L2 Projections - requires target scalar basis and creates worksets if not supp...
Teuchos::RCP< const Teuchos::MpiComm< int > > comm_
std::vector< std::string > elementBlockNames_
Teuchos::RCP< Tpetra::MultiVector< double, panzer::LocalOrdinal, panzer::GlobalOrdinal, Kokkos::Compat::KokkosDeviceWrapperNode< PHX::Device > > > buildInverseLumpedMassMatrix()
Allocates, fills and returns a Tpetra::MultiVector containing the inverse lumped mass matrix values a...
Teuchos::RCP< Tpetra::CrsMatrix< double, panzer::LocalOrdinal, panzer::GlobalOrdinal, Kokkos::Compat::KokkosDeviceWrapperNode< PHX::Device > > > buildRHSMatrix(const panzer::GlobalIndexer &sourceDOFManager, const Teuchos::RCP< const Tpetra::Map< panzer::LocalOrdinal, panzer::GlobalOrdinal, Kokkos::Compat::KokkosDeviceWrapperNode< PHX::Device >>> &ownedSourceMap, const std::string &sourceFieldName, const panzer::BasisDescriptor &sourceBasisDescriptor, const int vectorOrGradientDirectionIndex=-1)
Allocates, fills and returns a rectangular matrix for L2 projection of a scalar field,...
Teuchos::RCP< const panzer::ConnManager > connManager_
Teuchos::RCP< panzer::DOFManager > targetGlobalIndexer_
Teuchos::RCP< panzer::WorksetContainer > worksetContainer_