16 #ifndef __INTREPID2_HDIV_TET_I1_FEM_DEF_HPP__
17 #define __INTREPID2_HDIV_TET_I1_FEM_DEF_HPP__
24 template<EOperator opType>
25 template<
typename OutputViewType,
26 typename inputViewType>
27 KOKKOS_INLINE_FUNCTION
29 Basis_HDIV_TET_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) = x;
40 output.access(0, 1) = (y - 1.0);
41 output.access(0, 2) = z;
43 output.access(1, 0) = x;
44 output.access(1, 1) = y;
45 output.access(1, 2) = z;
47 output.access(2, 0) = (x - 1.0);
48 output.access(2, 1) = y;
49 output.access(2, 2) = z;
51 output.access(3, 0) = x;
52 output.access(3, 1) = y;
53 output.access(3, 2) = (z - 1.0);
65 INTREPID2_TEST_FOR_ABORT( opType != OPERATOR_VALUE &&
66 opType != OPERATOR_DIV,
67 ">>> ERROR: (Intrepid2::Basis_HDIV_TET_I1_FEM::Serial::getValues) operator is not supported");
74 typename outputValueValueType,
class ...outputValueProperties,
75 typename inputPointValueType,
class ...inputPointProperties>
77 Basis_HDIV_TET_I1_FEM::
78 getValues( Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
79 const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
80 const EOperator operatorType ) {
81 typedef Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValueViewType;
82 typedef Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPointViewType;
83 typedef typename ExecSpace<typename inputPointViewType::execution_space,typename DT::execution_space>::ExecSpaceType ExecSpaceType;
86 const auto loopSize = inputPoints.extent(0);
87 Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
89 switch (operatorType) {
90 case OPERATOR_VALUE: {
91 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_VALUE> FunctorType;
92 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
96 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_DIV> FunctorType;
97 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
100 case OPERATOR_CURL: {
101 INTREPID2_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_CURL), std::invalid_argument,
102 ">>> ERROR (Basis_HDIV_TET_I1_FEM): CURL is invalid operator for HDIV Basis Functions");
106 case OPERATOR_GRAD: {
107 INTREPID2_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_GRAD), std::invalid_argument,
108 ">>> ERROR (Basis_HDIV_TET_I1_FEM): GRAD is invalid operator for HDIV Basis Functions");
121 INTREPID2_TEST_FOR_EXCEPTION( ( (operatorType == OPERATOR_D1) &&
122 (operatorType == OPERATOR_D2) &&
123 (operatorType == OPERATOR_D3) &&
124 (operatorType == OPERATOR_D4) &&
125 (operatorType == OPERATOR_D5) &&
126 (operatorType == OPERATOR_D6) &&
127 (operatorType == OPERATOR_D7) &&
128 (operatorType == OPERATOR_D8) &&
129 (operatorType == OPERATOR_D9) &&
130 (operatorType == OPERATOR_D10) ),
131 std::invalid_argument,
132 ">>> ERROR (Basis_HDIV_TET_I1_FEM): Invalid operator type");
136 INTREPID2_TEST_FOR_EXCEPTION( ( (operatorType != OPERATOR_VALUE) &&
137 (operatorType != OPERATOR_GRAD) &&
138 (operatorType != OPERATOR_CURL) &&
139 (operatorType != OPERATOR_DIV) &&
140 (operatorType != OPERATOR_D1) &&
141 (operatorType != OPERATOR_D2) &&
142 (operatorType != OPERATOR_D3) &&
143 (operatorType != OPERATOR_D4) &&
144 (operatorType != OPERATOR_D5) &&
145 (operatorType != OPERATOR_D6) &&
146 (operatorType != OPERATOR_D7) &&
147 (operatorType != OPERATOR_D8) &&
148 (operatorType != OPERATOR_D9) &&
149 (operatorType != OPERATOR_D10) ),
150 std::invalid_argument,
151 ">>> ERROR (Basis_HDIV_TET_I1_FEM): Invalid operator type");
160 template<
typename DT,
typename OT,
typename PT>
163 this->basisCardinality_ = 4;
164 this->basisDegree_ = 1;
165 constexpr ordinal_type spaceDim = 3;
166 this->basisCellTopologyKey_ = shards::Tetrahedron<4>::key;
167 this->basisType_ = BASIS_FEM_DEFAULT;
168 this->basisCoordinates_ = COORDINATES_CARTESIAN;
169 this->functionSpace_ = FUNCTION_SPACE_HDIV;
174 const ordinal_type tagSize = 4;
175 const ordinal_type posScDim = 0;
176 const ordinal_type posScOrd = 1;
177 const ordinal_type posDfOrd = 2;
180 ordinal_type tags[16] = { 2, 0, 0, 1,
191 this->setOrdinalTagData(this->tagToOrdinal_,
194 this->basisCardinality_,
208 Kokkos::DynRankView<typename ScalarViewType::value_type,typename DT::execution_space::array_layout,Kokkos::HostSpace>
209 dofCoords(
"dofCoordsHost", this->basisCardinality_,spaceDim);
211 dofCoords(0,0) = 1.0/3.0; dofCoords(0,1) = 0.0; dofCoords(0,2) = 1.0/3.0;
212 dofCoords(1,0) = 1.0/3.0; dofCoords(1,1) = 1.0/3.0; dofCoords(1,2) = 1.0/3.0;
213 dofCoords(2,0) = 0.0; dofCoords(2,1) = 1.0/3.0; dofCoords(2,2) = 1.0/3.0;
214 dofCoords(3,0) = 1.0/3.0; dofCoords(3,1) = 1.0/3.0; dofCoords(3,2) = 0.0;
216 this->dofCoords_ = Kokkos::create_mirror_view(
typename DT::memory_space(), dofCoords);
217 Kokkos::deep_copy(this->dofCoords_, dofCoords);
220 Kokkos::DynRankView<typename ScalarViewType::value_type,typename DT::execution_space::array_layout,Kokkos::HostSpace>
221 dofCoeffs(
"dofCoeffsHost", this->basisCardinality_,spaceDim);
224 dofCoeffs(0,0) = 0.0; dofCoeffs(0,1) = -1.0; dofCoeffs(0,2) = 0.0;
225 dofCoeffs(1,0) = 1.0; dofCoeffs(1,1) = 1.0; dofCoeffs(1,2) = 1.0;
226 dofCoeffs(2,0) = -1.0; dofCoeffs(2,1) = 0.0; dofCoeffs(2,2) = 0.0;
227 dofCoeffs(3,0) = 0.0; dofCoeffs(3,1) = 0.0; dofCoeffs(3,2) = -1.0;
229 this->dofCoeffs_ = Kokkos::create_mirror_view(
typename DT::memory_space(), dofCoeffs);
230 Kokkos::deep_copy(this->dofCoeffs_, dofCoeffs);
233 template<
typename DT,
typename OT,
typename PT>
236 ordinal_type& perTeamSpaceSize,
237 ordinal_type& perThreadSpaceSize,
239 const EOperator operatorType)
const {
240 perTeamSpaceSize = 0;
241 perThreadSpaceSize = 0;
244 template<
typename DT,
typename OT,
typename PT>
245 KOKKOS_INLINE_FUNCTION
248 OutputViewType outputValues,
249 const PointViewType inputPoints,
250 const EOperator operatorType,
251 const typename Kokkos::TeamPolicy<typename DT::execution_space>::member_type& team_member,
252 const typename DT::execution_space::scratch_memory_space & scratchStorage,
253 const ordinal_type subcellDim,
254 const ordinal_type subcellOrdinal)
const {
256 INTREPID2_TEST_FOR_ABORT( !((subcellDim == -1) && (subcellOrdinal == -1)),
257 ">>> ERROR: (Intrepid2::Basis_HDIV_TET_I1_FEM::getValues), The capability of selecting subsets of basis functions has not been implemented yet.");
259 (void) scratchStorage;
261 const int numPoints = inputPoints.extent(0);
263 switch(operatorType) {
265 Kokkos::parallel_for (Kokkos::TeamThreadRange (team_member, numPoints), [=] (ordinal_type& pt) {
266 auto output = Kokkos::subview( outputValues, Kokkos::ALL(), pt, Kokkos::ALL() );
267 const auto input = Kokkos::subview( inputPoints, pt, Kokkos::ALL() );
272 Kokkos::parallel_for (Kokkos::TeamThreadRange (team_member, numPoints), [=] (ordinal_type& pt) {
273 auto output = Kokkos::subview( outputValues, Kokkos::ALL(), pt, Kokkos::ALL() );
274 const auto input = Kokkos::subview( inputPoints, pt, Kokkos::ALL() );
275 Impl::Basis_HDIV_TET_I1_FEM::Serial<OPERATOR_DIV>::getValues( output, input);
279 INTREPID2_TEST_FOR_ABORT(
true,
">>> ERROR: (Intrepid2::Basis_HDIV_TET_I1_FEM::getValues), Operator Type not supported.");
virtual void getValues(OutputViewType outputValues, const PointViewType inputPoints, const EOperator operatorType=OPERATOR_VALUE) const override
See Intrepid2::Basis_HDIV_TET_I1_FEM.
Kokkos::View< ordinal_type *, typename ExecutionSpace::array_layout, Kokkos::HostSpace > OrdinalTypeArray1DHost
View type for 1d host array.
Kokkos::DynRankView< PointValueType, Kokkos::LayoutStride, DeviceType > PointViewType
View type for input points.
Basis_HDIV_TET_I1_FEM()
Constructor.
virtual void getScratchSpaceSize(ordinal_type &perTeamSpaceSize, ordinal_type &perThreadSpaceSize, const PointViewType inputPointsconst, const EOperator operatorType=OPERATOR_VALUE) const override
Return the size of the scratch space, in bytes, needed for using the team-level implementation of get...