Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_Interpolation.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_Interpolation_hpp__
12 #define __Panzer_Interpolation_hpp__
13 
15 #ifdef PANZER_HAVE_EPETRA_STACK
17 #endif
18 
19 #ifdef PANZER_HAVE_EPETRA_STACK
20 #include "Thyra_EpetraThyraWrappers.hpp"
21 #endif
22 
23 #include <Tpetra_Operator.hpp>
24 #include <Tpetra_Import.hpp>
25 
26 
27 namespace panzer {
28 
30  const std::string &domain_basis_name, const std::string &range_basis_name,
31  Intrepid2::EOperator op = Intrepid2::OPERATOR_VALUE,
32  size_t worksetSize = 1000,
33  const bool matrixFree = false);
34 
35 
37  const Teuchos::RCP<panzer::DOFManager> &domain_ugi,
38  const Teuchos::RCP<panzer::DOFManager> &range_ugi,
39  const std::string &domain_basis_name, const std::string &range_basis_name,
40  Intrepid2::EOperator op = Intrepid2::OPERATOR_VALUE,
41  size_t worksetSize = 1000, const bool forceVectorial = false,
42  const bool useTpetra = true,
43  const bool matrixFree = false);
44 
45 
46  template <class Scalar = Tpetra::Operator<>::scalar_type,
47  class LocalOrdinal = typename Tpetra::Operator<Scalar>::local_ordinal_type,
48  class GlobalOrdinal = typename Tpetra::Operator<Scalar, LocalOrdinal>::global_ordinal_type,
49  class Node = typename Tpetra::Operator<Scalar, LocalOrdinal, GlobalOrdinal>::node_type>
50  class MatrixFreeInterpolationOp : public Tpetra::Operator<Scalar,LocalOrdinal,GlobalOrdinal,Node> {
51 
52  public:
53 
54  typedef PHX::Device DeviceSpace;
55 
57  const Teuchos::RCP<panzer::DOFManager> &_domain_ugi,
58  const Teuchos::RCP<panzer::DOFManager> &_range_ugi,
59  const std::string& _domain_basis_name,
60  const std::string& _range_basis_name,
61  Intrepid2::EOperator _op=Intrepid2::OPERATOR_VALUE,
62  size_t _worksetSize=1000);
63 
64  void allocateColumnMapVector(size_t numVectors);
65 
66  // Pre-compute elements that own a DoF
68 
71  getDomainMap() const {
72  return domainMap_;
73  }
74 
77  getRangeMap() const {
78  return rangeMap_;
79  }
80 
81  void
82  apply (const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &X,
83  Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &Y,
85  Scalar alpha = Teuchos::ScalarTraits<Scalar>::one(),
86  Scalar beta = Teuchos::ScalarTraits<Scalar>::zero()) const;
87 
88  void
89  applyNonTransposed (const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &X,
90  Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &Y,
91  Scalar alpha = Teuchos::ScalarTraits<Scalar>::one(),
92  Scalar beta = Teuchos::ScalarTraits<Scalar>::zero()) const;
93 
94  void
95  applyTransposed (const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &X,
96  Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &Y,
97  Scalar alpha = Teuchos::ScalarTraits<Scalar>::one(),
98  Scalar beta = Teuchos::ScalarTraits<Scalar>::zero()) const;
99 
100  bool
102  return true;
103  };
104 
105  void setName(std::string &_name) {
106  name = _name;
107  };
108 
109  private:
110 
111  std::string name;
112 
118 
119  std::string domain_basis_name;
120  std::string range_basis_name;
121  Intrepid2::EOperator op;
122  size_t worksetSize;
123 
126 
128  std::map<std::string, Kokkos::DynRankView<Intrepid2::Orientation,DeviceSpace> > orientations_;
129  };
130 }
131 #endif
Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Tpetra::Map object associated with the range of this operator.
Teuchos::RCP< panzer::DOFManager > range_ugi
MatrixFreeInterpolationOp(const Teuchos::RCP< const panzer::ConnManager > &conn, const Teuchos::RCP< panzer::DOFManager > &_domain_ugi, const Teuchos::RCP< panzer::DOFManager > &_range_ugi, const std::string &_domain_basis_name, const std::string &_range_basis_name, Intrepid2::EOperator _op=Intrepid2::OPERATOR_VALUE, size_t _worksetSize=1000)
Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Tpetra::Map object associated with the domain of this operator.
void applyNonTransposed(const Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Scalar alpha=Teuchos::ScalarTraits< Scalar >::one(), Scalar beta=Teuchos::ScalarTraits< Scalar >::zero()) const
Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > domainMap_
Teuchos::RCP< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > colmapMV_
void applyTransposed(const Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Scalar alpha=Teuchos::ScalarTraits< Scalar >::one(), Scalar beta=Teuchos::ScalarTraits< Scalar >::zero()) const
Teuchos::RCP< Thyra::LinearOpBase< double > > buildInterpolation(const Teuchos::RCP< const panzer::LinearObjFactory< panzer::Traits >> &linObjFactory, const std::string &domain_basis_name, const std::string &range_basis_name, Intrepid2::EOperator op, size_t worksetSize, const bool matrixFree)
Kokkos::View< LocalOrdinal *, DeviceSpace > owner_d_
void precomputeOwnersAndOrientations(const Teuchos::RCP< const panzer::ConnManager > &conn)
Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > rangeMap_
void apply(const Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=Teuchos::ScalarTraits< Scalar >::one(), Scalar beta=Teuchos::ScalarTraits< Scalar >::zero()) const
Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > columnMap_
Teuchos::RCP< const Tpetra::Import< LocalOrdinal, GlobalOrdinal, Node > > import_
void allocateColumnMapVector(size_t numVectors)
std::map< std::string, Kokkos::DynRankView< Intrepid2::Orientation, DeviceSpace > > orientations_
Teuchos::RCP< panzer::DOFManager > domain_ugi