49 #ifndef __INTREPID2_HGRAD_PYR_C1_FEM_DEF_HPP__
50 #define __INTREPID2_HGRAD_PYR_C1_FEM_DEF_HPP__
58 template<EOperator opType>
59 template<
typename OutputViewType,
60 typename inputViewType>
61 KOKKOS_INLINE_FUNCTION
63 Basis_HGRAD_PYR_C1_FEM::Serial<opType>::
64 getValues( OutputViewType output,
65 const inputViewType input ) {
66 const auto eps = epsilon();
68 static_assert(std::is_same<
69 typename OutputViewType::value_type,
70 typename inputViewType::value_type>::value,
"Input/output view has different value types");
72 typedef typename OutputViewType::value_type value_type;
74 const value_type x = input(0);
75 const value_type y = input(1);
76 const value_type ztmp = input(2);
79 const value_type z = ( (value_type(1.0) - ztmp) < value_type(eps) ? value_type(1.0 - eps) : ztmp );
83 case OPERATOR_VALUE: {
84 const value_type factor = 0.25/(1.0 - z);
87 output.access(0) = (1.0 - x - z) * (1.0 - y - z) * factor;
88 output.access(1) = (1.0 + x - z) * (1.0 - y - z) * factor;
89 output.access(2) = (1.0 + x - z) * (1.0 + y - z) * factor;
90 output.access(3) = (1.0 - x - z) * (1.0 + y - z) * factor;
95 const value_type factor = 0.25/(1.0 - z);
96 const value_type factor2 = 4.0 * factor * factor;
99 output.access(0, 0) = (y + z - 1.0) * factor;
100 output.access(0, 1) = (x + z - 1.0) * factor;
101 output.access(0, 2) = x * y * factor2 - 0.25;
103 output.access(1, 0) = (1.0 - y - z) * factor;
104 output.access(1, 1) = (z - x - 1.0) * factor;
105 output.access(1, 2) = - x*y * factor2 - 0.25;
107 output.access(2, 0) = (1.0 + y - z) * factor;
108 output.access(2, 1) = (1.0 + x - z) * factor;
109 output.access(2, 2) = x * y * factor2 - 0.25;
111 output.access(3, 0) = (z - y - 1.0) * factor;
112 output.access(3, 1) = (1.0 - x - z) * factor;
113 output.access(3, 2) = - x*y * factor2 - 0.25;
115 output.access(4, 0) = 0.0;
116 output.access(4, 1) = 0.0;
117 output.access(4, 2) = 1;
121 const value_type factor = 0.25/(1.0 - z);
122 const value_type factor2 = 4.0 * factor * factor;
123 const value_type factor3 = 8.0 * factor * factor2;
126 output.access(0, 0) = 0.0;
127 output.access(0, 1) = factor;
128 output.access(0, 2) = y*factor2;
129 output.access(0, 3) = 0.0;
130 output.access(0, 4) = x*factor2;
131 output.access(0, 5) = x*y*factor3;
133 output.access(1, 0) = 0.0;
134 output.access(1, 1) = -factor;
135 output.access(1, 2) = -y*factor2;
136 output.access(1, 3) = 0.0;
137 output.access(1, 4) = -x*factor2;
138 output.access(1, 5) = -x*y*factor3;
140 output.access(2, 0) = 0.0;
141 output.access(2, 1) = factor;
142 output.access(2, 2) = y*factor2;
143 output.access(2, 3) = 0.0;
144 output.access(2, 4) = x*factor2;
145 output.access(2, 5) = x*y*factor3;
147 output.access(3, 0) = 0.0;
148 output.access(3, 1) = -factor;
149 output.access(3, 2) = -y*factor2;
150 output.access(3, 3) = 0.0;
151 output.access(3, 4) = -x*factor2;
152 output.access(3, 5) = -x*y*factor3;
154 output.access(4, 0) = 0.0;
155 output.access(4, 1) = 0.0;
156 output.access(4, 2) = 0.0;
157 output.access(4, 3) = 0.0;
158 output.access(4, 4) = 0.0;
159 output.access(4, 5) = 0.0;
163 INTREPID2_TEST_FOR_ABORT( opType != OPERATOR_VALUE &&
164 opType != OPERATOR_GRAD &&
165 opType != OPERATOR_D2,
166 ">>> ERROR: (Intrepid2::Basis_HGRAD_PYR_C1_FEM::Serial::getValues) operator is not supported");
171 template<
typename DT,
172 typename outputValueValueType,
class ...outputValueProperties,
173 typename inputPointValueType,
class ...inputPointProperties>
175 Basis_HGRAD_PYR_C1_FEM::
176 getValues( Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
177 const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
178 const EOperator operatorType ) {
179 typedef Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValueViewType;
180 typedef Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPointViewType;
181 typedef typename ExecSpace<typename inputPointViewType::execution_space,typename DT::execution_space>::ExecSpaceType ExecSpaceType;
184 const auto loopSize = inputPoints.extent(0);
185 Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
187 switch (operatorType) {
189 case OPERATOR_VALUE: {
190 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_VALUE> FunctorType;
191 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
196 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_GRAD> FunctorType;
197 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
200 case OPERATOR_CURL: {
201 INTREPID2_TEST_FOR_EXCEPTION( operatorType == OPERATOR_CURL, std::invalid_argument,
202 ">>> ERROR (Basis_HGRAD_PYR_C1_FEM): CURL is invalid operator for rank-0 (scalar) functions in 3D");
206 INTREPID2_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_DIV), std::invalid_argument,
207 ">>> ERROR (Basis_HGRAD_PYR_C1_FEM): DIV is invalid operator for rank-0 (scalar) functions in 3D");
211 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_D2> FunctorType;
212 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
223 INTREPID2_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
224 ">>> ERROR (Basis_HGRAD_PYR_C1_FEM): Operator not implemented yet");
228 INTREPID2_TEST_FOR_EXCEPTION( !( Intrepid2::isValidOperator(operatorType) ), std::invalid_argument,
229 ">>> ERROR (Basis_HGRAD_PYR_C1_FEM): Invalid operator type");
237 template<
typename DT,
typename OT,
typename PT>
240 this->basisCardinality_ = 5;
241 this->basisDegree_ = 1;
242 this->basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Pyramid<5> >() );
243 this->basisType_ = BASIS_FEM_DEFAULT;
244 this->basisCoordinates_ = COORDINATES_CARTESIAN;
245 this->functionSpace_ = FUNCTION_SPACE_HGRAD;
250 const ordinal_type tagSize = 4;
251 const ordinal_type posScDim = 0;
252 const ordinal_type posScOrd = 1;
253 const ordinal_type posDfOrd = 2;
256 ordinal_type tags[20] = { 0, 0, 0, 1,
264 OrdinalTypeArray1DHost tagView(&tags[0], 20);
267 this->setOrdinalTagData(this->tagToOrdinal_,
270 this->basisCardinality_,
278 Kokkos::DynRankView<typename ScalarViewType::value_type,typename DT::execution_space::array_layout,Kokkos::HostSpace>
279 dofCoords(
"dofCoordsHost", this->basisCardinality_,this->basisCellTopology_.getDimension());
281 dofCoords(0,0) = -1.0; dofCoords(0,1) = -1.0; dofCoords(0,2) = 0.0;
282 dofCoords(1,0) = 1.0; dofCoords(1,1) = -1.0; dofCoords(1,2) = 0.0;
283 dofCoords(2,0) = 1.0; dofCoords(2,1) = 1.0; dofCoords(2,2) = 0.0;
284 dofCoords(3,0) = -1.0; dofCoords(3,1) = 1.0; dofCoords(3,2) = 0.0;
285 dofCoords(4,0) = 0.0; dofCoords(4,1) = 0.0; dofCoords(4,2) = 1.0;
287 this->dofCoords_ = Kokkos::create_mirror_view(
typename DT::memory_space(), dofCoords);
288 Kokkos::deep_copy(this->dofCoords_, dofCoords);
Basis_HGRAD_PYR_C1_FEM()
Constructor.