16 #ifndef __INTREPID2_HGRAD_WEDGE_C1_FEM_DEF_HPP__
17 #define __INTREPID2_HGRAD_WEDGE_C1_FEM_DEF_HPP__
25 template<EOperator opType>
26 template<
typename OutputViewType,
27 typename inputViewType>
28 KOKKOS_INLINE_FUNCTION
30 Basis_HGRAD_WEDGE_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)*(1.0 - z)/2.0;
41 output.access(1) = x*(1.0 - z)/2.0;
42 output.access(2) = y*(1.0 - z)/2.0;
43 output.access(3) = (1.0 - x - y)*(1.0 + z)/2.0;
44 output.access(4) = x*(1.0 + z)/2.0;
45 output.access(5) = y*(1.0 + z)/2.0;
49 const auto x = input(0);
50 const auto y = input(1);
51 const auto z = input(2);
54 output.access(0, 0) = -(1.0 - z)/2.0;
55 output.access(0, 1) = -(1.0 - z)/2.0;
56 output.access(0, 2) = -(1.0 - x - y)/2.0;
58 output.access(1, 0) = (1.0 - z)/2.0;
59 output.access(1, 1) = 0.0;
60 output.access(1, 2) = -x/2.0;
62 output.access(2, 0) = 0.0;
63 output.access(2, 1) = (1.0 - z)/2.0;
64 output.access(2, 2) = -y/2.0;
67 output.access(3, 0) = -(1.0 + z)/2.0;
68 output.access(3, 1) = -(1.0 + z)/2.0;
69 output.access(3, 2) = (1.0 - x - y)/2.0;
71 output.access(4, 0) = (1.0 + z)/2.0;
72 output.access(4, 1) = 0.0;
73 output.access(4, 2) = x/2.0;
75 output.access(5, 0) = 0.0;
76 output.access(5, 1) = (1.0 + z)/2.0;
77 output.access(5, 2) = y/2.0;
81 output.access(0, 0) = 0.0; output.access(3, 0) = 0.0;
82 output.access(0, 1) = 0.0; output.access(3, 1) = 0.0;
83 output.access(0, 2) = 0.5; output.access(3, 2) =-0.5;
84 output.access(0, 3) = 0.0; output.access(3, 3) = 0.0;
85 output.access(0, 4) = 0.5; output.access(3, 4) =-0.5;
86 output.access(0, 5) = 0.0; output.access(3, 5) = 0.0;
88 output.access(1, 0) = 0.0; output.access(4, 0) = 0.0;
89 output.access(1, 1) = 0.0; output.access(4, 1) = 0.0;
90 output.access(1, 2) =-0.5; output.access(4, 2) = 0.5;
91 output.access(1, 3) = 0.0; output.access(4, 3) = 0.0;
92 output.access(1, 4) = 0.0; output.access(4, 4) = 0.0;
93 output.access(1, 5) = 0.0; output.access(4, 5) = 0.0;
95 output.access(2, 0) = 0.0; output.access(5, 0) = 0.0;
96 output.access(2, 1) = 0.0; output.access(5, 1) = 0.0;
97 output.access(2, 2) = 0.0; output.access(5, 2) = 0.0;
98 output.access(2, 3) = 0.0; output.access(5, 3) = 0.0;
99 output.access(2, 4) =-0.5; output.access(5, 4) = 0.5;
100 output.access(2, 5) = 0.0; output.access(5, 5) = 0.0;
103 case OPERATOR_MAX : {
104 const ordinal_type jend = output.extent(1);
105 const ordinal_type iend = output.extent(0);
107 for (ordinal_type j=0;j<jend;++j)
108 for (ordinal_type i=0;i<iend;++i)
109 output.access(i, j) = 0.0;
113 INTREPID2_TEST_FOR_ABORT( opType != OPERATOR_VALUE &&
114 opType != OPERATOR_GRAD &&
115 opType != OPERATOR_D2 &&
116 opType != OPERATOR_MAX,
117 ">>> ERROR: (Intrepid2::Basis_HGRAD_WEDGE_C1_FEM::Serial::getValues) operator is not supported");
123 template<
typename DT,
124 typename outputValueValueType,
class ...outputValueProperties,
125 typename inputPointValueType,
class ...inputPointProperties>
127 Basis_HGRAD_WEDGE_C1_FEM::
128 getValues( Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
129 const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
130 const EOperator operatorType ) {
131 typedef Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValueViewType;
132 typedef Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPointViewType;
133 typedef typename ExecSpace<typename inputPointViewType::execution_space,typename DT::execution_space>::ExecSpaceType ExecSpaceType;
136 const auto loopSize = inputPoints.extent(0);
137 Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
139 switch (operatorType) {
141 case OPERATOR_VALUE: {
142 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_VALUE> FunctorType;
143 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
148 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_GRAD> FunctorType;
149 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
152 case OPERATOR_CURL: {
153 INTREPID2_TEST_FOR_EXCEPTION( operatorType == OPERATOR_CURL, std::invalid_argument,
154 ">>> ERROR (Basis_HGRAD_WEDGE_C1_FEM): CURL is invalid operator for rank-0 (scalar) functions in 3D");
159 INTREPID2_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_DIV), std::invalid_argument,
160 ">>> ERROR (Basis_HGRAD_WEDGE_C1_FEM): DIV is invalid operator for rank-0 (scalar) functions in 3D");
165 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_D2> FunctorType;
166 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
177 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_MAX> FunctorType;
178 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
182 INTREPID2_TEST_FOR_EXCEPTION( !( Intrepid2::isValidOperator(operatorType) ), std::invalid_argument,
183 ">>> ERROR (Basis_HGRAD_WEDGE_C1_FEM): Invalid operator type");
190 template<
typename DT,
typename OT,
typename PT>
193 const ordinal_type spaceDim = 3;
194 this->basisCardinality_ = 6;
195 this->basisDegree_ = 1;
196 this->basisCellTopologyKey_ = shards::Wedge<6>::key;
197 this->basisType_ = BASIS_FEM_DEFAULT;
198 this->basisCoordinates_ = COORDINATES_CARTESIAN;
199 this->functionSpace_ = FUNCTION_SPACE_HGRAD;
204 const ordinal_type tagSize = 4;
205 const ordinal_type posScDim = 0;
206 const ordinal_type posScOrd = 1;
207 const ordinal_type posDfOrd = 2;
210 ordinal_type tags[24] = { 0, 0, 0, 1,
218 OrdinalTypeArray1DHost tagView(&tags[0], 24);
223 this->setOrdinalTagData(this->tagToOrdinal_,
226 this->basisCardinality_,
234 Kokkos::DynRankView<typename ScalarViewType::value_type,typename DT::execution_space::array_layout,Kokkos::HostSpace>
235 dofCoords(
"dofCoordsHost", this->basisCardinality_,spaceDim);
237 dofCoords(0,0) = 0.0; dofCoords(0,1) = 0.0; dofCoords(0,2) = -1.0;
238 dofCoords(1,0) = 1.0; dofCoords(1,1) = 0.0; dofCoords(1,2) = -1.0;
239 dofCoords(2,0) = 0.0; dofCoords(2,1) = 1.0; dofCoords(2,2) = -1.0;
240 dofCoords(3,0) = 0.0; dofCoords(3,1) = 0.0; dofCoords(3,2) = 1.0;
241 dofCoords(4,0) = 1.0; dofCoords(4,1) = 0.0; dofCoords(4,2) = 1.0;
242 dofCoords(5,0) = 0.0; dofCoords(5,1) = 1.0; dofCoords(5,2) = 1.0;
244 this->dofCoords_ = Kokkos::create_mirror_view(
typename DT::memory_space(), dofCoords);
245 Kokkos::deep_copy(this->dofCoords_, dofCoords);
248 template<
typename DT,
typename OT,
typename PT>
251 ordinal_type& perTeamSpaceSize,
252 ordinal_type& perThreadSpaceSize,
253 const PointViewType inputPoints,
254 const EOperator operatorType)
const {
255 perTeamSpaceSize = 0;
256 perThreadSpaceSize = 0;
259 template<
typename DT,
typename OT,
typename PT>
260 KOKKOS_INLINE_FUNCTION
262 Basis_HGRAD_WEDGE_C1_FEM<DT,OT,PT>::getValues(
263 OutputViewType outputValues,
264 const PointViewType inputPoints,
265 const EOperator operatorType,
266 const typename Kokkos::TeamPolicy<typename DT::execution_space>::member_type& team_member,
267 const typename DT::execution_space::scratch_memory_space & scratchStorage,
268 const ordinal_type subcellDim,
269 const ordinal_type subcellOrdinal)
const {
271 INTREPID2_TEST_FOR_ABORT( !((subcellDim <= 0) && (subcellOrdinal == -1)),
272 ">>> ERROR: (Intrepid2::Basis_HGRAD_WEDGE_C1_FEM::getValues), The capability of selecting subsets of basis functions has not been implemented yet.");
274 (void) scratchStorage;
276 const int numPoints = inputPoints.extent(0);
278 switch(operatorType) {
280 Kokkos::parallel_for (Kokkos::TeamThreadRange (team_member, numPoints), [=] (ordinal_type& pt) {
281 auto output = Kokkos::subview( outputValues, Kokkos::ALL(), pt, Kokkos::ALL() );
282 const auto input = Kokkos::subview( inputPoints, pt, Kokkos::ALL() );
283 Impl::Basis_HGRAD_WEDGE_C1_FEM::template Serial<OPERATOR_VALUE>::getValues( output, input);
287 Kokkos::parallel_for (Kokkos::TeamThreadRange (team_member, numPoints), [=] (ordinal_type& pt) {
288 auto output = Kokkos::subview( outputValues, Kokkos::ALL(), pt, Kokkos::ALL() );
289 const auto input = Kokkos::subview( inputPoints, pt, Kokkos::ALL() );
290 Impl::Basis_HGRAD_WEDGE_C1_FEM::template Serial<OPERATOR_GRAD>::getValues( output, input);
Implementation of the default H(grad)-compatible FEM basis of degree 1 on Wedge cell.
Basis_HGRAD_WEDGE_C1_FEM()
Constructor.