Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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"
11 #include "Tpetra_Map.hpp" // for KokkosDeviceWrapperNode
12 #include "Tpetra_CrsMatrix_fwd.hpp"
13 #include "Tpetra_MultiVector_fwd.hpp"
14 #include <vector>
15 #include <string>
16 #include <unordered_map>
17 
18 namespace Teuchos {
19  template<typename T> class MpiComm;
20 }
21 
22 namespace panzer {
23 
24  class BasisDescriptor;
25  class IntegrationDescriptor;
26  template<typename LO,typename GO> class ConnManager;
27  template<typename LO,typename GO> class DOFManager;
28  template<typename LO,typename GO> class UniqueGlobalIndexer;
29  class WorksetContainer;
30 
34  template<typename LO, typename GO>
35  class L2Projection {
36 
41  std::vector<std::string> elementBlockNames_;
44 
46 
47  public:
48 
50  L2Projection() : setupCalled_(false) {}
51 
61  void setup(const panzer::BasisDescriptor& targetBasis,
62  const panzer::IntegrationDescriptor& integrationDescriptor,
63  const Teuchos::RCP<const Teuchos::MpiComm<int>>& comm,
64  const Teuchos::RCP<const panzer::ConnManager<LO,GO>>& connManager,
65  const std::vector<std::string>& elementBlockNames,
66  const Teuchos::RCP<panzer::WorksetContainer> worksetContainer = Teuchos::null);
67 
70 
79  buildMassMatrix(bool use_lumping=false,
80  const std::unordered_map<std::string,double>* elementBlockMultipliers = nullptr);
81 
106 
125  buildRHSMatrix(const panzer::UniqueGlobalIndexer<LO,GO>& sourceDOFManager,
126  const Teuchos::RCP<const Tpetra::Map<LO,GO,Kokkos::Compat::KokkosDeviceWrapperNode<PHX::Device>>>& ownedSourceMap,
127  const std::string& sourceFieldName,
128  const panzer::BasisDescriptor& sourceBasisDescriptor,
129  const int vectorOrGradientDirectionIndex = -1);
130  };
131 
132 }
133 
134 #endif
std::vector< std::string > elementBlockNames_
Teuchos::RCP< Tpetra::MultiVector< double, LO, GO, Kokkos::Compat::KokkosDeviceWrapperNode< PHX::Device > > > buildInverseLumpedMassMatrix()
Allocates, fills and returns a Tpetra::MultiVector containing the inverse lumped mass matrix values a...
Teuchos::RCP< const panzer::ConnManager< LO, GO > > connManager_
Class that provides access to worksets on each element block and side set.
Teuchos::RCP< panzer::UniqueGlobalIndexer< LO, GO > > getTargetGlobalIndexer() const
Returns the target global indexer. Will be null if setup() has not been called.
Teuchos::RCP< panzer::WorksetContainer > worksetContainer_
Teuchos::RCP< const Teuchos::MpiComm< int > > comm_
panzer::BasisDescriptor targetBasisDescriptor_
Teuchos::RCP< Tpetra::CrsMatrix< double, LO, GO, Kokkos::Compat::KokkosDeviceWrapperNode< PHX::Device > > > buildRHSMatrix(const panzer::UniqueGlobalIndexer< LO, GO > &sourceDOFManager, const Teuchos::RCP< const Tpetra::Map< LO, GO, 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, one dimension of gradient (for hgrad basis), or one dimension of a vector field onto the target scalar basis. If you wish to project all values of a vector field or all the gradients of a scalar field, then you will need three separate RHS matrices to form the RHS for each independently. The vectors must be independent Tpetra vectors to solve multiple right hand sides with the linear solver.
void setup(const panzer::BasisDescriptor &targetBasis, const panzer::IntegrationDescriptor &integrationDescriptor, const Teuchos::RCP< const Teuchos::MpiComm< int >> &comm, const Teuchos::RCP< const panzer::ConnManager< LO, GO >> &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< panzer::DOFManager< LO, GO > > targetGlobalIndexer_
Teuchos::RCP< Tpetra::CrsMatrix< double, LO, GO, 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. ...
Unified set of tools for building objects for lumped and consistent L2 projects between bases...
panzer::IntegrationDescriptor integrationDescriptor_