16 #ifndef __INTREPID2_HGRAD_TET_C1_FEM_DEF_HPP__
17 #define __INTREPID2_HGRAD_TET_C1_FEM_DEF_HPP__
25 template<EOperator opType>
26 template<
typename OutputViewType,
27 typename inputViewType>
28 KOKKOS_INLINE_FUNCTION
30 Basis_HGRAD_TET_C1_FEM::Serial<opType>::
31 getValues( OutputViewType output,
32 const inputViewType input ) {
34 case OPERATOR_VALUE: {
35 const auto x = input(0);
36 const auto y = input(1);
37 const auto z = input(2);
40 output.access(0) = 1.0 - x - y -z;
48 output.access(0, 0) = -1.0;
49 output.access(0, 1) = -1.0;
50 output.access(0, 2) = -1.0;
52 output.access(1, 0) = 1.0;
53 output.access(1, 1) = 0.0;
54 output.access(1, 2) = 0.0;
56 output.access(2, 0) = 0.0;
57 output.access(2, 1) = 1.0;
58 output.access(2, 2) = 0.0;
60 output.access(3, 0) = 0.0;
61 output.access(3, 1) = 0.0;
62 output.access(3, 2) = 1.0;
66 const ordinal_type jend = output.extent(1);
67 const ordinal_type iend = output.extent(0);
69 for (ordinal_type j=0;j<jend;++j)
70 for (ordinal_type i=0;i<iend;++i)
71 output.access(i, j) = 0.0;
75 INTREPID2_TEST_FOR_ABORT( opType != OPERATOR_VALUE &&
76 opType != OPERATOR_GRAD &&
77 opType != OPERATOR_MAX,
78 ">>> ERROR: (Intrepid2::Basis_HGRAD_TET_C1_FEM::Serial::getValues) operator is not supported");
84 typename outputValueValueType,
class ...outputValueProperties,
85 typename inputPointValueType,
class ...inputPointProperties>
87 Basis_HGRAD_TET_C1_FEM::
88 getValues(
const typename DT::execution_space& space,
89 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(space, 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) );
109 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_GRAD> FunctorType;
110 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
113 case OPERATOR_CURL: {
114 INTREPID2_TEST_FOR_EXCEPTION( operatorType == OPERATOR_CURL, std::invalid_argument,
115 ">>> ERROR (Basis_HGRAD_TET_C1_FEM): CURL is invalid operator for rank-0 (scalar) functions in 3D");
119 INTREPID2_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_DIV), std::invalid_argument,
120 ">>> ERROR (Basis_HGRAD_TET_C1_FEM): DIV is invalid operator for rank-0 (scalar) functions in 3D");
132 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_MAX> FunctorType;
133 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
137 INTREPID2_TEST_FOR_EXCEPTION( !( Intrepid2::isValidOperator(operatorType) ), std::invalid_argument,
138 ">>> ERROR (Basis_HGRAD_TET_C1_FEM): Invalid operator type");
145 template<
typename DT,
typename OT,
typename PT>
148 const ordinal_type spaceDim = 3;
149 this->basisCardinality_ = 4;
150 this->basisDegree_ = 1;
151 this->basisCellTopologyKey_ = shards::Tetrahedron<4>::key;
152 this->basisType_ = BASIS_FEM_DEFAULT;
153 this->basisCoordinates_ = COORDINATES_CARTESIAN;
154 this->functionSpace_ = FUNCTION_SPACE_HGRAD;
159 const ordinal_type tagSize = 4;
160 const ordinal_type posScDim = 0;
161 const ordinal_type posScOrd = 1;
162 const ordinal_type posDfOrd = 2;
165 ordinal_type tags[16] = { 0, 0, 0, 1,
176 this->setOrdinalTagData(this->tagToOrdinal_,
179 this->basisCardinality_,
193 Kokkos::DynRankView<typename ScalarViewType::value_type,typename DT::execution_space::array_layout,Kokkos::HostSpace>
194 dofCoords(
"dofCoordsHost", this->basisCardinality_,spaceDim);
196 dofCoords(0,0) = 0.0; dofCoords(0,1) = 0.0; dofCoords(0,2) = 0.0;
197 dofCoords(1,0) = 1.0; dofCoords(1,1) = 0.0; dofCoords(1,2) = 0.0;
198 dofCoords(2,0) = 0.0; dofCoords(2,1) = 1.0; dofCoords(2,2) = 0.0;
199 dofCoords(3,0) = 0.0; dofCoords(3,1) = 0.0; dofCoords(3,2) = 1.0;
201 this->dofCoords_ = Kokkos::create_mirror_view(
typename DT::memory_space(), dofCoords);
202 Kokkos::deep_copy(this->dofCoords_, dofCoords);
205 template<
typename DT,
typename OT,
typename PT>
208 ordinal_type& perTeamSpaceSize,
209 ordinal_type& perThreadSpaceSize,
211 const EOperator operatorType)
const {
212 perTeamSpaceSize = 0;
213 perThreadSpaceSize = 0;
216 template<
typename DT,
typename OT,
typename PT>
217 KOKKOS_INLINE_FUNCTION
220 OutputViewType outputValues,
221 const PointViewType inputPoints,
222 const EOperator operatorType,
223 const typename Kokkos::TeamPolicy<typename DT::execution_space>::member_type& team_member,
224 const typename DT::execution_space::scratch_memory_space & scratchStorage,
225 const ordinal_type subcellDim,
226 const ordinal_type subcellOrdinal)
const {
228 INTREPID2_TEST_FOR_ABORT( !((subcellDim <= 0) && (subcellOrdinal == -1)),
229 ">>> ERROR: (Intrepid2::Basis_HGRAD_TET_C1_FEM::getValues), The capability of selecting subsets of basis functions has not been implemented yet.");
231 (void) scratchStorage;
233 const int numPoints = inputPoints.extent(0);
235 switch(operatorType) {
237 Kokkos::parallel_for (Kokkos::TeamThreadRange (team_member, numPoints), [=] (ordinal_type& pt) {
238 auto output = Kokkos::subview( outputValues, Kokkos::ALL(), pt, Kokkos::ALL() );
239 const auto input = Kokkos::subview( inputPoints, pt, Kokkos::ALL() );
244 Kokkos::parallel_for (Kokkos::TeamThreadRange (team_member, numPoints), [=] (ordinal_type& pt) {
245 auto output = Kokkos::subview( outputValues, Kokkos::ALL(), pt, Kokkos::ALL() );
246 const auto input = Kokkos::subview( inputPoints, pt, Kokkos::ALL() );
247 Impl::Basis_HGRAD_TET_C1_FEM::Serial<OPERATOR_GRAD>::getValues( output, input);
Kokkos::DynRankView< PointValueType, Kokkos::LayoutStride, DeviceType > PointViewType
View type for input points.
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...
See Intrepid2::Basis_HGRAD_TET_C1_FEM.
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.
Basis_HGRAD_TET_C1_FEM()
Constructor.
Kokkos::View< ordinal_type *, typename ExecutionSpace::array_layout, Kokkos::HostSpace > OrdinalTypeArray1DHost
View type for 1d host array.