15 #ifndef __INTREPID2_HDIV_TRI_I1_FEM_DEF_HPP__
16 #define __INTREPID2_HDIV_TRI_I1_FEM_DEF_HPP__
23 template<EOperator opType>
24 template<
typename OutputViewType,
25 typename inputViewType>
26 KOKKOS_INLINE_FUNCTION
28 Basis_HDIV_TRI_I1_FEM::Serial<opType>::
29 getValues( OutputViewType output,
30 const inputViewType input ) {
32 case OPERATOR_VALUE: {
33 const auto x = input(0);
34 const auto y = input(1);
37 output.access(0, 0) = 2.0*x;
38 output.access(0, 1) = 2.0*(y - 1.0);
40 output.access(1, 0) = 2.0*x;
41 output.access(1, 1) = 2.0*y;
43 output.access(2, 0) = 2.0*(x - 1.0);
44 output.access(2, 1) = 2.0*y;
49 output.access(0) = 4.0;
50 output.access(1) = 4.0;
51 output.access(2) = 4.0;
55 INTREPID2_TEST_FOR_ABORT( opType != OPERATOR_VALUE &&
56 opType != OPERATOR_DIV,
57 ">>> ERROR: (Intrepid2::Basis_HDIV_TRI_I1_FEM::Serial::getValues) operator is not supported");
64 typename outputValueValueType,
class ...outputValueProperties,
65 typename inputPointValueType,
class ...inputPointProperties>
67 Basis_HDIV_TRI_I1_FEM::
68 getValues( Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
69 const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
70 const EOperator operatorType ) {
71 typedef Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValueViewType;
72 typedef Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPointViewType;
73 typedef typename ExecSpace<typename inputPointViewType::execution_space,typename DT::execution_space>::ExecSpaceType ExecSpaceType;
77 const auto loopSize = inputPoints.extent(0);
78 Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
80 switch (operatorType) {
81 case OPERATOR_VALUE: {
82 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_VALUE> FunctorType;
83 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
87 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_DIV> FunctorType;
88 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
92 INTREPID2_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_CURL), std::invalid_argument,
93 ">>> ERROR (Basis_HDIV_TRI_I1_FEM): CURL is invalid operator for HDIV Basis Functions");
98 INTREPID2_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_GRAD), std::invalid_argument,
99 ">>> ERROR (Basis_HDIV_TRI_I1_FEM): GRAD is invalid operator for HDIV Basis Functions");
112 INTREPID2_TEST_FOR_EXCEPTION( ( (operatorType == OPERATOR_D1) &&
113 (operatorType == OPERATOR_D2) &&
114 (operatorType == OPERATOR_D3) &&
115 (operatorType == OPERATOR_D4) &&
116 (operatorType == OPERATOR_D5) &&
117 (operatorType == OPERATOR_D6) &&
118 (operatorType == OPERATOR_D7) &&
119 (operatorType == OPERATOR_D8) &&
120 (operatorType == OPERATOR_D9) &&
121 (operatorType == OPERATOR_D10) ),
122 std::invalid_argument,
123 ">>> ERROR (Basis_HDIV_TRI_I1_FEM): Invalid operator type");
127 INTREPID2_TEST_FOR_EXCEPTION( ( (operatorType != OPERATOR_VALUE) &&
128 (operatorType != OPERATOR_GRAD) &&
129 (operatorType != OPERATOR_CURL) &&
130 (operatorType != OPERATOR_DIV) &&
131 (operatorType != OPERATOR_D1) &&
132 (operatorType != OPERATOR_D2) &&
133 (operatorType != OPERATOR_D3) &&
134 (operatorType != OPERATOR_D4) &&
135 (operatorType != OPERATOR_D5) &&
136 (operatorType != OPERATOR_D6) &&
137 (operatorType != OPERATOR_D7) &&
138 (operatorType != OPERATOR_D8) &&
139 (operatorType != OPERATOR_D9) &&
140 (operatorType != OPERATOR_D10) ),
141 std::invalid_argument,
142 ">>> ERROR (Basis_HDIV_TRI_I1_FEM): Invalid operator type");
149 template<
typename DT,
typename OT,
typename PT>
152 this->basisCardinality_ = 3;
153 this->basisDegree_ = 1;
154 constexpr ordinal_type spaceDim = 2;
155 this->basisCellTopologyKey_ = shards::Triangle<3>::key;
156 this->basisType_ = BASIS_FEM_DEFAULT;
157 this->basisCoordinates_ = COORDINATES_CARTESIAN;
158 this->functionSpace_ = FUNCTION_SPACE_HDIV;
163 const ordinal_type tagSize = 4;
164 const ordinal_type posScDim = 0;
165 const ordinal_type posScOrd = 1;
166 const ordinal_type posDfOrd = 2;
169 ordinal_type tags[12] = { 1, 0, 0, 1,
179 this->setOrdinalTagData(this->tagToOrdinal_,
182 this->basisCardinality_,
196 Kokkos::DynRankView<typename ScalarViewType::value_type,typename DT::execution_space::array_layout,Kokkos::HostSpace>
197 dofCoords(
"dofCoordsHost", this->basisCardinality_,spaceDim);
199 dofCoords(0,0) = 0.5; dofCoords(0,1) = 0.0;
200 dofCoords(1,0) = 0.5; dofCoords(1,1) = 0.5;
201 dofCoords(2,0) = 0.0; dofCoords(2,1) = 0.5;
203 this->dofCoords_ = Kokkos::create_mirror_view(
typename DT::memory_space(), dofCoords);
204 Kokkos::deep_copy(this->dofCoords_, dofCoords);
207 Kokkos::DynRankView<typename ScalarViewType::value_type,typename DT::execution_space::array_layout,Kokkos::HostSpace>
208 dofCoeffs(
"dofCoeffsHost", this->basisCardinality_,spaceDim);
211 dofCoeffs(0,0) = 0.0; dofCoeffs(0,1) = -0.5;
212 dofCoeffs(1,0) = 0.5; dofCoeffs(1,1) = 0.5;
213 dofCoeffs(2,0) = -0.5; dofCoeffs(2,1) = 0.0;
215 this->dofCoeffs_ = Kokkos::create_mirror_view(
typename DT::memory_space(), dofCoeffs); Kokkos::deep_copy(this->dofCoeffs_, dofCoeffs);
219 template<
typename DT,
typename OT,
typename PT>
222 ordinal_type& perTeamSpaceSize,
223 ordinal_type& perThreadSpaceSize,
225 const EOperator operatorType)
const {
226 perTeamSpaceSize = 0;
227 perThreadSpaceSize = 0;
230 template<
typename DT,
typename OT,
typename PT>
231 KOKKOS_INLINE_FUNCTION
234 OutputViewType outputValues,
235 const PointViewType inputPoints,
236 const EOperator operatorType,
237 const typename Kokkos::TeamPolicy<typename DT::execution_space>::member_type& team_member,
238 const typename DT::execution_space::scratch_memory_space & scratchStorage,
239 const ordinal_type subcellDim,
240 const ordinal_type subcellOrdinal)
const {
242 INTREPID2_TEST_FOR_ABORT( !((subcellDim == -1) && (subcellOrdinal == -1)),
243 ">>> ERROR: (Intrepid2::Basis_HDIV_TRI_I1_FEM::getValues), The capability of selecting subsets of basis functions has not been implemented yet.");
245 (void) scratchStorage;
247 const int numPoints = inputPoints.extent(0);
249 switch(operatorType) {
251 Kokkos::parallel_for (Kokkos::TeamThreadRange (team_member, numPoints), [=] (ordinal_type& pt) {
252 auto output = Kokkos::subview( outputValues, Kokkos::ALL(), pt, Kokkos::ALL() );
253 const auto input = Kokkos::subview( inputPoints, pt, Kokkos::ALL() );
258 Kokkos::parallel_for (Kokkos::TeamThreadRange (team_member, numPoints), [=] (ordinal_type& pt) {
259 auto output = Kokkos::subview( outputValues, Kokkos::ALL(), pt, Kokkos::ALL() );
260 const auto input = Kokkos::subview( inputPoints, pt, Kokkos::ALL() );
261 Impl::Basis_HDIV_TRI_I1_FEM::Serial<OPERATOR_DIV>::getValues( output, input);
265 INTREPID2_TEST_FOR_ABORT(
true,
">>> ERROR: (Intrepid2::Basis_HDIV_TRI_!1_FEM::getValues), Operator Type not supported.");
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_TRI_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...
virtual void getValues(OutputViewType outputValues, const PointViewType inputPoints, const EOperator operatorType=OPERATOR_VALUE) const override
See Intrepid2::Basis_HDIV_TRI_I1_FEM.