Panzer  Version of the Day
Panzer_PureBasis.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Panzer: A partial differential equation assembly
5 // engine for strongly coupled complex multiphysics systems
6 // Copyright (2011) Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Roger P. Pawlowski (rppawlo@sandia.gov) and
39 // Eric C. Cyr (eccyr@sandia.gov)
40 // ***********************************************************************
41 // @HEADER
42 
43 #ifndef PANZER_PureBasis_HPP
44 #define PANZER_PureBasis_HPP
45 
46 #include <string>
47 #include "Teuchos_RCP.hpp"
48 
49 #include "Phalanx_DataLayout.hpp"
50 
51 #include "Kokkos_DynRankView.hpp"
52 #include "Intrepid2_Basis.hpp"
54 
55 namespace panzer {
56 
57  class CellData;
58 
60  class PureBasis {
61 
62  public:
63  typedef enum { HGRAD=0, HCURL=1, HDIV=2, CONST=3 } EElementSpace;
64 
70  PureBasis(const std::string & basis_type,const int basis_order,const CellData & cell_data);
71 
78  PureBasis(const std::string & basis_type,const int basis_order,const int num_cells,const Teuchos::RCP<const shards::CellTopology> & cell_topo);
79 
81  int cardinality() const;
82 
84  int numCells() const;
85 
87  int dimension() const;
88 
90  std::string type() const;
91 
93  int order() const;
94 
96  std::string name() const;
97 
98  std::string fieldName() const;
99 
100  std::string fieldNameD1() const;
101 
102  std::string fieldNameD2() const;
103 
104  Teuchos::RCP< Intrepid2::Basis<double,Kokkos::DynRankView<double,PHX::Device> > >
105  getIntrepid2Basis() const;
106 
107  template <typename ScalarT,typename ArrayT>
108  Teuchos::RCP< Intrepid2::Basis<ScalarT,ArrayT> >
110  { return panzer::createIntrepid2Basis<ScalarT,ArrayT>(type(), order(), getCellTopology()); }
111 
113  { return element_space_; }
114 
115  bool requiresOrientations() const
116  { return getElementSpace()==HCURL || getElementSpace()==HDIV; }
117 
118  bool supportsGrad() const
119  { return getElementSpace()==HGRAD; }
120 
121  bool supportsCurl() const
122  { return getElementSpace()==HCURL; }
123 
124  bool supportsDiv() const
125  { return getElementSpace()==HDIV; }
126 
127  bool isVectorBasis() const
128  { return getElementSpace()==HCURL || getElementSpace()==HDIV; }
129 
130  bool isScalarBasis() const
131  { return getElementSpace()==HGRAD || getElementSpace()==CONST; }
132 
133  int getBasisRank() const
134  { return basis_rank_; }
135 
136  bool supportsBasisCoordinates() const;
137 
138  Teuchos::RCP<const shards::CellTopology> getCellTopology() const
139  { return topology_; }
140 
141  public:
143  Teuchos::RCP<PHX::DataLayout> cell_data;
145  Teuchos::RCP<PHX::DataLayout> functional;
147  Teuchos::RCP<PHX::DataLayout> functional_grad;
149  Teuchos::RCP<PHX::DataLayout> functional_D2;
151  Teuchos::RCP<PHX::DataLayout> coordinates;
152 
153  private:
154 
156  void initialize(const std::string & basis_type,const int basis_order);
157 
158  private:
159 
160  Teuchos::RCP<const shards::CellTopology> topology_;
161  Teuchos::RCP< Intrepid2::Basis<double,Kokkos::DynRankView<double,PHX::Device> > > intrepid_basis_;
162 
163  std::string basis_type_;
164  std::string basis_name_;
165  std::string field_basis_name_;
166  std::string field_basis_name_D1_;
167  std::string field_basis_name_D2_;
168 
170 
173  };
174 
175  typedef std::pair<std::string,Teuchos::RCP<panzer::PureBasis> > StrPureBasisPair;
176 
179  bool operator() (const StrPureBasisPair & lhs, const StrPureBasisPair & rhs) const
180  {return lhs.first<rhs.first;}
181  };
182 
183 }
184 
185 #endif
bool supportsBasisCoordinates() const
Simple binary comparison class to help with sorting.
std::string name() const
A unique key that is the combination of the basis type and basis order.
std::string fieldNameD1() const
Teuchos::RCP< Intrepid2::Basis< ScalarT, ArrayT > > getIntrepid2Basis() const
bool supportsDiv() const
std::string field_basis_name_D1_
Teuchos::RCP< PHX::DataLayout > cell_data
<Cell>
bool supportsGrad() const
bool isVectorBasis() const
bool requiresOrientations() const
std::string field_basis_name_
Data for determining cell topology and dimensionality.
Teuchos::RCP< PHX::DataLayout > coordinates
<Cell,Basis,Dim>
PureBasis(const std::string &basis_type, const int basis_order, const CellData &cell_data)
EElementSpace getElementSpace() const
Teuchos::RCP< PHX::DataLayout > functional_grad
<Cell,Basis,Dim>
Teuchos::RCP< PHX::DataLayout > functional_D2
<Cell,Basis,Dim>
std::string fieldNameD2() const
int dimension() const
Returns the dimension of the basis from the topology.
std::string fieldName() const
Teuchos::RCP< Intrepid2::Basis< double, Kokkos::DynRankView< double, PHX::Device > > > getIntrepid2Basis() const
bool isScalarBasis() const
int numCells() const
Returns the number of cells in the data layouts.
std::string type() const
Returns the basis type.
int order() const
Returns the polynomial order of the basis.
Teuchos::RCP< const shards::CellTopology > getCellTopology() const
std::pair< std::string, Teuchos::RCP< panzer::PureBasis > > StrPureBasisPair
EElementSpace element_space_
void initialize(const std::string &basis_type, const int basis_order)
Initialize the basis object.
Description and data layouts associated with a particular basis.
Teuchos::RCP< PHX::DataLayout > functional
<Cell,Basis> or <Cell,Basis>
Teuchos::RCP< Intrepid2::Basis< double, Kokkos::DynRankView< double, PHX::Device > > > intrepid_basis_
int cardinality() const
Returns the number of basis coefficients.
Teuchos::RCP< const shards::CellTopology > topology_
std::string field_basis_name_D2_
bool operator()(const StrPureBasisPair &lhs, const StrPureBasisPair &rhs) const
bool supportsCurl() const