17 #ifndef __INTREPID2_HGRAD_LINE_CN_FEM_JACOBI_DEF_HPP__
18 #define __INTREPID2_HGRAD_LINE_CN_FEM_JACOBI_DEF_HPP__
27 template<EOperator opType>
28 template<
typename OutputViewType,
29 typename inputViewType>
30 KOKKOS_INLINE_FUNCTION
32 Basis_HGRAD_LINE_Cn_FEM_JACOBI::Serial<opType>::
33 getValues( OutputViewType output,
34 const inputViewType input,
35 const ordinal_type order,
38 const ordinal_type operatorDn ) {
40 const ordinal_type card = order + 1;
41 ordinal_type opDn = operatorDn;
43 const auto pts = Kokkos::subview( input, Kokkos::ALL(), 0 );
44 const ordinal_type np = input.extent(0);
47 case OPERATOR_VALUE: {
48 const Kokkos::View<
typename inputViewType::value_type*,
49 typename inputViewType::memory_space,Kokkos::MemoryUnmanaged> null;
50 for (ordinal_type p=0;p<card;++p) {
51 auto poly = Kokkos::subview( output, p, Kokkos::ALL() );
58 for (ordinal_type p=0;p<card;++p) {
59 auto polyd = Kokkos::subview( output, p, Kokkos::ALL(), 0 );
73 opDn = getOperatorOrder(opType);
76 const ordinal_type pend = output.extent(0);
77 const ordinal_type iend = output.extent(1);
78 const ordinal_type jend = output.extent(2);
80 for (ordinal_type p=0;p<pend;++p)
81 for (ordinal_type i=0;i<iend;++i)
82 for (ordinal_type j=0;j<jend;++j)
83 output.access(p, i, j) = 0.0;
86 const Kokkos::View<
typename inputViewType::value_type*,
87 typename inputViewType::memory_space,Kokkos::MemoryUnmanaged> null;
89 for (ordinal_type p=opDn;p<card;++p) {
90 double scaleFactor = 1.0;
91 for (ordinal_type i=1;i<=opDn;++i)
92 scaleFactor *= 0.5*(p + alpha + beta + i);
94 const auto poly = Kokkos::subview( output, p, Kokkos::ALL(), 0 );
96 for (ordinal_type i=0;i<np;++i)
97 poly(i) = scaleFactor*poly(i);
103 INTREPID2_TEST_FOR_ABORT(
true,
104 ">>> ERROR: (Intrepid2::Basis_HGRAD_LINE_Cn_FEM_JACOBI::Serial::getValues) operator is not supported");
111 template<
typename DT, ordinal_type numPtsPerEval,
112 typename outputValueValueType,
class ...outputValueProperties,
113 typename inputPointValueType,
class ...inputPointProperties>
115 Basis_HGRAD_LINE_Cn_FEM_JACOBI::
116 getValues(
const typename DT::execution_space& space,
117 Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
118 const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
119 const ordinal_type order,
122 const EOperator operatorType ) {
123 typedef Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValueViewType;
124 typedef Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPointViewType;
125 typedef typename DT::execution_space ExecSpaceType;
128 const auto loopSizeTmp1 = (inputPoints.extent(0)/numPtsPerEval);
129 const auto loopSizeTmp2 = (inputPoints.extent(0)%numPtsPerEval != 0);
130 const auto loopSize = loopSizeTmp1 + loopSizeTmp2;
131 Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(space, 0, loopSize);
133 switch (operatorType) {
134 case OPERATOR_VALUE: {
135 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_VALUE,numPtsPerEval> FunctorType;
136 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints,
137 order, alpha, beta) );
142 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_GRAD,numPtsPerEval> FunctorType;
143 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints,
144 order, alpha, beta) );
156 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_Dn,numPtsPerEval> FunctorType;
157 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints,
159 getOperatorOrder(operatorType)) );
163 case OPERATOR_CURL: {
164 INTREPID2_TEST_FOR_EXCEPTION( operatorType == OPERATOR_DIV ||
165 operatorType == OPERATOR_CURL, std::invalid_argument,
166 ">>> ERROR (Basis_HGRAD_LINE_Cn_FEM_JACOBI): invalid operator type (div and curl).");
170 INTREPID2_TEST_FOR_EXCEPTION( !Intrepid2::isValidOperator(operatorType), std::invalid_argument,
171 ">>> ERROR (Basis_HGRAD_LINE_Cn_FEM_JACOBI): invalid operator type");
179 template<
typename DT,
typename OT,
typename PT>
183 const double beta ) {
184 this->basisCardinality_ = order+1;
185 this->basisDegree_ = order;
186 this->basisCellTopologyKey_ = shards::Line<>::key;
187 this->basisType_ = BASIS_FEM_HIERARCHICAL;
188 this->basisCoordinates_ = COORDINATES_CARTESIAN;
189 this->functionSpace_ = FUNCTION_SPACE_HGRAD;
192 this->alpha_ = alpha;
198 const ordinal_type tagSize = 4;
199 const ordinal_type posScDim = 0;
200 const ordinal_type posScOrd = 1;
201 const ordinal_type posDfOrd = 2;
204 const ordinal_type card = this->basisCardinality_;
205 for (ordinal_type i=0;i<card;++i) {
216 this->setOrdinalTagData(this->tagToOrdinal_,
219 this->basisCardinality_,
Basis_HGRAD_LINE_Cn_FEM_JACOBI(const ordinal_type order, const double alpha=0, const double beta=0)
Constructor.
static KOKKOS_INLINE_FUNCTION void JacobiPolynomialDerivative(const ordinal_type np, const zViewType z, polydViewType polyd, const ordinal_type n, const double alpha, const double beta)
Calculate the derivative of Jacobi polynomials.
static KOKKOS_INLINE_FUNCTION void JacobiPolynomial(const ordinal_type np, const zViewType z, polyiViewType poly_in, polydViewType polyd, const ordinal_type n, const double alpha, const double beta)
Routine to calculate Jacobi polynomials, , and their first derivative, .
Kokkos::View< ordinal_type *, typename ExecutionSpace::array_layout, Kokkos::HostSpace > OrdinalTypeArray1DHost
View type for 1d host array.
static constexpr ordinal_type MaxOrder
The maximum reconstruction order.