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 const ordinal_type jend = output.extent(1);
164 const ordinal_type iend = output.extent(0);
166 for (ordinal_type j=0;j<jend;++j)
167 for (ordinal_type i=0;i<iend;++i)
168 output.access(i, j) = 0.0;
172 INTREPID2_TEST_FOR_ABORT( opType != OPERATOR_VALUE &&
173 opType != OPERATOR_GRAD &&
174 opType != OPERATOR_D2 &&
175 opType != OPERATOR_MAX,
176 ">>> ERROR: (Intrepid2::Basis_HGRAD_PYR_C1_FEM::Serial::getValues) operator is not supported");
181 template<
typename SpT,
182 typename outputValueValueType,
class ...outputValueProperties,
183 typename inputPointValueType,
class ...inputPointProperties>
185 Basis_HGRAD_PYR_C1_FEM::
186 getValues( Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
187 const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
188 const EOperator operatorType ) {
189 typedef Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValueViewType;
190 typedef Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPointViewType;
191 typedef typename ExecSpace<typename inputPointViewType::execution_space,SpT>::ExecSpaceType ExecSpaceType;
194 const auto loopSize = inputPoints.extent(0);
195 Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
197 switch (operatorType) {
199 case OPERATOR_VALUE: {
200 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_VALUE> FunctorType;
201 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
206 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_GRAD> FunctorType;
207 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
210 case OPERATOR_CURL: {
211 INTREPID2_TEST_FOR_EXCEPTION( operatorType == OPERATOR_CURL, std::invalid_argument,
212 ">>> ERROR (Basis_HGRAD_PYR_C1_FEM): CURL is invalid operator for rank-0 (scalar) functions in 3D");
216 INTREPID2_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_DIV), std::invalid_argument,
217 ">>> ERROR (Basis_HGRAD_PYR_C1_FEM): DIV is invalid operator for rank-0 (scalar) functions in 3D");
221 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_D2> FunctorType;
222 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
233 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_MAX> FunctorType;
234 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
238 INTREPID2_TEST_FOR_EXCEPTION( !( Intrepid2::isValidOperator(operatorType) ), std::invalid_argument,
239 ">>> ERROR (Basis_HGRAD_PYR_C1_FEM): Invalid operator type");
247 template<
typename SpT,
typename OT,
typename PT>
250 this->basisCardinality_ = 5;
251 this->basisDegree_ = 1;
252 this->basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Pyramid<5> >() );
253 this->basisType_ = BASIS_FEM_DEFAULT;
254 this->basisCoordinates_ = COORDINATES_CARTESIAN;
255 this->functionSpace_ = FUNCTION_SPACE_HGRAD;
260 const ordinal_type tagSize = 4;
261 const ordinal_type posScDim = 0;
262 const ordinal_type posScOrd = 1;
263 const ordinal_type posDfOrd = 2;
266 ordinal_type tags[20] = { 0, 0, 0, 1,
279 this->setOrdinalTagData(this->tagToOrdinal_,
282 this->basisCardinality_,
296 Kokkos::DynRankView<typename ScalarViewType::value_type,typename SpT::array_layout,Kokkos::HostSpace>
297 dofCoords(
"dofCoordsHost", this->basisCardinality_,this->basisCellTopology_.getDimension());
299 dofCoords(0,0) = -1.0; dofCoords(0,1) = -1.0; dofCoords(0,2) = 0.0;
300 dofCoords(1,0) = 1.0; dofCoords(1,1) = -1.0; dofCoords(1,2) = 0.0;
301 dofCoords(2,0) = 1.0; dofCoords(2,1) = 1.0; dofCoords(2,2) = 0.0;
302 dofCoords(3,0) = -1.0; dofCoords(3,1) = 1.0; dofCoords(3,2) = 0.0;
303 dofCoords(4,0) = 0.0; dofCoords(4,1) = 0.0; dofCoords(4,2) = 1.0;
305 this->dofCoords_ = Kokkos::create_mirror_view(
typename SpT::memory_space(), dofCoords);
306 Kokkos::deep_copy(this->dofCoords_, dofCoords);
Kokkos::View< ordinal_type *, typename ExecSpaceType::array_layout, Kokkos::HostSpace > OrdinalTypeArray1DHost
View type for 1d host array.
Basis_HGRAD_PYR_C1_FEM()
Constructor.