Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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, HVOL=3, CONST=4 } 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 
114  getIntrepid2Basis() const;
115 
116  template <typename ExecutionSpace,typename OutputValueType, typename 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
143 
144  int getBasisRank() const
145  { return basis_rank_; }
146 
147  bool supportsBasisCoordinates() const;
148 
150  { return topology_; }
151 
152  public:
165 
166  private:
167 
169  void initialize(const std::string & basis_type,const int basis_order);
170 
171  private:
172 
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
std::string name() const
A unique key that is the combination of the basis type and basis order.
bool supportsCurl() const
bool supportsGrad() const
Simple binary comparison class to help with sorting.
EElementSpace getElementSpace() const
std::string field_basis_name_D1_
int order() const
Returns the polynomial order of the basis.
int cardinality() const
Returns the number of basis coefficients.
Teuchos::RCP< PHX::DataLayout > cell_data
&lt;Cell&gt;
std::string fieldName() const
int dimension() const
Returns the dimension of the basis from the topology.
bool requiresOrientations() const
bool supportsBasisCoordinates() const
std::string type() const
Returns the basis type.
Teuchos::RCP< const shards::CellTopology > getCellTopology() const
bool supportsDiv() const
std::string field_basis_name_
Data for determining cell topology and dimensionality.
Teuchos::RCP< PHX::DataLayout > coordinates
&lt;Cell,Basis,Dim&gt;
PureBasis(const std::string &basis_type, const int basis_order, const CellData &cell_data)
bool isVectorBasis() const
Teuchos::RCP< Intrepid2::Basis< ExecutionSpace, OutputValueType, PointValueType > > getIntrepid2Basis() const
Teuchos::RCP< PHX::DataLayout > functional_grad
&lt;Cell,Basis,Dim&gt;
Teuchos::RCP< PHX::DataLayout > functional_D2
&lt;Cell,Basis,Dim&gt;
Teuchos::RCP< Intrepid2::Basis< PHX::Device::execution_space, double, double > > getIntrepid2Basis() const
int numCells() const
Returns the number of cells in the data layouts.
bool operator()(const StrPureBasisPair &lhs, const StrPureBasisPair &rhs) const
bool isScalarBasis() const
Teuchos::RCP< Intrepid2::Basis< PHX::Device::execution_space, double, double > > intrepid_basis_
Teuchos::RCP< PHX::DataLayout > local_mat_layout
&lt;Cell,Basis,Basis&gt;
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.
int getBasisRank() const
Description and data layouts associated with a particular basis.
Teuchos::RCP< PHX::DataLayout > functional
&lt;Cell,Basis&gt; or &lt;Cell,Basis&gt;
std::string fieldNameD1() const
Teuchos::RCP< const shards::CellTopology > topology_
std::string field_basis_name_D2_
std::string fieldNameD2() const