16 #ifndef __INTREPID2_HCURL_TRI_I1_FEM_DEF_HPP__
17 #define __INTREPID2_HCURL_TRI_I1_FEM_DEF_HPP__
24 template<EOperator opType>
25 template<
typename OutputViewType,
26 typename inputViewType>
27 KOKKOS_INLINE_FUNCTION
29 Basis_HCURL_TRI_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);
38 output.access(0, 0) = 2.0*(1.0 - y);
39 output.access(0, 1) = 2.0*x;
41 output.access(1, 0) = -2.0*y;
42 output.access(1, 1) = 2.0*x;
44 output.access(2, 0) = -2.0*y;
45 output.access(2, 1) = 2.0*(-1.0 + x);
50 output.access(0) = 4.0;
51 output.access(1) = 4.0;
52 output.access(2) = 4.0;
57 INTREPID2_TEST_FOR_ABORT( opType != OPERATOR_VALUE &&
58 opType != OPERATOR_CURL,
59 ">>> ERROR: (Intrepid2::Basis_HCURL_TRI_I1_FEM::Serial::getValues) operator is not supported");
64 template<
typename DT,
65 typename outputValueValueType,
class ...outputValueProperties,
66 typename inputPointValueType,
class ...inputPointProperties>
68 Basis_HCURL_TRI_I1_FEM::
69 getValues(
const typename DT::execution_space& space,
70 Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
71 const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
72 const EOperator operatorType ) {
73 typedef Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValueViewType;
74 typedef Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPointViewType;
75 typedef typename ExecSpace<typename inputPointViewType::execution_space,typename DT::execution_space>::ExecSpaceType ExecSpaceType;
78 const auto loopSize = inputPoints.extent(0);
79 Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(space, 0, loopSize);
81 switch (operatorType) {
82 case OPERATOR_VALUE: {
83 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_VALUE> FunctorType;
84 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
88 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_CURL> FunctorType;
89 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
93 INTREPID2_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_DIV), std::invalid_argument,
94 ">>> ERROR (Basis_HCURL_TRI_I1_FEM): DIV is invalid operator for HCURL Basis Functions");
98 INTREPID2_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_GRAD), std::invalid_argument,
99 ">>> ERROR (Basis_HCURL_TRI_I1_FEM): GRAD is invalid operator for HCURL 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_HCURL_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_HCURL_TRI_I1_FEM): Invalid operator type");
148 template<
typename DT,
typename OT,
typename PT >
151 const ordinal_type spaceDim = 2;
152 this->basisCardinality_ = 3;
153 this->basisDegree_ = 1;
154 this->basisCellTopologyKey_ = shards::Triangle<3>::key;
155 this->basisType_ = BASIS_FEM_DEFAULT;
156 this->basisCoordinates_ = COORDINATES_CARTESIAN;
157 this->functionSpace_ = FUNCTION_SPACE_HCURL;
162 const ordinal_type tagSize = 4;
163 const ordinal_type posScDim = 0;
164 const ordinal_type posScOrd = 1;
165 const ordinal_type posDfOrd = 2;
168 ordinal_type tags[12] = {
177 this->setOrdinalTagData(this->tagToOrdinal_,
180 this->basisCardinality_,
188 Kokkos::DynRankView<typename ScalarViewType::value_type,typename DT::execution_space::array_layout,Kokkos::HostSpace>
189 dofCoords(
"dofCoordsHost", this->basisCardinality_,spaceDim);
191 dofCoords(0,0) = 0.5; dofCoords(0,1) = 0.0;
192 dofCoords(1,0) = 0.5; dofCoords(1,1) = 0.5;
193 dofCoords(2,0) = 0.0; dofCoords(2,1) = 0.5;
195 this->dofCoords_ = Kokkos::create_mirror_view(
typename DT::memory_space(), dofCoords);
196 Kokkos::deep_copy(this->dofCoords_, dofCoords);
199 Kokkos::DynRankView<typename ScalarViewType::value_type,typename DT::execution_space::array_layout,Kokkos::HostSpace>
200 dofCoeffs(
"dofCoeffsHost", this->basisCardinality_,spaceDim);
202 dofCoeffs(0,0) = 0.5; dofCoeffs(0,1) = 0.0;
203 dofCoeffs(1,0) = -0.5; dofCoeffs(1,1) = 0.5;
204 dofCoeffs(2,0) = 0.0; dofCoeffs(2,1) = -0.5;
206 this->dofCoeffs_ = Kokkos::create_mirror_view(
typename DT::memory_space(), dofCoeffs);
207 Kokkos::deep_copy(this->dofCoeffs_, dofCoeffs);
211 template<
typename DT,
typename OT,
typename PT>
214 ordinal_type& perTeamSpaceSize,
215 ordinal_type& perThreadSpaceSize,
217 const EOperator operatorType)
const {
218 perTeamSpaceSize = 0;
219 perThreadSpaceSize = 0;
222 template<
typename DT,
typename OT,
typename PT>
223 KOKKOS_INLINE_FUNCTION
226 OutputViewType outputValues,
227 const PointViewType inputPoints,
228 const EOperator operatorType,
229 const typename Kokkos::TeamPolicy<typename DT::execution_space>::member_type& team_member,
230 const typename DT::execution_space::scratch_memory_space & scratchStorage,
231 const ordinal_type subcellDim,
232 const ordinal_type subcellOrdinal)
const {
234 INTREPID2_TEST_FOR_ABORT( !((subcellDim == -1) && (subcellOrdinal == -1)),
235 ">>> ERROR: (Intrepid2::Basis_HCURL_TRI_I1_FEM::getValues), The capability of selecting subsets of basis functions has not been implemented yet.");
237 (void) scratchStorage;
239 const int numPoints = inputPoints.extent(0);
241 switch(operatorType) {
243 Kokkos::parallel_for (Kokkos::TeamThreadRange (team_member, numPoints), [=] (ordinal_type& pt) {
244 auto output = Kokkos::subview( outputValues, Kokkos::ALL(), pt, Kokkos::ALL() );
245 const auto input = Kokkos::subview( inputPoints, pt, Kokkos::ALL() );
250 Kokkos::parallel_for (Kokkos::TeamThreadRange (team_member, numPoints), [=] (ordinal_type& pt) {
251 auto output = Kokkos::subview( outputValues, Kokkos::ALL(), pt, Kokkos::ALL() );
252 const auto input = Kokkos::subview( inputPoints, pt, Kokkos::ALL() );
253 Impl::Basis_HCURL_TRI_I1_FEM::Serial<OPERATOR_CURL>::getValues( output, input);
257 INTREPID2_TEST_FOR_ABORT(
true,
">>> ERROR: (Intrepid2::Basis_HCURL_TRI_!1_FEM::getValues), Operator Type not supported.");
Basis_HCURL_TRI_I1_FEM()
Constructor.
virtual void getValues(const ExecutionSpace &space, OutputViewType outputValues, const PointViewType inputPoints, const EOperator operatorType=OPERATOR_VALUE) const override
Evaluation of a FEM basis on a reference cell.
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...
Kokkos::View< ordinal_type *, typename ExecutionSpace::array_layout, Kokkos::HostSpace > OrdinalTypeArray1DHost
View type for 1d host array.
See Intrepid2::Basis_HCURL_TRI_I1_FEM.
Kokkos::DynRankView< PointValueType, Kokkos::LayoutStride, DeviceType > PointViewType
View type for input points.