16 #ifndef __INTREPID2_HDIV_HEX_I1_FEM_DEF_HPP__
17 #define __INTREPID2_HDIV_HEX_I1_FEM_DEF_HPP__
24 template<EOperator opType>
25 template<
typename OutputViewType,
26 typename inputViewType>
27 KOKKOS_INLINE_FUNCTION
29 Basis_HDIV_HEX_I1_FEM::Serial<opType>::
30 getValues( OutputViewType output,
31 const inputViewType input ) {
33 case OPERATOR_VALUE : {
34 const auto x = input(0);
35 const auto y = input(1);
36 const auto z = input(2);
39 output.access(0, 0) = 0.0;
40 output.access(0, 1) = (y - 1.0)/2.0;
41 output.access(0, 2) = 0.0;
43 output.access(1, 0) = (1.0 + x)/2.0;
44 output.access(1, 1) = 0.0;
45 output.access(1, 2) = 0.0;
47 output.access(2, 0) = 0.0;
48 output.access(2, 1) = (1.0 + y)/2.0;
49 output.access(2, 2) = 0.0;
51 output.access(3, 0) = (x - 1.0)/2.0;
52 output.access(3, 1) = 0.0;
53 output.access(3, 2) = 0.0;
55 output.access(4, 0) = 0.0;
56 output.access(4, 1) = 0.0;
57 output.access(4, 2) = (z - 1.0)/2.0;
59 output.access(5, 0) = 0.0;
60 output.access(5, 1) = 0.0;
61 output.access(5, 2) = (1.0 + z)/2.0;
68 output.access(0) = 0.5;
69 output.access(1) = 0.5;
70 output.access(2) = 0.5;
71 output.access(3) = 0.5;
72 output.access(4) = 0.5;
73 output.access(5) = 0.5;
77 INTREPID2_TEST_FOR_ABORT( opType != OPERATOR_VALUE &&
78 opType != OPERATOR_DIV,
79 ">>> ERROR: (Intrepid2::Basis_HDIV_HEX_I1_FEM::Serial::getValues) operator is not supported");
85 typename outputValueValueType,
class ...outputValueProperties,
86 typename inputPointValueType,
class ...inputPointProperties>
88 Basis_HDIV_HEX_I1_FEM::
89 getValues( Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
90 const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
91 const EOperator operatorType ) {
92 typedef Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValueViewType;
93 typedef Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPointViewType;
94 typedef typename ExecSpace<typename inputPointViewType::execution_space,typename DT::execution_space>::ExecSpaceType ExecSpaceType;
97 const auto loopSize = inputPoints.extent(0);
98 Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
100 switch (operatorType) {
102 case OPERATOR_VALUE: {
103 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_VALUE> FunctorType;
104 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
108 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_DIV> FunctorType;
109 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
112 case OPERATOR_CURL: {
113 INTREPID2_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_CURL), std::invalid_argument,
114 ">>> ERROR (Basis_HDIV_HEX_I1_FEM::getValues): CURL is invalid operator for HDIV Basis Functions");
117 case OPERATOR_GRAD: {
118 INTREPID2_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_GRAD), std::invalid_argument,
119 ">>> ERROR (Basis_HDIV_HEX_I1_FEM::getValues): GRAD is invalid operator for HDIV Basis Functions");
132 INTREPID2_TEST_FOR_EXCEPTION( ( (operatorType == OPERATOR_D1) ||
133 (operatorType == OPERATOR_D2) ||
134 (operatorType == OPERATOR_D3) ||
135 (operatorType == OPERATOR_D4) ||
136 (operatorType == OPERATOR_D5) ||
137 (operatorType == OPERATOR_D6) ||
138 (operatorType == OPERATOR_D7) ||
139 (operatorType == OPERATOR_D8) ||
140 (operatorType == OPERATOR_D9) ||
141 (operatorType == OPERATOR_D10) ),
142 std::invalid_argument,
143 ">>> ERROR (Basis_HDIV_HEX_I1_FEM::getValues): Invalid operator type");
147 INTREPID2_TEST_FOR_EXCEPTION( ( (operatorType != OPERATOR_VALUE) &&
148 (operatorType != OPERATOR_GRAD) &&
149 (operatorType != OPERATOR_CURL) &&
150 (operatorType != OPERATOR_DIV) &&
151 (operatorType != OPERATOR_D1) &&
152 (operatorType != OPERATOR_D2) &&
153 (operatorType != OPERATOR_D3) &&
154 (operatorType != OPERATOR_D4) &&
155 (operatorType != OPERATOR_D5) &&
156 (operatorType != OPERATOR_D6) &&
157 (operatorType != OPERATOR_D7) &&
158 (operatorType != OPERATOR_D8) &&
159 (operatorType != OPERATOR_D9) &&
160 (operatorType != OPERATOR_D10) ),
161 std::invalid_argument,
162 ">>> ERROR (Basis_HDIV_HEX_I1_FEM::getValues): Invalid operator type");
168 template<
typename DT,
typename OT,
typename PT>
171 const ordinal_type spaceDim = 3;
172 this->basisCardinality_ = 6;
173 this->basisDegree_ = 1;
174 this->basisCellTopologyKey_ = shards::Hexahedron<8>::key;
175 this->basisType_ = BASIS_FEM_DEFAULT;
176 this->basisCoordinates_ = COORDINATES_CARTESIAN;
177 this->functionSpace_ = FUNCTION_SPACE_HDIV;
182 const ordinal_type tagSize = 4;
183 const ordinal_type posScDim = 0;
184 const ordinal_type posScOrd = 1;
185 const ordinal_type posDfOrd = 2;
188 ordinal_type tags[24] = { 2, 0, 0, 1,
196 OrdinalTypeArray1DHost tagView(&tags[0], 24);
199 this->setOrdinalTagData(this->tagToOrdinal_,
202 this->basisCardinality_,
209 Kokkos::DynRankView<typename ScalarViewType::value_type,typename DT::execution_space::array_layout,Kokkos::HostSpace>
210 dofCoords(
"dofCoordsHost", this->basisCardinality_,spaceDim);
212 dofCoords(0,0) = 0.0; dofCoords(0,1) = -1.0; dofCoords(0,2) = 0.0;
213 dofCoords(1,0) = 1.0; dofCoords(1,1) = 0.0; dofCoords(1,2) = 0.0;
214 dofCoords(2,0) = 0.0; dofCoords(2,1) = 1.0; dofCoords(2,2) = 0.0;
215 dofCoords(3,0) = -1.0; dofCoords(3,1) = 0.0; dofCoords(3,2) = 0.0;
216 dofCoords(4,0) = 0.0; dofCoords(4,1) = 0.0; dofCoords(4,2) = -1.0;
217 dofCoords(5,0) = 0.0; dofCoords(5,1) = 0.0; dofCoords(5,2) = 1.0;
219 this->dofCoords_ = Kokkos::create_mirror_view(
typename DT::memory_space(), dofCoords);
220 Kokkos::deep_copy(this->dofCoords_, dofCoords);
223 Kokkos::DynRankView<typename ScalarViewType::value_type,typename DT::execution_space::array_layout,Kokkos::HostSpace>
224 dofCoeffs(
"dofCoeffsHost", this->basisCardinality_,spaceDim);
227 dofCoeffs(0,0) = 0.0; dofCoeffs(0,1) = -1.0; dofCoeffs(0,2) = 0.0;
228 dofCoeffs(1,0) = 1.0; dofCoeffs(1,1) = 0.0; dofCoeffs(1,2) = 0.0;
229 dofCoeffs(2,0) = 0.0; dofCoeffs(2,1) = 1.0; dofCoeffs(2,2) = 0.0;
230 dofCoeffs(3,0) = -1.0; dofCoeffs(3,1) = 0.0; dofCoeffs(3,2) = 0.0;
231 dofCoeffs(4,0) = 0.0; dofCoeffs(4,1) = 0.0; dofCoeffs(4,2) = -1.0;
232 dofCoeffs(5,0) = 0.0; dofCoeffs(5,1) = 0.0; dofCoeffs(5,2) = 1.0;
234 this->dofCoeffs_ = Kokkos::create_mirror_view(
typename DT::memory_space(), dofCoeffs);
235 Kokkos::deep_copy(this->dofCoeffs_, dofCoeffs);
239 template<
typename DT,
typename OT,
typename PT>
242 ordinal_type& perTeamSpaceSize,
243 ordinal_type& perThreadSpaceSize,
244 const PointViewType inputPoints,
245 const EOperator operatorType)
const {
246 perTeamSpaceSize = 0;
247 perThreadSpaceSize = 0;
250 template<
typename DT,
typename OT,
typename PT>
251 KOKKOS_INLINE_FUNCTION
253 Basis_HDIV_HEX_I1_FEM<DT,OT,PT>::getValues(
254 OutputViewType outputValues,
255 const PointViewType inputPoints,
256 const EOperator operatorType,
257 const typename Kokkos::TeamPolicy<typename DT::execution_space>::member_type& team_member,
258 const typename DT::execution_space::scratch_memory_space & scratchStorage,
259 const ordinal_type subcellDim,
260 const ordinal_type subcellOrdinal)
const {
262 INTREPID2_TEST_FOR_ABORT( !((subcellDim == -1) && (subcellOrdinal == -1)),
263 ">>> ERROR: (Intrepid2::Basis_HDIV_HEX_I1_FEM::getValues), The capability of selecting subsets of basis functions has not been implemented yet.");
265 (void) scratchStorage;
267 const int numPoints = inputPoints.extent(0);
269 switch(operatorType) {
271 Kokkos::parallel_for (Kokkos::TeamThreadRange (team_member, numPoints), [=] (ordinal_type& pt) {
272 auto output = Kokkos::subview( outputValues, Kokkos::ALL(), pt, Kokkos::ALL() );
273 const auto input = Kokkos::subview( inputPoints, pt, Kokkos::ALL() );
274 Impl::Basis_HDIV_HEX_I1_FEM::Serial<OPERATOR_VALUE>::getValues( output, input);
278 Kokkos::parallel_for (Kokkos::TeamThreadRange (team_member, numPoints), [=] (ordinal_type& pt) {
279 auto output = Kokkos::subview( outputValues, Kokkos::ALL(), pt, Kokkos::ALL() );
280 const auto input = Kokkos::subview( inputPoints, pt, Kokkos::ALL() );
281 Impl::Basis_HDIV_HEX_I1_FEM::Serial<OPERATOR_DIV>::getValues( output, input);
285 INTREPID2_TEST_FOR_ABORT(
true,
">>> ERROR: (Intrepid2::Basis_HDIV_HEX_I1_FEM::getValues), Operator Type not supported.");
Implementation of the default H(div)-compatible FEM basis of degree 1 on Hexahedron cell...
Basis_HDIV_HEX_I1_FEM()
Constructor.