19 #ifndef Intrepid2_DerivedBasis_HIV_QUAD_h
20 #define Intrepid2_DerivedBasis_HIV_QUAD_h
22 #include <Kokkos_DynRankView.hpp>
32 template<
class HGRAD_LINE,
class HVOL_LINE>
37 using ExecutionSpace =
typename HGRAD_LINE::ExecutionSpace;
38 using OutputValueType =
typename HGRAD_LINE::OutputValueType;
39 using PointValueType =
typename HGRAD_LINE::PointValueType;
41 using OutputViewType =
typename HGRAD_LINE::OutputViewType;
42 using PointViewType =
typename HGRAD_LINE::PointViewType ;
43 using ScalarViewType =
typename HGRAD_LINE::ScalarViewType;
45 using LineGradBasis = HGRAD_LINE;
46 using LineHVolBasis = HVOL_LINE;
48 using BasisBase =
typename HGRAD_LINE::BasisBase;
59 TensorBasis(Teuchos::rcp(new LineHVolBasis(polyOrder_x-1,pointType)),
60 Teuchos::rcp(new LineGradBasis(polyOrder_y,pointType)))
62 this->functionSpace_ = FUNCTION_SPACE_HDIV;
63 this->setShardsTopologyAndTags();
70 const EOperator VALUE = Intrepid2::OPERATOR_VALUE;
71 const EOperator GRAD = Intrepid2::OPERATOR_GRAD;
72 const EOperator DIV = Intrepid2::OPERATOR_DIV;
76 const double weight = -1.0;
77 if (operatorType == VALUE)
79 std::vector< std::vector<EOperator> > ops(2);
80 ops[0] = std::vector<EOperator>{};
81 ops[1] = std::vector<EOperator>{VALUE,VALUE};
82 std::vector<double> weights {0.0,weight};
85 else if (operatorType == DIV)
88 std::vector< std::vector<EOperator> > ops(1);
89 ops[0] = std::vector<EOperator>{VALUE,GRAD};
90 std::vector<double> weights {weight};
95 INTREPID2_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
"Unsupported operator type");
108 virtual void getValues(OutputViewType outputValues,
const EOperator operatorType,
109 const PointViewType inputPoints1,
const PointViewType inputPoints2,
110 bool tensorPoints)
const override
114 const double weight = -1.0;
116 Intrepid2::EOperator op1, op2;
117 if (operatorType == Intrepid2::OPERATOR_VALUE)
119 op1 = Intrepid2::OPERATOR_VALUE;
120 op2 = Intrepid2::OPERATOR_VALUE;
123 auto outputValuesComponent1 = Kokkos::subview(outputValues,Kokkos::ALL(),Kokkos::ALL(),0);
124 auto outputValuesComponent2 = Kokkos::subview(outputValues,Kokkos::ALL(),Kokkos::ALL(),1);
128 inputPoints2, op2, tensorPoints, weight);
130 Kokkos::deep_copy(outputValuesComponent1,0.0);
132 else if (operatorType == Intrepid2::OPERATOR_DIV)
136 op1 = Intrepid2::OPERATOR_VALUE;
137 op2 = Intrepid2::OPERATOR_GRAD;
141 inputPoints2, op2, tensorPoints, weight);
145 INTREPID2_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
"operator not yet supported");
161 auto dofCoeffs1 = Kokkos::subview(dofCoeffs,Kokkos::ALL(),0);
162 auto dofCoeffs2 = Kokkos::subview(dofCoeffs,Kokkos::ALL(),1);
163 Kokkos::deep_copy(dofCoeffs1,0.0);
166 Kokkos::parallel_for( Kokkos::RangePolicy<ExecutionSpace>(0, dofCoeffs2.extent(0)),
167 KOKKOS_LAMBDA (
const int i){ dofCoeffs2(i) *= -1.0; });
172 template<
class HGRAD_LINE,
class HVOL_LINE>
176 using ExecutionSpace =
typename HGRAD_LINE::ExecutionSpace;
177 using OutputValueType =
typename HGRAD_LINE::OutputValueType;
178 using PointValueType =
typename HGRAD_LINE::PointValueType;
180 using OutputViewType =
typename HGRAD_LINE::OutputViewType;
181 using PointViewType =
typename HGRAD_LINE::PointViewType ;
182 using ScalarViewType =
typename HGRAD_LINE::ScalarViewType;
184 using LineGradBasis = HGRAD_LINE;
185 using LineHVolBasis = HVOL_LINE;
187 using BasisBase =
typename HGRAD_LINE::BasisBase;
198 TensorBasis(Teuchos::rcp(new LineGradBasis(polyOrder_x,pointType)),
199 Teuchos::rcp(new LineHVolBasis(polyOrder_y-1,pointType)))
201 this->functionSpace_ = FUNCTION_SPACE_HDIV;
202 this->setShardsTopologyAndTags();
209 const EOperator VALUE = Intrepid2::OPERATOR_VALUE;
210 const EOperator GRAD = Intrepid2::OPERATOR_GRAD;
211 const EOperator DIV = Intrepid2::OPERATOR_DIV;
213 const double weight = 1.0;
214 if (operatorType == VALUE)
216 std::vector< std::vector<EOperator> > ops(2);
217 ops[0] = std::vector<EOperator>{VALUE,VALUE};
218 ops[1] = std::vector<EOperator>{};
219 std::vector<double> weights {weight, 0.0};
222 else if (operatorType == DIV)
225 std::vector< std::vector<EOperator> > ops(1);
226 ops[0] = std::vector<EOperator>{GRAD,VALUE};
227 std::vector<double> weights {weight};
232 INTREPID2_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
"Unsupported operator type");
245 virtual void getValues(OutputViewType outputValues,
const EOperator operatorType,
246 const PointViewType inputPoints1,
const PointViewType inputPoints2,
247 bool tensorPoints)
const override
249 Intrepid2::EOperator op1, op2;
250 if (operatorType == Intrepid2::OPERATOR_VALUE)
252 op1 = Intrepid2::OPERATOR_VALUE;
253 op2 = Intrepid2::OPERATOR_VALUE;
256 auto outputValuesComponent1 = Kokkos::subview(outputValues,Kokkos::ALL(),Kokkos::ALL(),0);
257 auto outputValuesComponent2 = Kokkos::subview(outputValues,Kokkos::ALL(),Kokkos::ALL(),1);
261 inputPoints2, op2, tensorPoints);
263 Kokkos::deep_copy(outputValuesComponent2, 0.0);
265 else if (operatorType == Intrepid2::OPERATOR_DIV)
269 op1 = Intrepid2::OPERATOR_GRAD;
270 op2 = Intrepid2::OPERATOR_VALUE;
274 inputPoints2, op2, tensorPoints);
278 INTREPID2_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
"operator not yet supported");
294 auto dofCoeffs1 = Kokkos::subview(dofCoeffs,Kokkos::ALL(),0);
295 auto dofCoeffs2 = Kokkos::subview(dofCoeffs,Kokkos::ALL(),1);
297 Kokkos::deep_copy(dofCoeffs2,0.0);
302 template<
class HGRAD_LINE,
class HVOL_LINE>
311 using ExecutionSpace =
typename HGRAD_LINE::ExecutionSpace;
312 using OutputValueType =
typename HGRAD_LINE::OutputValueType;
313 using PointValueType =
typename HGRAD_LINE::PointValueType;
315 using BasisBase =
typename HGRAD_LINE::BasisBase;
319 ordinal_type order_x_;
320 ordinal_type order_y_;
321 EPointType pointType_;
331 Teuchos::rcp(new
Family2(polyOrder_x, polyOrder_y, pointType)))
333 this->functionSpace_ = FUNCTION_SPACE_HDIV;
335 std::ostringstream basisName;
337 name_ = basisName.str();
339 order_x_ = polyOrder_x;
340 order_y_ = polyOrder_y;
341 pointType_ = pointType;
363 return name_.c_str();
376 Teuchos::RCP<BasisBase>
378 if(subCellDim == 1) {
382 return Teuchos::rcp(
new HVOL_LINE(order_x_-1, pointType_) );
385 return Teuchos::rcp(
new HVOL_LINE(order_y_-1, pointType_) );
389 INTREPID2_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
"Input parameters out of bounds");
396 virtual HostBasisPtr<OutputValueType, PointValueType>
400 auto hostBasis = Teuchos::rcp(
new HostBasis(order_x_, order_y_, pointType_));
virtual void getDofCoeffs(ScalarViewType dofCoeffs) const override
Fills in coefficients of degrees of freedom for Lagrangian basis on the reference cell...
Implementation of bases that are tensor products of two or three component bases. ...
virtual void getValues(OutputViewType outputValues, const EOperator operatorType, const PointViewType inputPoints1, const PointViewType inputPoints2, bool tensorPoints) const override
multi-component getValues() method (required/called by TensorBasis)
Basis_Derived_HDIV_Family1_QUAD(int polyOrder_x, int polyOrder_y, const EPointType pointType)
Constructor.
Teuchos::RCP< BasisBase > getSubCellRefBasis(const ordinal_type subCellDim, const ordinal_type subCellOrd) const override
returns the basis associated to a subCell.
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(BasisValues< OutputValueType, DeviceType > outputValues, const TensorPoints< PointValueType, DeviceType > inputPoints, const EOperator operatorType=OPERATOR_VALUE) const override
Evaluation of a FEM basis on a reference cell, using point and output value containers that allow pre...
Implementation of a basis that is the direct sum of two other bases.
virtual void getDofCoeffs(ScalarViewType dofCoeffs) const override
Fills in coefficients of degrees of freedom for Lagrangian basis on the reference cell...
Basis_Derived_HDIV_QUAD(int polyOrder_x, int polyOrder_y, const EPointType pointType=POINTTYPE_DEFAULT)
Constructor.
A basis that is the direct sum of two other bases.
virtual const char * getName() const override
Returns basis name.
Header file to include all Sacado headers that are required if using Intrepid2 with Sacado types...
virtual bool requireOrientation() const override
True if orientation is required.
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...
virtual void getDofCoeffs(typename BasisBase::ScalarViewType dofCoeffs) const override
Fills in coefficients of degrees of freedom on the reference cell.
Basis_Derived_HDIV_Family2_QUAD(int polyOrder_x, int polyOrder_y, const EPointType pointType=POINTTYPE_DEFAULT)
Constructor.
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 getValues(OutputViewType outputValues, const EOperator operatorType, const PointViewType inputPoints1, const PointViewType inputPoints2, bool tensorPoints) const override
multi-component getValues() method (required/called by TensorBasis)
Basis_Derived_HDIV_QUAD(int polyOrder, const EPointType pointType=POINTTYPE_DEFAULT)
Constructor.
Basis defined as the tensor product of two component bases.
virtual HostBasisPtr< OutputValueType, PointValueType > getHostBasis() const override
Creates and returns a Basis object whose DeviceType template argument is Kokkos::HostSpace::device_ty...