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  class BasisDescriptor;
59 
61  class PureBasis {
62 
63  public:
64  typedef enum { HGRAD=0, HCURL=1, HDIV=2, CONST=3 } EElementSpace;
65 
71  PureBasis(const std::string & basis_type,const int basis_order,const CellData & cell_data);
72 
79  PureBasis(const std::string & basis_type,const int basis_order,const int num_cells,const Teuchos::RCP<const shards::CellTopology> & cell_topo);
80 
81 
87  PureBasis(const panzer::BasisDescriptor & description, const Teuchos::RCP<const shards::CellTopology> & cell_topology, const int num_cells);
88 
90  int cardinality() const;
91 
93  int numCells() const;
94 
96  int dimension() const;
97 
99  std::string type() const;
100 
102  int order() const;
103 
105  std::string name() const;
106 
107  std::string fieldName() const;
108 
109  std::string fieldNameD1() const;
110 
111  std::string fieldNameD2() const;
112 
113  Teuchos::RCP< Intrepid2::Basis<PHX::Device::execution_space,double,double> >
114  getIntrepid2Basis() const;
115 
116  template <typename ExecutionSpace,typename OutputValueType, typename PointValueType>
117  Teuchos::RCP< Intrepid2::Basis<ExecutionSpace,OutputValueType,PointValueType> >
119  { return panzer::createIntrepid2Basis<ExecutionSpace,OutputValueType,PointValueType>(type(), order(), *(getCellTopology())); }
120 
122  { return element_space_; }
123 
124  bool requiresOrientations() const
125  {
126  return intrepid_basis_->requireOrientation();
127  }
128 
129  bool supportsGrad() const
130  { return getElementSpace()==HGRAD; }
131 
132  bool supportsCurl() const
133  { return getElementSpace()==HCURL; }
134 
135  bool supportsDiv() const
136  { return getElementSpace()==HDIV; }
137 
138  bool isVectorBasis() const
139  { return getElementSpace()==HCURL || getElementSpace()==HDIV; }
140 
141  bool isScalarBasis() const
142  { return getElementSpace()==HGRAD || getElementSpace()==CONST; }
143 
144  int getBasisRank() const
145  { return basis_rank_; }
146 
147  bool supportsBasisCoordinates() const;
148 
149  Teuchos::RCP<const shards::CellTopology> getCellTopology() const
150  { return topology_; }
151 
152  public:
154  Teuchos::RCP<PHX::DataLayout> cell_data;
156  Teuchos::RCP<PHX::DataLayout> functional;
158  Teuchos::RCP<PHX::DataLayout> functional_grad;
160  Teuchos::RCP<PHX::DataLayout> functional_D2;
162  Teuchos::RCP<PHX::DataLayout> coordinates;
164  Teuchos::RCP<PHX::DataLayout> local_mat_layout;
165 
166  private:
167 
169  void initialize(const std::string & basis_type,const int basis_order);
170 
171  private:
172 
173  Teuchos::RCP<const shards::CellTopology> topology_;
174  Teuchos::RCP< Intrepid2::Basis<PHX::Device::execution_space,double,double> > intrepid_basis_;
175 
176  std::string basis_type_;
177  std::string basis_name_;
178  std::string field_basis_name_;
179  std::string field_basis_name_D1_;
180  std::string field_basis_name_D2_;
181 
183 
186  };
187 
188  typedef std::pair<std::string,Teuchos::RCP<panzer::PureBasis> > StrPureBasisPair;
189 
192  bool operator() (const StrPureBasisPair & lhs, const StrPureBasisPair & rhs) const
193  {return lhs.first<rhs.first;}
194  };
195 
196 }
197 
198 #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
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>
Teuchos::RCP< Intrepid2::Basis< PHX::Device::execution_space, double, double > > getIntrepid2Basis() const
std::string fieldNameD2() const
int dimension() const
Returns the dimension of the basis from the topology.
std::string fieldName() const
bool isScalarBasis() const
int numCells() const
Returns the number of cells in the data layouts.
std::string type() const
Returns the basis type.
Teuchos::RCP< Intrepid2::Basis< PHX::Device::execution_space, double, double > > intrepid_basis_
int order() const
Returns the polynomial order of the basis.
Teuchos::RCP< const shards::CellTopology > getCellTopology() const
Teuchos::RCP< PHX::DataLayout > local_mat_layout
<Cell,Basis,Basis>
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>
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
Teuchos::RCP< Intrepid2::Basis< ExecutionSpace, OutputValueType, PointValueType > > getIntrepid2Basis() const