49 #ifndef __INTREPID2_HGRAD_HEX_C1_FEM_DEF_HPP__
50 #define __INTREPID2_HGRAD_HEX_C1_FEM_DEF_HPP__
57 template<EOperator opType>
58 template<
typename OutputViewType,
59 typename inputViewType>
60 KOKKOS_INLINE_FUNCTION
62 Basis_HGRAD_HEX_C1_FEM::Serial<opType>::
63 getValues( OutputViewType output,
64 const inputViewType input ) {
66 case OPERATOR_VALUE : {
67 const auto x = input(0);
68 const auto y = input(1);
69 const auto z = input(2);
72 output.access(0) = (1.0 - x)*(1.0 - y)*(1.0 - z)/8.0;
73 output.access(1) = (1.0 + x)*(1.0 - y)*(1.0 - z)/8.0;
74 output.access(2) = (1.0 + x)*(1.0 + y)*(1.0 - z)/8.0;
75 output.access(3) = (1.0 - x)*(1.0 + y)*(1.0 - z)/8.0;
77 output.access(4) = (1.0 - x)*(1.0 - y)*(1.0 + z)/8.0;
78 output.access(5) = (1.0 + x)*(1.0 - y)*(1.0 + z)/8.0;
79 output.access(6) = (1.0 + x)*(1.0 + y)*(1.0 + z)/8.0;
80 output.access(7) = (1.0 - x)*(1.0 + y)*(1.0 + z)/8.0;
83 case OPERATOR_GRAD : {
84 const auto x = input(0);
85 const auto y = input(1);
86 const auto z = input(2);
89 output.access(0, 0) = -(1.0 - y)*(1.0 - z)/8.0;
90 output.access(0, 1) = -(1.0 - x)*(1.0 - z)/8.0;
91 output.access(0, 2) = -(1.0 - x)*(1.0 - y)/8.0;
93 output.access(1, 0) = (1.0 - y)*(1.0 - z)/8.0;
94 output.access(1, 1) = -(1.0 + x)*(1.0 - z)/8.0;
95 output.access(1, 2) = -(1.0 + x)*(1.0 - y)/8.0;
97 output.access(2, 0) = (1.0 + y)*(1.0 - z)/8.0;
98 output.access(2, 1) = (1.0 + x)*(1.0 - z)/8.0;
99 output.access(2, 2) = -(1.0 + x)*(1.0 + y)/8.0;
101 output.access(3, 0) = -(1.0 + y)*(1.0 - z)/8.0;
102 output.access(3, 1) = (1.0 - x)*(1.0 - z)/8.0;
103 output.access(3, 2) = -(1.0 - x)*(1.0 + y)/8.0;
105 output.access(4, 0) = -(1.0 - y)*(1.0 + z)/8.0;
106 output.access(4, 1) = -(1.0 - x)*(1.0 + z)/8.0;
107 output.access(4, 2) = (1.0 - x)*(1.0 - y)/8.0;
109 output.access(5, 0) = (1.0 - y)*(1.0 + z)/8.0;
110 output.access(5, 1) = -(1.0 + x)*(1.0 + z)/8.0;
111 output.access(5, 2) = (1.0 + x)*(1.0 - y)/8.0;
113 output.access(6, 0) = (1.0 + y)*(1.0 + z)/8.0;
114 output.access(6, 1) = (1.0 + x)*(1.0 + z)/8.0;
115 output.access(6, 2) = (1.0 + x)*(1.0 + y)/8.0;
117 output.access(7, 0) = -(1.0 + y)*(1.0 + z)/8.0;
118 output.access(7, 1) = (1.0 - x)*(1.0 + z)/8.0;
119 output.access(7, 2) = (1.0 - x)*(1.0 + y)/8.0;
123 const auto x = input(0);
124 const auto y = input(1);
125 const auto z = input(2);
128 output.access(0, 0) = 0.0;
129 output.access(0, 1) = (1.0 - z)/8.0;
130 output.access(0, 2) = (1.0 - y)/8.0;
131 output.access(0, 3) = 0.0;
132 output.access(0, 4) = (1.0 - x)/8.0;
133 output.access(0, 5) = 0.0;
135 output.access(1, 0) = 0.0;
136 output.access(1, 1) = -(1.0 - z)/8.0;
137 output.access(1, 2) = -(1.0 - y)/8.0;
138 output.access(1, 3) = 0.0;
139 output.access(1, 4) = (1.0 + x)/8.0;
140 output.access(1, 5) = 0.0;
142 output.access(2, 0) = 0.0;
143 output.access(2, 1) = (1.0 - z)/8.0;
144 output.access(2, 2) = -(1.0 + y)/8.0;
145 output.access(2, 3) = 0.0;
146 output.access(2, 4) = -(1.0 + x)/8.0;
147 output.access(2, 5) = 0.0;
149 output.access(3, 0) = 0.0;
150 output.access(3, 1) = -(1.0 - z)/8.0;
151 output.access(3, 2) = (1.0 + y)/8.0;
152 output.access(3, 3) = 0.0;
153 output.access(3, 4) = -(1.0 - x)/8.0;
154 output.access(3, 5) = 0.0;
157 output.access(4, 0) = 0.0;
158 output.access(4, 1) = (1.0 + z)/8.0;
159 output.access(4, 2) = -(1.0 - y)/8.0;
160 output.access(4, 3) = 0.0;
161 output.access(4, 4) = -(1.0 - x)/8.0;
162 output.access(4, 5) = 0.0;
164 output.access(5, 0) = 0.0;
165 output.access(5, 1) = -(1.0 + z)/8.0;
166 output.access(5, 2) = (1.0 - y)/8.0;
167 output.access(5, 3) = 0.0;
168 output.access(5, 4) = -(1.0 + x)/8.0;
169 output.access(5, 5) = 0.0;
171 output.access(6, 0) = 0.0;
172 output.access(6, 1) = (1.0 + z)/8.0;
173 output.access(6, 2) = (1.0 + y)/8.0;
174 output.access(6, 3) = 0.0;
175 output.access(6, 4) = (1.0 + x)/8.0;
176 output.access(6, 5) = 0.0;
178 output.access(7, 0) = 0.0;
179 output.access(7, 1) = -(1.0 + z)/8.0;
180 output.access(7, 2) = -(1.0 + y)/8.0;
181 output.access(7, 3) = 0.0;
182 output.access(7, 4) = (1.0 - x)/8.0;
183 output.access(7, 5) = 0.0;
190 output.access(0, 0) = 0.0;
191 output.access(0, 1) = 0.0;
192 output.access(0, 2) = 0.0;
193 output.access(0, 3) = 0.0;
194 output.access(0, 4) = -1.0/8.0;
195 output.access(0, 5) = 0.0;
196 output.access(0, 6) = 0.0;
197 output.access(0, 7) = 0.0;
198 output.access(0, 8) = 0.0;
199 output.access(0, 9) = 0.0;
202 output.access(1, 0) = 0.0;
203 output.access(1, 1) = 0.0;
204 output.access(1, 2) = 0.0;
205 output.access(1, 3) = 0.0;
206 output.access(1, 4) = 1.0/8.0;
207 output.access(1, 5) = 0.0;
208 output.access(1, 6) = 0.0;
209 output.access(1, 7) = 0.0;
210 output.access(1, 8) = 0.0;
211 output.access(1, 9) = 0.0;
214 output.access(2, 0) = 0.0;
215 output.access(2, 1) = 0.0;
216 output.access(2, 2) = 0.0;
217 output.access(2, 3) = 0.0;
218 output.access(2, 4) = -1.0/8.0;
219 output.access(2, 5) = 0.0;
220 output.access(2, 6) = 0.0;
221 output.access(2, 7) = 0.0;
222 output.access(2, 8) = 0.0;
223 output.access(2, 9) = 0.0;
226 output.access(3, 0) = 0.0;
227 output.access(3, 1) = 0.0;
228 output.access(3, 2) = 0.0;
229 output.access(3, 3) = 0.0;
230 output.access(3, 4) = 1.0/8.0;
231 output.access(3, 5) = 0.0;
232 output.access(3, 6) = 0.0;
233 output.access(3, 7) = 0.0;
234 output.access(3, 8) = 0.0;
235 output.access(3, 9) = 0.0;
238 output.access(4, 0) = 0.0;
239 output.access(4, 1) = 0.0;
240 output.access(4, 2) = 0.0;
241 output.access(4, 3) = 0.0;
242 output.access(4, 4) = 1.0/8.0;
243 output.access(4, 5) = 0.0;
244 output.access(4, 6) = 0.0;
245 output.access(4, 7) = 0.0;
246 output.access(4, 8) = 0.0;
247 output.access(4, 9) = 0.0;
250 output.access(5, 0) = 0.0;
251 output.access(5, 1) = 0.0;
252 output.access(5, 2) = 0.0;
253 output.access(5, 3) = 0.0;
254 output.access(5, 4) = -1.0/8.0;
255 output.access(5, 5) = 0.0;
256 output.access(5, 6) = 0.0;
257 output.access(5, 7) = 0.0;
258 output.access(5, 8) = 0.0;
259 output.access(5, 9) = 0.0;
262 output.access(6, 0) = 0.0;
263 output.access(6, 1) = 0.0;
264 output.access(6, 2) = 0.0;
265 output.access(6, 3) = 0.0;
266 output.access(6, 4) = 1.0/8.0;
267 output.access(6, 5) = 0.0;
268 output.access(6, 6) = 0.0;
269 output.access(6, 7) = 0.0;
270 output.access(6, 8) = 0.0;
271 output.access(6, 9) = 0.0;
274 output.access(7, 0) = 0.0;
275 output.access(7, 1) = 0.0;
276 output.access(7, 2) = 0.0;
277 output.access(7, 3) = 0.0;
278 output.access(7, 4) = -1.0/8.0;
279 output.access(7, 5) = 0.0;
280 output.access(7, 6) = 0.0;
281 output.access(7, 7) = 0.0;
282 output.access(7, 8) = 0.0;
283 output.access(7, 9) = 0.0;
287 case OPERATOR_MAX : {
288 const ordinal_type jend = output.extent(1);
289 const ordinal_type iend = output.extent(0);
291 for (ordinal_type j=0;j<jend;++j)
292 for (ordinal_type i=0;i<iend;++i)
293 output.access(i, j) = 0.0;
297 INTREPID2_TEST_FOR_ABORT( opType != OPERATOR_VALUE &&
298 opType != OPERATOR_GRAD &&
299 opType != OPERATOR_CURL &&
300 opType != OPERATOR_D2 &&
301 opType != OPERATOR_MAX,
302 ">>> ERROR: (Intrepid2::Basis_HGRAD_HEX_C1_FEM::Serial::getValues) operator is not supported");
308 template<
typename SpT,
309 typename outputValueValueType,
class ...outputValueProperties,
310 typename inputPointValueType,
class ...inputPointProperties>
312 Basis_HGRAD_HEX_C1_FEM::
313 getValues( Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
314 const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
315 const EOperator operatorType ) {
316 typedef Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValueViewType;
317 typedef Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPointViewType;
318 typedef typename ExecSpace<typename inputPointViewType::execution_space,SpT>::ExecSpaceType ExecSpaceType;
321 const auto loopSize = inputPoints.extent(0);
322 Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
324 switch (operatorType) {
326 case OPERATOR_VALUE: {
327 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_VALUE> FunctorType;
328 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
333 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_GRAD> FunctorType;
334 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
337 case OPERATOR_CURL: {
338 INTREPID2_TEST_FOR_EXCEPTION( operatorType == OPERATOR_CURL, std::invalid_argument,
339 ">>> ERROR (Basis_HGRAD_HEX_C1_FEM): CURL is invalid operator for rank-0 (scalar) functions in 3D");
344 INTREPID2_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_DIV), std::invalid_argument,
345 ">>> ERROR (Basis_HGRAD_HEX_C1_FEM): DIV is invalid operator for rank-0 (scalar) functions in 3D");
350 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_D2> FunctorType;
351 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
355 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_D3> FunctorType;
356 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
366 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_MAX> FunctorType;
367 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
371 INTREPID2_TEST_FOR_EXCEPTION( !( Intrepid2::isValidOperator(operatorType) ), std::invalid_argument,
372 ">>> ERROR (Basis_HGRAD_HEX_C1_FEM): Invalid operator type");
380 template<
typename SpT,
typename OT,
typename PT>
383 this->basisCardinality_ = 8;
384 this->basisDegree_ = 1;
385 this->basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Hexahedron<8> >() );
386 this->basisType_ = BASIS_FEM_DEFAULT;
387 this->basisCoordinates_ = COORDINATES_CARTESIAN;
388 this->functionSpace_ = FUNCTION_SPACE_HGRAD;
393 const ordinal_type tagSize = 4;
394 const ordinal_type posScDim = 0;
395 const ordinal_type posScOrd = 1;
396 const ordinal_type posDfOrd = 2;
399 ordinal_type tags[32] = { 0, 0, 0, 1,
414 this->setOrdinalTagData(this->tagToOrdinal_,
417 this->basisCardinality_,
431 Kokkos::DynRankView<typename ScalarViewType::value_type,typename SpT::array_layout,Kokkos::HostSpace>
432 dofCoords(
"dofCoordsHost", this->basisCardinality_,this->basisCellTopology_.getDimension());
434 dofCoords(0,0) = -1.0; dofCoords(0,1) = -1.0; dofCoords(0,2) = -1.0;
435 dofCoords(1,0) = 1.0; dofCoords(1,1) = -1.0; dofCoords(1,2) = -1.0;
436 dofCoords(2,0) = 1.0; dofCoords(2,1) = 1.0; dofCoords(2,2) = -1.0;
437 dofCoords(3,0) = -1.0; dofCoords(3,1) = 1.0; dofCoords(3,2) = -1.0;
438 dofCoords(4,0) = -1.0; dofCoords(4,1) = -1.0; dofCoords(4,2) = 1.0;
439 dofCoords(5,0) = 1.0; dofCoords(5,1) = -1.0; dofCoords(5,2) = 1.0;
440 dofCoords(6,0) = 1.0; dofCoords(6,1) = 1.0; dofCoords(6,2) = 1.0;
441 dofCoords(7,0) = -1.0; dofCoords(7,1) = 1.0; dofCoords(7,2) = 1.0;
443 this->dofCoords_ = Kokkos::create_mirror_view(
typename SpT::memory_space(), dofCoords);
444 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_HEX_C1_FEM()
Constructor.