49 #ifndef __INTREPID2_HDIV_QUAD_I1_FEM_DEF_HPP__
50 #define __INTREPID2_HDIV_QUAD_I1_FEM_DEF_HPP__
58 template<EOperator opType>
59 template<
typename OutputViewType,
60 typename inputViewType>
61 KOKKOS_INLINE_FUNCTION
63 Basis_HDIV_QUAD_I1_FEM::Serial<opType>::
64 getValues( OutputViewType output,
65 const inputViewType input ) {
67 case OPERATOR_VALUE : {
68 const auto x = input(0);
69 const auto y = input(1);
71 output.access(0, 0) = 0.0;
72 output.access(0, 1) = (y - 1.0)/4.0;
74 output.access(1, 0) = (1.0 + x)/4.0;
75 output.access(1, 1) = 0.0;
77 output.access(2, 0) = 0.0;
78 output.access(2, 1) = (1.0 + y)/4.0;
80 output.access(3, 0) = (x - 1.0)/4.0;
81 output.access(3, 1) = 0.0;
85 output.access(0) = 0.25;
86 output.access(1) = 0.25;
87 output.access(2) = 0.25;
88 output.access(3) = 0.25;
92 INTREPID2_TEST_FOR_ABORT( opType != OPERATOR_VALUE &&
93 opType != OPERATOR_DIV,
94 ">>> ERROR: (Intrepid2::Basis_HDIV_QUAD_C1_FEM::Serial::getValues) operator is not supported");
100 template<
typename SpT,
101 typename outputValueValueType,
class ...outputValueProperties,
102 typename inputPointValueType,
class ...inputPointProperties>
104 Basis_HDIV_QUAD_I1_FEM::
105 getValues( Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
106 const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
107 const EOperator operatorType ) {
108 typedef Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValueViewType;
109 typedef Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPointViewType;
110 typedef typename ExecSpace<typename inputPointViewType::execution_space,SpT>::ExecSpaceType ExecSpaceType;
114 const auto loopSize = inputPoints.extent(0);
115 Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
117 switch (operatorType) {
118 case OPERATOR_VALUE: {
119 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_VALUE> FunctorType;
120 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
124 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_DIV> FunctorType;
125 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
128 case OPERATOR_CURL: {
129 INTREPID2_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_CURL), std::invalid_argument,
130 ">>> ERROR (Basis_HDIV_QUAD_I1_FEM): CURL is invalid operator for HDIV Basis Functions");
133 case OPERATOR_GRAD: {
134 INTREPID2_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_GRAD), std::invalid_argument,
135 ">>> ERROR (Basis_HDIV_QUAD_I1_FEM): GRAD is invalid operator for HDIV Basis Functions");
148 INTREPID2_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_D1) ||
149 (operatorType == OPERATOR_D2) ||
150 (operatorType == OPERATOR_D3) ||
151 (operatorType == OPERATOR_D4) ||
152 (operatorType == OPERATOR_D5) ||
153 (operatorType == OPERATOR_D6) ||
154 (operatorType == OPERATOR_D7) ||
155 (operatorType == OPERATOR_D8) ||
156 (operatorType == OPERATOR_D9) ||
157 (operatorType == OPERATOR_D10),
158 std::invalid_argument,
159 ">>> ERROR (Basis_HDIV_QUAD_I1_FEM): Invalid operator type");
163 INTREPID2_TEST_FOR_EXCEPTION( (operatorType != OPERATOR_VALUE) &&
164 (operatorType != OPERATOR_GRAD) &&
165 (operatorType != OPERATOR_CURL) &&
166 (operatorType != OPERATOR_DIV) &&
167 (operatorType != OPERATOR_D1) &&
168 (operatorType != OPERATOR_D2) &&
169 (operatorType != OPERATOR_D3) &&
170 (operatorType != OPERATOR_D4) &&
171 (operatorType != OPERATOR_D5) &&
172 (operatorType != OPERATOR_D6) &&
173 (operatorType != OPERATOR_D7) &&
174 (operatorType != OPERATOR_D8) &&
175 (operatorType != OPERATOR_D9) &&
176 (operatorType != OPERATOR_D10),
177 std::invalid_argument,
178 ">>> ERROR (Basis_HDIV_QUAD_I1_FEM): Invalid operator type");
186 template<
typename SpT,
typename OT,
typename PT>
189 this->basisCardinality_ = 4;
190 this->basisDegree_ = 1;
191 this->basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Quadrilateral<4> >() );
192 this->basisType_ = BASIS_FEM_DEFAULT;
193 this->basisCoordinates_ = COORDINATES_CARTESIAN;
194 this->functionSpace_ = FUNCTION_SPACE_HDIV;
199 const ordinal_type tagSize = 4;
200 const ordinal_type posScDim = 0;
201 const ordinal_type posScOrd = 1;
202 const ordinal_type posDfOrd = 2;
205 ordinal_type tags[16] = { 1, 0, 0, 1,
215 this->setOrdinalTagData(this->tagToOrdinal_,
218 this->basisCardinality_,
225 Kokkos::DynRankView<typename ScalarViewType::value_type,typename SpT::array_layout,Kokkos::HostSpace>
226 dofCoords(
"dofCoordsHost", this->basisCardinality_,this->basisCellTopology_.getDimension());
228 dofCoords(0,0) = 0.0; dofCoords(0,1) = -1.0;
229 dofCoords(1,0) = 1.0; dofCoords(1,1) = 0.0;
230 dofCoords(2,0) = 0.0; dofCoords(2,1) = 1.0;
231 dofCoords(3,0) = -1.0; dofCoords(3,1) = 0.0;
233 this->dofCoords_ = Kokkos::create_mirror_view(
typename SpT::memory_space(), dofCoords);
234 Kokkos::deep_copy(this->dofCoords_, dofCoords);
237 Kokkos::DynRankView<typename ScalarViewType::value_type,typename SpT::array_layout,Kokkos::HostSpace>
238 dofCoeffs(
"dofCoeffsHost", this->basisCardinality_,this->basisCellTopology_.getDimension());
241 dofCoeffs(0,0) = 0.0; dofCoeffs(0,1) = -2.0;
242 dofCoeffs(1,0) = 2.0; dofCoeffs(1,1) = 0.0;
243 dofCoeffs(2,0) = 0.0; dofCoeffs(2,1) = 2.0;
244 dofCoeffs(3,0) = -2.0; dofCoeffs(3,1) = 0.0;
246 this->dofCoeffs_ = Kokkos::create_mirror_view(
typename SpT::memory_space(), dofCoeffs);
247 Kokkos::deep_copy(this->dofCoeffs_, dofCoeffs);
Kokkos::View< ordinal_type *, typename ExecSpaceType::array_layout, Kokkos::HostSpace > OrdinalTypeArray1DHost
View type for 1d host array.
Basis_HDIV_QUAD_I1_FEM()
Constructor.