Intrepid2
Intrepid2_DerivedBasisFamily.hpp
Go to the documentation of this file.
1// @HEADER
2// ************************************************************************
3//
4// Intrepid2 Package
5// Copyright (2007) Sandia Corporation
6//
7// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8// license for use of this work by or on behalf of the U.S. Government.
9//
10// Redistribution and use in source and binary forms, with or without
11// modification, are permitted provided that the following conditions are
12// met:
13//
14// 1. Redistributions of source code must retain the above copyright
15// notice, this list of conditions and the following disclaimer.
16//
17// 2. Redistributions in binary form must reproduce the above copyright
18// notice, this list of conditions and the following disclaimer in the
19// documentation and/or other materials provided with the distribution.
20//
21// 3. Neither the name of the Corporation nor the names of the
22// contributors may be used to endorse or promote products derived from
23// this software without specific prior written permission.
24//
25// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36//
37// Questions? Contact Kyungjoo Kim (kyukim@sandia.gov),
38// Mauro Perego (mperego@sandia.gov), or
39// Nate Roberts (nvrober@sandia.gov)
40//
41// ************************************************************************
42// @HEADER
43
49#ifndef Intrepid2_DerivedBasisFamily_h
50#define Intrepid2_DerivedBasisFamily_h
51
52#include "Intrepid2_Basis.hpp"
53
56#include "Intrepid2_DerivedBasis_HDIV_QUAD.hpp"
58
63
64namespace Intrepid2
65{
68 {
69 public:
70 using HGRAD = void;
71 using HCURL = void;
72 using HDIV = void;
73 using HVOL = void;
74 };
75
81 template<class LineBasisHGRAD, class LineBasisHVOL, class TriangleBasisFamily = EmptyBasisFamily, class TetrahedronBasisFamily = EmptyBasisFamily>
83 {
84 public:
85 using ExecutionSpace = typename LineBasisHGRAD::ExecutionSpace;
86 using OutputValueType = typename LineBasisHGRAD::OutputValueType;
87 using PointValueType = typename LineBasisHGRAD::PointValueType;
88
89 using Basis = typename LineBasisHGRAD::BasisBase;
90 using BasisPtr = Teuchos::RCP<Basis>;
91 using DeviceType = typename Basis::DeviceType;
92
93 // line bases
94 using HGRAD_LINE = LineBasisHGRAD;
95 using HVOL_LINE = LineBasisHVOL;
96
97 // quadrilateral bases
102
103 // hexahedron bases
108
109 // triangle bases
110 using HGRAD_TRI = typename TriangleBasisFamily::HGRAD;
111 using HCURL_TRI = typename TriangleBasisFamily::HCURL;
112 using HDIV_TRI = typename TriangleBasisFamily::HDIV;
113 using HVOL_TRI = typename TriangleBasisFamily::HVOL;
114
115 // tetrahedron bases
116 using HGRAD_TET = typename TetrahedronBasisFamily::HGRAD;
117 using HCURL_TET = typename TetrahedronBasisFamily::HCURL;
118 using HDIV_TET = typename TetrahedronBasisFamily::HDIV;
119 using HVOL_TET = typename TetrahedronBasisFamily::HVOL;
120 };
121
127 template<class BasisFamily>
128 static typename BasisFamily::BasisPtr getLineBasis(Intrepid2::EFunctionSpace fs, int polyOrder, const EPointType pointType=POINTTYPE_DEFAULT)
129 {
130 using Teuchos::rcp;
131 switch (fs)
132 {
133 case FUNCTION_SPACE_HVOL: return rcp(new typename BasisFamily::HVOL_LINE (polyOrder,pointType));
134 case FUNCTION_SPACE_HGRAD: return rcp(new typename BasisFamily::HGRAD_LINE(polyOrder,pointType));
135 default:
136 INTREPID2_TEST_FOR_EXCEPTION(true, std::invalid_argument, "Unsupported function space");
137 }
138 }
139
145 template<class BasisFamily>
146 static typename BasisFamily::BasisPtr getQuadrilateralBasis(Intrepid2::EFunctionSpace fs, int polyOrder, const EPointType pointType=POINTTYPE_DEFAULT)
147 {
148 using Teuchos::rcp;
149 switch (fs)
150 {
151 case FUNCTION_SPACE_HVOL: return rcp(new typename BasisFamily::HVOL_QUAD (polyOrder,pointType));
152 case FUNCTION_SPACE_HCURL: return rcp(new typename BasisFamily::HCURL_QUAD(polyOrder,pointType));
153 case FUNCTION_SPACE_HDIV: return rcp(new typename BasisFamily::HDIV_QUAD (polyOrder,pointType));
154 case FUNCTION_SPACE_HGRAD: return rcp(new typename BasisFamily::HGRAD_QUAD(polyOrder,pointType));
155 default:
156 INTREPID2_TEST_FOR_EXCEPTION(true, std::invalid_argument, "Unsupported function space");
157 }
158 }
159
166 template<class BasisFamily>
167 static typename BasisFamily::BasisPtr getQuadrilateralBasis(Intrepid2::EFunctionSpace fs, int polyOrder_x, int polyOrder_y, const EPointType pointType=POINTTYPE_DEFAULT)
168 {
169 using Teuchos::rcp;
170 switch (fs)
171 {
172 case FUNCTION_SPACE_HVOL: return rcp(new typename BasisFamily::HVOL_QUAD (polyOrder_x,polyOrder_y,pointType));
173 case FUNCTION_SPACE_HCURL: return rcp(new typename BasisFamily::HCURL_QUAD(polyOrder_x,polyOrder_y,pointType));
174 case FUNCTION_SPACE_HDIV: return rcp(new typename BasisFamily::HDIV_QUAD (polyOrder_x,polyOrder_y,pointType));
175 case FUNCTION_SPACE_HGRAD: return rcp(new typename BasisFamily::HGRAD_QUAD(polyOrder_x,polyOrder_y,pointType));
176 default:
177 INTREPID2_TEST_FOR_EXCEPTION(true, std::invalid_argument, "Unsupported function space");
178 }
179 }
180
186 template<class BasisFamily>
187 static typename BasisFamily::BasisPtr getHexahedronBasis(Intrepid2::EFunctionSpace fs, int polyOrder, const EPointType pointType=POINTTYPE_DEFAULT)
188 {
189 using Teuchos::rcp;
190 switch (fs)
191 {
192 case FUNCTION_SPACE_HVOL: return rcp(new typename BasisFamily::HVOL_HEX (polyOrder,pointType));
193 case FUNCTION_SPACE_HCURL: return rcp(new typename BasisFamily::HCURL_HEX(polyOrder,pointType));
194 case FUNCTION_SPACE_HDIV: return rcp(new typename BasisFamily::HDIV_HEX (polyOrder,pointType));
195 case FUNCTION_SPACE_HGRAD: return rcp(new typename BasisFamily::HGRAD_HEX(polyOrder,pointType));
196 default:
197 INTREPID2_TEST_FOR_EXCEPTION(true, std::invalid_argument, "Unsupported function space");
198 }
199 }
200
208 template<class BasisFamily>
209 static typename BasisFamily::BasisPtr getHexahedronBasis(Intrepid2::EFunctionSpace fs, int polyOrder_x, int polyOrder_y, int polyOrder_z, const EPointType pointType=POINTTYPE_DEFAULT)
210 {
211 using Teuchos::rcp;
212 switch (fs)
213 {
214 case FUNCTION_SPACE_HVOL: return rcp(new typename BasisFamily::HVOL_HEX (polyOrder_x,polyOrder_y,polyOrder_z,pointType));
215 case FUNCTION_SPACE_HCURL: return rcp(new typename BasisFamily::HCURL_HEX(polyOrder_x,polyOrder_y,polyOrder_z,pointType));
216 case FUNCTION_SPACE_HDIV: return rcp(new typename BasisFamily::HDIV_HEX (polyOrder_x,polyOrder_y,polyOrder_z,pointType));
217 case FUNCTION_SPACE_HGRAD: return rcp(new typename BasisFamily::HGRAD_HEX(polyOrder_x,polyOrder_y,polyOrder_z,pointType));
218 default:
219 INTREPID2_TEST_FOR_EXCEPTION(true, std::invalid_argument, "Unsupported function space");
220 }
221 }
222
228 template<class BasisFamily>
229 static typename BasisFamily::BasisPtr getTetrahedronBasis(Intrepid2::EFunctionSpace fs, int polyOrder, const EPointType pointType=POINTTYPE_DEFAULT)
230 {
231 using Teuchos::rcp;
232 switch (fs)
233 {
234 //Note: only HGRAD is available for Hierarchical basis at the moment
235 case FUNCTION_SPACE_HVOL: return rcp(new typename BasisFamily::HVOL_TET (polyOrder,pointType));
236 case FUNCTION_SPACE_HCURL: return rcp(new typename BasisFamily::HCURL_TET(polyOrder,pointType));
237 case FUNCTION_SPACE_HDIV: return rcp(new typename BasisFamily::HDIV_TET (polyOrder,pointType));
238 case FUNCTION_SPACE_HGRAD: return rcp(new typename BasisFamily::HGRAD_TET(polyOrder,pointType));
239 default:
240 INTREPID2_TEST_FOR_EXCEPTION(true, std::invalid_argument, "Unsupported function space");
241 }
242 }
243
249 template<class BasisFamily>
250 static typename BasisFamily::BasisPtr getTriangleBasis(Intrepid2::EFunctionSpace fs, int polyOrder, const EPointType pointType=POINTTYPE_DEFAULT)
251 {
252 using Teuchos::rcp;
253 switch (fs)
254 {
255 //Note: only HGRAD is available for Hierarchical basis at the moment
256 case FUNCTION_SPACE_HVOL: return rcp(new typename BasisFamily::HVOL_TRI (polyOrder,pointType));
257 case FUNCTION_SPACE_HCURL: return rcp(new typename BasisFamily::HCURL_TRI(polyOrder,pointType));
258 case FUNCTION_SPACE_HDIV: return rcp(new typename BasisFamily::HDIV_TRI (polyOrder,pointType));
259 case FUNCTION_SPACE_HGRAD: return rcp(new typename BasisFamily::HGRAD_TRI(polyOrder,pointType));
260 default:
261 INTREPID2_TEST_FOR_EXCEPTION(true, std::invalid_argument, "Unsupported function space");
262 }
263 }
264
274 template<class BasisFamily>
275 static typename BasisFamily::BasisPtr getBasis(const shards::CellTopology &cellTopo, Intrepid2::EFunctionSpace fs, int polyOrder, const EPointType pointType = POINTTYPE_DEFAULT)
276 {
277 using Teuchos::rcp;
278 switch (cellTopo.getBaseKey())
279 {
280 case shards::Line<>::key: return getLineBasis<BasisFamily>(fs,polyOrder, pointType);
281 case shards::Quadrilateral<>::key: return getQuadrilateralBasis<BasisFamily>(fs,polyOrder,pointType);
282 case shards::Triangle<>::key: return getTriangleBasis<BasisFamily>(fs,polyOrder,pointType);
283 case shards::Hexahedron<>::key: return getHexahedronBasis<BasisFamily>(fs,polyOrder,pointType);
284 case shards::Tetrahedron<>::key: return getTetrahedronBasis<BasisFamily>(fs,polyOrder,pointType);
285 default:
286 INTREPID2_TEST_FOR_EXCEPTION(true, std::invalid_argument, "Unsupported cell topology");
287 }
288 }
289} // end namespace Intrepid2
290
291#endif /* Intrepid2_DerivedBasisFamily_h */
Header file for the abstract base class Intrepid2::Basis.
static BasisFamily::BasisPtr getHexahedronBasis(Intrepid2::EFunctionSpace fs, int polyOrder, const EPointType pointType=POINTTYPE_DEFAULT)
Factory method for isotropic bases on the hexahedron in the given family.
static BasisFamily::BasisPtr getQuadrilateralBasis(Intrepid2::EFunctionSpace fs, int polyOrder, const EPointType pointType=POINTTYPE_DEFAULT)
Factory method for isotropic quadrilateral bases in the given family.
static BasisFamily::BasisPtr getTetrahedronBasis(Intrepid2::EFunctionSpace fs, int polyOrder, const EPointType pointType=POINTTYPE_DEFAULT)
Factory method for isotropic tetrahedron bases in the given family.
static BasisFamily::BasisPtr getTriangleBasis(Intrepid2::EFunctionSpace fs, int polyOrder, const EPointType pointType=POINTTYPE_DEFAULT)
Factory method for isotropic triangle bases in the given family.
static BasisFamily::BasisPtr getLineBasis(Intrepid2::EFunctionSpace fs, int polyOrder, const EPointType pointType=POINTTYPE_DEFAULT)
Factory method for line bases in the given family.
static BasisFamily::BasisPtr getBasis(const shards::CellTopology &cellTopo, Intrepid2::EFunctionSpace fs, int polyOrder, const EPointType pointType=POINTTYPE_DEFAULT)
Factory method for isotropic bases in the given family on the specified cell topology.
Implementation of H(curl) basis on the hexahedron that is templated on H(vol) and H(grad) on the line...
Implementation of H(curl) basis on the quadrilateral that is templated on H(vol) and H(grad) on the l...
Implementation of H(div) basis on the hexahedron that is templated on H(vol) and H(grad) on the line.
Implementation of H(grad) basis on the hexahedron that is templated on H(grad) on the line.
Implementation of H(grad) basis on the quadrilateral that is templated on H(grad) on the line.
Implementation of H(vol) basis on the hexahedron that is templated on H(vol) on the line.
Implementation of H(vol) basis on the quadrilateral that is templated on H(vol) on the line.
Implementation of H(vol) basis on the quadrilateral that is templated on H(vol) on the line.
Implementation of H(vol) basis on the quadrilateral that is templated on H(vol) on the line.
Device DeviceType
(Kokkos) Device type on which Basis is templated. Does not necessarily return true for Kokkos::is_dev...
A family of basis functions, constructed from H(vol) and H(grad) bases on the line.
EmptyBasisFamily allows us to set a default void family for a given topology.