20 #ifndef Intrepid2_DerivedBasis_HCURL_HEX_h
21 #define Intrepid2_DerivedBasis_HCURL_HEX_h
23 #include <Kokkos_DynRankView.hpp>
33 template<
class HGRAD_LINE,
class HVOL_LINE>
38 using OutputViewType =
typename HGRAD_LINE::OutputViewType;
39 using PointViewType =
typename HGRAD_LINE::PointViewType ;
40 using ScalarViewType =
typename HGRAD_LINE::ScalarViewType;
42 using LineGradBasis = HGRAD_LINE;
43 using LineVolBasis = HVOL_LINE;
55 TensorBasis3(Teuchos::rcp(new LineVolBasis (polyOrder_x-1,pointType)),
56 Teuchos::rcp(new LineGradBasis(polyOrder_y,pointType)),
57 Teuchos::rcp(new LineGradBasis(polyOrder_z,pointType)),
60 this->functionSpace_ = FUNCTION_SPACE_HCURL;
67 const EOperator VALUE = Intrepid2::OPERATOR_VALUE;
68 const EOperator GRAD = Intrepid2::OPERATOR_GRAD;
70 if (operatorType == Intrepid2::OPERATOR_VALUE)
73 std::vector< std::vector<EOperator> > ops(3);
74 ops[0] = std::vector<EOperator>{VALUE,VALUE,VALUE};
75 ops[1] = std::vector<EOperator>{};
76 ops[2] = std::vector<EOperator>{};
77 std::vector<double> weights {1.0, 0.0, 0.0};
80 else if (operatorType == Intrepid2::OPERATOR_CURL)
87 std::vector< std::vector<EOperator> > ops(3);
88 ops[0] = std::vector<EOperator>{};
89 ops[1] = std::vector<EOperator>{VALUE,VALUE,GRAD};
90 ops[2] = std::vector<EOperator>{VALUE,GRAD,VALUE};
92 std::vector<double> weights {0.0, 1.0, -1.0};
97 INTREPID2_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
"Unsupported operator type");
111 virtual void getValues(OutputViewType outputValues,
const EOperator operatorType,
112 const PointViewType inputPoints1,
const PointViewType inputPoints2,
const PointViewType inputPoints3,
113 bool tensorPoints)
const override
115 Intrepid2::EOperator op1, op2, op3;
116 if (operatorType == Intrepid2::OPERATOR_VALUE)
118 op1 = Intrepid2::OPERATOR_VALUE;
119 op2 = Intrepid2::OPERATOR_VALUE;
120 op3 = Intrepid2::OPERATOR_VALUE;
123 auto outputValuesComponent1 = Kokkos::subview(outputValues,Kokkos::ALL(),Kokkos::ALL(),0);
124 auto outputValuesComponent23 = Kokkos::subview(outputValues,Kokkos::ALL(),Kokkos::ALL(),std::make_pair(1,3));
129 inputPoints3, op3, tensorPoints);
131 Kokkos::deep_copy(outputValuesComponent23,0.0);
133 else if (operatorType == Intrepid2::OPERATOR_CURL)
136 auto outputValuesComponent_x = Kokkos::subview(outputValues,Kokkos::ALL(),Kokkos::ALL(),0);
137 auto outputValuesComponent_y = Kokkos::subview(outputValues,Kokkos::ALL(),Kokkos::ALL(),1);
138 auto outputValuesComponent_z = Kokkos::subview(outputValues,Kokkos::ALL(),Kokkos::ALL(),2);
141 Kokkos::deep_copy(outputValuesComponent_x, 0.0);
144 op1 = Intrepid2::OPERATOR_VALUE;
145 op2 = Intrepid2::OPERATOR_VALUE;
146 op3 = Intrepid2::OPERATOR_GRAD;
152 inputPoints3, op3, tensorPoints, weight);
155 op1 = Intrepid2::OPERATOR_VALUE;
156 op2 = Intrepid2::OPERATOR_GRAD;
157 op3 = Intrepid2::OPERATOR_VALUE;
162 inputPoints3, op3, tensorPoints, weight);
166 INTREPID2_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
"operator not yet supported");
182 auto dofCoeffs1 = Kokkos::subview(dofCoeffs,Kokkos::ALL(),0);
183 auto dofCoeffs23 = Kokkos::subview(dofCoeffs,Kokkos::ALL(),std::make_pair(1,3));
185 Kokkos::deep_copy(dofCoeffs23,0.0);
189 template<
class HGRAD_LINE,
class HVOL_LINE>
194 using OutputViewType =
typename HGRAD_LINE::OutputViewType;
195 using PointViewType =
typename HGRAD_LINE::PointViewType ;
196 using ScalarViewType =
typename HGRAD_LINE::ScalarViewType;
198 using LineGradBasis = HGRAD_LINE;
199 using LineVolBasis = HVOL_LINE;
211 TensorBasis3(Teuchos::rcp( new LineGradBasis(polyOrder_x,pointType)),
212 Teuchos::rcp( new LineVolBasis (polyOrder_y-1,pointType)),
213 Teuchos::rcp( new LineGradBasis(polyOrder_z,pointType)),
216 this->functionSpace_ = FUNCTION_SPACE_HCURL;
223 const EOperator VALUE = Intrepid2::OPERATOR_VALUE;
224 const EOperator GRAD = Intrepid2::OPERATOR_GRAD;
225 const EOperator CURL = Intrepid2::OPERATOR_CURL;
226 if (operatorType == VALUE)
229 std::vector< std::vector<EOperator> > ops(3);
230 ops[0] = std::vector<EOperator>{};
231 ops[1] = std::vector<EOperator>{VALUE,VALUE,VALUE};
232 ops[2] = std::vector<EOperator>{};
233 std::vector<double> weights {0.0, 1.0, 0.0};
236 else if (operatorType == CURL)
242 std::vector< std::vector<EOperator> > ops(3);
243 ops[0] = std::vector<EOperator>{VALUE,VALUE,GRAD};
244 ops[1] = std::vector<EOperator>{};
245 ops[2] = std::vector<EOperator>{GRAD,VALUE,VALUE};
247 std::vector<double> weights {-1.0, 0.0, 1.0};
252 INTREPID2_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
"Unsupported operator type");
266 virtual void getValues(OutputViewType outputValues,
const EOperator operatorType,
267 const PointViewType inputPoints1,
const PointViewType inputPoints2,
const PointViewType inputPoints3,
268 bool tensorPoints)
const override
270 Intrepid2::EOperator op1, op2, op3;
271 if (operatorType == Intrepid2::OPERATOR_VALUE)
273 op1 = Intrepid2::OPERATOR_VALUE;
274 op2 = Intrepid2::OPERATOR_VALUE;
275 op3 = Intrepid2::OPERATOR_VALUE;
278 auto outputValuesComponent_x = Kokkos::subview(outputValues,Kokkos::ALL(),Kokkos::ALL(),0);
279 auto outputValuesComponent_y = Kokkos::subview(outputValues,Kokkos::ALL(),Kokkos::ALL(),1);
280 auto outputValuesComponent_z = Kokkos::subview(outputValues,Kokkos::ALL(),Kokkos::ALL(),2);
283 Kokkos::deep_copy(outputValuesComponent_x,0.0);
288 inputPoints3, op3, tensorPoints);
290 Kokkos::deep_copy(outputValuesComponent_z,0.0);
292 else if (operatorType == Intrepid2::OPERATOR_CURL)
295 auto outputValuesComponent_x = Kokkos::subview(outputValues,Kokkos::ALL(),Kokkos::ALL(),0);
296 auto outputValuesComponent_y = Kokkos::subview(outputValues,Kokkos::ALL(),Kokkos::ALL(),1);
297 auto outputValuesComponent_z = Kokkos::subview(outputValues,Kokkos::ALL(),Kokkos::ALL(),2);
300 op1 = Intrepid2::OPERATOR_VALUE;
301 op2 = Intrepid2::OPERATOR_VALUE;
302 op3 = Intrepid2::OPERATOR_GRAD;
304 double weight = -1.0;
308 inputPoints3, op3, tensorPoints, weight);
311 Kokkos::deep_copy(outputValuesComponent_y, 0.0);
314 op1 = Intrepid2::OPERATOR_GRAD;
315 op2 = Intrepid2::OPERATOR_VALUE;
316 op3 = Intrepid2::OPERATOR_VALUE;
321 inputPoints3, op3, tensorPoints, weight);
325 INTREPID2_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
"operator not yet supported");
341 auto dofCoeffs1 = Kokkos::subview(dofCoeffs,Kokkos::ALL(),0);
342 auto dofCoeffs2 = Kokkos::subview(dofCoeffs,Kokkos::ALL(),1);
343 auto dofCoeffs3 = Kokkos::subview(dofCoeffs,Kokkos::ALL(),2);
344 Kokkos::deep_copy(dofCoeffs1,0.0);
346 Kokkos::deep_copy(dofCoeffs3,0.0);
352 template<
class HGRAD_LINE,
class HVOL_LINE>
356 using OutputViewType =
typename HGRAD_LINE::OutputViewType;
357 using PointViewType =
typename HGRAD_LINE::PointViewType ;
358 using ScalarViewType =
typename HGRAD_LINE::ScalarViewType;
360 using LineGradBasis = HGRAD_LINE;
361 using LineVolBasis = HVOL_LINE;
373 TensorBasis3(Teuchos::rcp(new LineGradBasis(polyOrder_x,pointType)),
374 Teuchos::rcp(new LineGradBasis(polyOrder_y,pointType)),
375 Teuchos::rcp(new LineVolBasis (polyOrder_z-1,pointType)),
378 this->functionSpace_ = FUNCTION_SPACE_HCURL;
385 const EOperator VALUE = Intrepid2::OPERATOR_VALUE;
386 const EOperator GRAD = Intrepid2::OPERATOR_GRAD;
387 if (operatorType == Intrepid2::OPERATOR_VALUE)
390 std::vector< std::vector<EOperator> > ops(3);
391 ops[0] = std::vector<EOperator>{};
392 ops[1] = std::vector<EOperator>{};
393 ops[2] = std::vector<EOperator>{VALUE,VALUE,VALUE};
394 std::vector<double> weights {0.0, 0.0, 1.0};
397 else if (operatorType == Intrepid2::OPERATOR_CURL)
403 std::vector< std::vector<EOperator> > ops(3);
404 ops[0] = std::vector<EOperator>{VALUE,GRAD,VALUE};
405 ops[1] = std::vector<EOperator>{GRAD,VALUE,VALUE};
406 ops[2] = std::vector<EOperator>{};
408 std::vector<double> weights {1.0, -1.0, 0.0};
413 INTREPID2_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
"Unsupported operator type");
427 virtual void getValues(OutputViewType outputValues,
const EOperator operatorType,
428 const PointViewType inputPoints1,
const PointViewType inputPoints2,
const PointViewType inputPoints3,
429 bool tensorPoints)
const override
431 Intrepid2::EOperator op1, op2, op3;
432 if (operatorType == Intrepid2::OPERATOR_VALUE)
434 op1 = Intrepid2::OPERATOR_VALUE;
435 op2 = Intrepid2::OPERATOR_VALUE;
436 op3 = Intrepid2::OPERATOR_VALUE;
439 auto outputValuesComponent_xy = Kokkos::subview(outputValues,Kokkos::ALL(),Kokkos::ALL(),std::make_pair(0,2));
440 auto outputValuesComponent_z = Kokkos::subview(outputValues,Kokkos::ALL(),Kokkos::ALL(),2);
443 Kokkos::deep_copy(outputValuesComponent_xy,0.0);
448 inputPoints3, op3, tensorPoints);
450 else if (operatorType == Intrepid2::OPERATOR_CURL)
453 auto outputValuesComponent_x = Kokkos::subview(outputValues,Kokkos::ALL(),Kokkos::ALL(),0);
454 auto outputValuesComponent_y = Kokkos::subview(outputValues,Kokkos::ALL(),Kokkos::ALL(),1);
455 auto outputValuesComponent_z = Kokkos::subview(outputValues,Kokkos::ALL(),Kokkos::ALL(),2);
458 op1 = Intrepid2::OPERATOR_VALUE;
459 op2 = Intrepid2::OPERATOR_GRAD;
460 op3 = Intrepid2::OPERATOR_VALUE;
466 inputPoints3, op3, tensorPoints, weight);
468 op1 = Intrepid2::OPERATOR_GRAD;
469 op2 = Intrepid2::OPERATOR_VALUE;
470 op3 = Intrepid2::OPERATOR_VALUE;
475 inputPoints3, op3, tensorPoints, weight);
478 Kokkos::deep_copy(outputValuesComponent_z, 0.0);
482 INTREPID2_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
"operator not yet supported");
498 auto dofCoeffs12 = Kokkos::subview(dofCoeffs,Kokkos::ALL(),std::make_pair(0,2));
499 auto dofCoeffs3 = Kokkos::subview(dofCoeffs,Kokkos::ALL(),2);
500 Kokkos::deep_copy(dofCoeffs12,0.0);
505 template<
class HGRAD_LINE,
class HVOL_LINE>
522 Teuchos::rcp(new
Family2(polyOrder_x, polyOrder_y, polyOrder_z, pointType))) {}
525 template<
class HGRAD_LINE,
class HVOL_LINE>
534 ordinal_type order_x_;
535 ordinal_type order_y_;
536 ordinal_type order_z_;
537 EPointType pointType_;
541 using ExecutionSpace =
typename HGRAD_LINE::ExecutionSpace;
542 using OutputValueType =
typename HGRAD_LINE::OutputValueType;
543 using PointValueType =
typename HGRAD_LINE::PointValueType;
545 using BasisBase =
typename HGRAD_LINE::BasisBase;
556 Teuchos::rcp(new
Family3 (polyOrder_x, polyOrder_y, polyOrder_z, pointType))) {
557 this->functionSpace_ = FUNCTION_SPACE_HCURL;
559 std::ostringstream basisName;
561 name_ = basisName.str();
563 order_x_ = polyOrder_x;
564 order_y_ = polyOrder_y;
565 order_z_ = polyOrder_z;
566 pointType_ = pointType;
587 return name_.c_str();
600 Teuchos::RCP<BasisBase>
603 using LineBasis = HVOL_LINE;
606 if(subCellDim == 1) {
612 return Teuchos::rcp(
new LineBasis(order_x_-1, pointType_) );
617 return Teuchos::rcp(
new LineBasis(order_y_-1, pointType_) );
622 return Teuchos::rcp(
new LineBasis(order_z_-1, pointType_) );
624 }
else if(subCellDim == 2) {
627 return Teuchos::rcp(
new QuadBasis(order_x_, order_z_, pointType_) );
629 return Teuchos::rcp(
new QuadBasis(order_y_,order_z_, pointType_) );
631 return Teuchos::rcp(
new QuadBasis(order_x_, order_z_, pointType_) );
633 return Teuchos::rcp(
new QuadBasis(order_z_, order_y_, pointType_) );
635 return Teuchos::rcp(
new QuadBasis(order_y_, order_x_, pointType_) );
637 return Teuchos::rcp(
new QuadBasis(order_x_, order_y_, pointType_) );
641 INTREPID2_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
"Input parameters out of bounds");
647 virtual HostBasisPtr<OutputValueType, PointValueType>
651 auto hostBasis = Teuchos::rcp(
new HostBasis(order_x_, order_y_, order_z_, pointType_));
virtual void getDofCoeffs(ScalarViewType dofCoeffs) const override
Fills in coefficients of degrees of freedom for Lagrangian basis on the reference cell...
Teuchos::RCP< BasisBase > getSubCellRefBasis(const ordinal_type subCellDim, const ordinal_type subCellOrd) const override
returns the basis associated to a subCell.
virtual bool requireOrientation() const override
True if orientation is required.
Basis_Derived_HCURL_Family1_HEX(int polyOrder_x, int polyOrder_y, int polyOrder_z, const EPointType pointType=POINTTYPE_DEFAULT)
Constructor.
Basis_Derived_HCURL_Family1_Family2_HEX(int polyOrder_x, int polyOrder_y, int polyOrder_z, const EPointType pointType)
Constructor.
virtual const char * getName() const override
Returns basis name.
virtual OperatorTensorDecomposition getSimpleOperatorDecomposition(const EOperator &operatorType) const override
Returns a simple decomposition of the specified operator: what operator(s) should be applied to basis...
Implementation of bases that are tensor products of two or three component bases. ...
Free functions, callable from device code, that implement various polynomials useful in basis definit...
For a multi-component tensor basis, specifies the operators to be applied to the components to produc...
virtual void getValues(OutputViewType outputValues, const EOperator operatorType, const PointViewType inputPoints12, const PointViewType inputPoints3, bool tensorPoints) const override
Evaluation of a tensor FEM basis on a reference cell.
virtual OperatorTensorDecomposition getSimpleOperatorDecomposition(const EOperator &operatorType) const override
Returns a simple decomposition of the specified operator: what operator(s) should be applied to basis...
Basis_Derived_HCURL_Family2_HEX(int polyOrder_x, int polyOrder_y, int polyOrder_z, const EPointType pointType=POINTTYPE_DEFAULT)
Constructor.
Implementation of a basis that is the direct sum of two other bases.
A basis that is the direct sum of two other bases.
virtual const char * getName() const override
Returns basis name.
Basis_Derived_HCURL_Family3_HEX(int polyOrder_x, int polyOrder_y, int polyOrder_z, const EPointType pointType=POINTTYPE_DEFAULT)
Constructor.
Basis_Derived_HCURL_HEX(int polyOrder_x, int polyOrder_y, int polyOrder_z, const EPointType pointType=POINTTYPE_DEFAULT)
Constructor.
virtual void getValues(OutputViewType outputValues, const EOperator operatorType, const PointViewType inputPoints1, const PointViewType inputPoints2, const PointViewType inputPoints3, bool tensorPoints) const override
multi-component getValues() method (required/called by TensorBasis3)
virtual void getDofCoeffs(ScalarViewType dofCoeffs) const override
Fills in coefficients of degrees of freedom for Lagrangian basis on the reference cell...
virtual void getValues(OutputViewType outputValues, const EOperator operatorType, const PointViewType inputPoints1, const PointViewType inputPoints2, const PointViewType inputPoints3, bool tensorPoints) const override
multi-component getValues() method (required/called by TensorBasis3)
Header file to include all Sacado headers that are required if using Intrepid2 with Sacado types...
virtual OperatorTensorDecomposition getSimpleOperatorDecomposition(const EOperator &operatorType) const override
Returns a simple decomposition of the specified operator: what operator(s) should be applied to basis...
virtual void getDofCoeffs(typename BasisBase::ScalarViewType dofCoeffs) const override
Fills in coefficients of degrees of freedom on the reference cell.
virtual void getValues(OutputViewType outputValues, const EOperator operatorType, const PointViewType inputPoints1, const PointViewType inputPoints2, const PointViewType inputPoints3, bool tensorPoints) const override
multi-component getValues() method (required/called by TensorBasis3)
Basis_Derived_HCURL_HEX(int polyOrder, const EPointType pointType=POINTTYPE_DEFAULT)
Constructor.
virtual HostBasisPtr< OutputValueType, PointValueType > getHostBasis() const override
Creates and returns a Basis object whose DeviceType template argument is Kokkos::HostSpace::device_ty...
virtual void getDofCoeffs(ScalarViewType dofCoeffs) const override
Fills in coefficients of degrees of freedom for Lagrangian basis on the reference cell...