49 #ifndef __INTREPID2_HGRAD_TRI_C2_FEM_DEF_HPP__
50 #define __INTREPID2_HGRAD_TRI_C2_FEM_DEF_HPP__
58 template<EOperator opType>
59 template<
typename outputViewType,
60 typename inputViewType>
61 KOKKOS_INLINE_FUNCTION
63 Basis_HGRAD_TRI_C2_FEM::Serial<opType>::
64 getValues( outputViewType output,
65 const inputViewType input ) {
67 case OPERATOR_VALUE: {
68 const auto x = input(0);
69 const auto y = input(1);
72 output.access(0) = (x + y - 1.0)*(2.0*x + 2.0*y - 1.0);
73 output.access(1) = x*(2.0*x - 1.0);
74 output.access(2) = y*(2.0*y - 1.0);
75 output.access(3) = -4.0*x*(x + y - 1.0);
76 output.access(4) = 4.0*x*y;
77 output.access(5) = -4.0*y*(x + y - 1.0);
82 const auto x = input(0);
83 const auto y = input(1);
85 output.access(0, 0) = 4.0*x + 4.0*y - 3.0;
86 output.access(0, 1) = 4.0*x + 4.0*y - 3.0;
88 output.access(1, 0) = 4.0*x - 1.0;
89 output.access(1, 1) = 0.0;
91 output.access(2, 0) = 0.0;
92 output.access(2, 1) = 4.0*y - 1.0;
94 output.access(3, 0) = -4.0*(2.0*x + y - 1.0);
95 output.access(3, 1) = -4.0*x;
97 output.access(4, 0) = 4.0*y;
98 output.access(4, 1) = 4.0*x;
100 output.access(5, 0) = -4.0*y;
101 output.access(5, 1) = -4.0*(x + 2.0*y - 1.0);
104 case OPERATOR_CURL: {
105 const auto x = input(0);
106 const auto y = input(1);
108 output.access(0, 1) =-(4.0*x + 4.0*y - 3.0);
109 output.access(0, 0) = 4.0*x + 4.0*y - 3.0;
111 output.access(1, 1) =-(4.0*x - 1.0);
112 output.access(1, 0) = 0.0;
114 output.access(2, 1) = 0.0;
115 output.access(2, 0) = 4.0*y - 1.0;
117 output.access(3, 1) = 4.0*(2.0*x + y - 1.0);
118 output.access(3, 0) = -4.0*x;
120 output.access(4, 1) = -4.0*y;
121 output.access(4, 0) = 4.0*x;
123 output.access(5, 1) = 4.0*y;
124 output.access(5, 0) = -4.0*(x + 2.0*y - 1.0);
130 output.access(0, 0) = 4.0;
131 output.access(1, 0) = 4.0;
132 output.access(2, 0) = 0.0;
133 output.access(3, 0) =-8.0;
134 output.access(4, 0) = 0.0;
135 output.access(5, 0) = 0.0;
138 output.access(0, 1) = 4.0;
139 output.access(1, 1) = 0.0;
140 output.access(2, 1) = 0.0;
141 output.access(3, 1) =-4.0;
142 output.access(4, 1) = 4.0;
143 output.access(5, 1) =-4.0;
146 output.access(0, 2) = 4.0;
147 output.access(1, 2) = 0.0;
148 output.access(2, 2) = 4.0;
149 output.access(3, 2) = 0.0;
150 output.access(4, 2) = 0.0;
151 output.access(5, 2) =-8.0;
155 const ordinal_type jend = output.extent(1);
156 const ordinal_type iend = output.extent(0);
158 for (ordinal_type j=0;j<jend;++j)
159 for (ordinal_type i=0;i<iend;++i)
160 output.access(i, j) = 0.0;
164 INTREPID2_TEST_FOR_ABORT( opType != OPERATOR_VALUE &&
165 opType != OPERATOR_GRAD &&
166 opType != OPERATOR_CURL &&
167 opType != OPERATOR_D1 &&
168 opType != OPERATOR_D2 &&
169 opType != OPERATOR_MAX,
170 ">>> ERROR: (Intrepid2::Basis_HGRAD_TRI_C2_FEM::Serial::getValues) operator is not supported");
175 template<
typename SpT,
176 typename outputValueValueType,
class ...outputValueProperties,
177 typename inputPointValueType,
class ...inputPointProperties>
179 Basis_HGRAD_TRI_C2_FEM::
180 getValues( Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
181 const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
182 const EOperator operatorType ) {
183 typedef Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValueViewType;
184 typedef Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPointViewType;
185 typedef typename ExecSpace<typename inputPointViewType::execution_space,SpT>::ExecSpaceType ExecSpaceType;
188 const auto loopSize = inputPoints.extent(0);
189 Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
191 switch (operatorType) {
193 case OPERATOR_VALUE: {
194 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_VALUE> FunctorType;
195 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
200 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_GRAD> FunctorType;
201 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
204 case OPERATOR_CURL: {
205 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_CURL> FunctorType;
206 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
210 INTREPID2_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_DIV), std::invalid_argument,
211 ">>> ERROR (Basis_HGRAD_TRI_C2_FEM): DIV is invalid operator for rank-0 (scalar) fields in 2D.");
215 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_D2> FunctorType;
216 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
227 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_MAX> FunctorType;
228 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
232 INTREPID2_TEST_FOR_EXCEPTION( !( Intrepid2::isValidOperator(operatorType) ), std::invalid_argument,
233 ">>> ERROR (Basis_HGRAD_TRI_C2_FEM): Invalid operator type");
242 template<
typename SpT,
typename OT,
typename PT>
245 this->basisCardinality_ = 6;
246 this->basisDegree_ = 2;
247 this->basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Triangle<3> >() );
248 this->basisType_ = BASIS_FEM_DEFAULT;
249 this->basisCoordinates_ = COORDINATES_CARTESIAN;
254 const ordinal_type tagSize = 4;
255 const ordinal_type posScDim = 0;
256 const ordinal_type posScOrd = 1;
257 const ordinal_type posDfOrd = 2;
260 ordinal_type tags[24] = { 0, 0, 0, 1,
271 this->setOrdinalTagData(this->tagToOrdinal_,
274 this->basisCardinality_,
282 Kokkos::DynRankView<typename scalarViewType::value_type,typename SpT::array_layout,Kokkos::HostSpace>
283 dofCoords(
"dofCoordsHost", this->basisCardinality_,this->basisCellTopology_.getDimension());
285 dofCoords(0,0) = 0.0; dofCoords(0,1) = 0.0;
286 dofCoords(1,0) = 1.0; dofCoords(1,1) = 0.0;
287 dofCoords(2,0) = 0.0; dofCoords(2,1) = 1.0;
288 dofCoords(3,0) = 0.5; dofCoords(3,1) = 0.0;
289 dofCoords(4,0) = 0.5; dofCoords(4,1) = 0.5;
290 dofCoords(5,0) = 0.0; dofCoords(5,1) = 0.5;
292 this->dofCoords_ = Kokkos::create_mirror_view(
typename SpT::memory_space(), dofCoords);
293 Kokkos::deep_copy(this->dofCoords_, dofCoords);
Kokkos::View< ordinal_type *,typename ExecSpaceType::array_layout, Kokkos::HostSpace > ordinal_type_array_1d_host
View type for 1d host array.
Basis_HGRAD_TRI_C2_FEM()
Constructor.