49 #ifndef __INTREPID2_HGRAD_TRI_C1_FEM_DEF_HPP__
50 #define __INTREPID2_HGRAD_TRI_C1_FEM_DEF_HPP__
59 template<EOperator opType>
60 template<
typename OutputViewType,
61 typename inputViewType>
62 KOKKOS_INLINE_FUNCTION
64 Basis_HGRAD_TRI_C1_FEM::Serial<opType>::
65 getValues( OutputViewType output,
66 const inputViewType input ) {
68 case OPERATOR_VALUE: {
69 const auto x = input(0);
70 const auto y = input(1);
73 output.access(0) = 1.0 - x - y;
80 output.access(0, 0) = -1.0;
81 output.access(0, 1) = -1.0;
83 output.access(1, 0) = 1.0;
84 output.access(1, 1) = 0.0;
86 output.access(2, 0) = 0.0;
87 output.access(2, 1) = 1.0;
91 output.access(0, 0) = -1.0;
92 output.access(0, 1) = 1.0;
94 output.access(1, 0) = 0.0;
95 output.access(1, 1) = -1.0;
97 output.access(2, 0) = 1.0;
98 output.access(2, 1) = 0.0;
102 const ordinal_type jend = output.extent(1);
103 const ordinal_type iend = output.extent(0);
105 for (ordinal_type j=0;j<jend;++j)
106 for (ordinal_type i=0;i<iend;++i)
107 output.access(i, j) = 0.0;
111 INTREPID2_TEST_FOR_ABORT( opType != OPERATOR_VALUE &&
112 opType != OPERATOR_GRAD &&
113 opType != OPERATOR_CURL &&
114 opType != OPERATOR_MAX,
115 ">>> ERROR: (Intrepid2::Basis_HGRAD_TRI_C1_FEM::Serial::getValues) operator is not supported");
121 template<
typename SpT,
122 typename outputValueValueType,
class ...outputValueProperties,
123 typename inputPointValueType,
class ...inputPointProperties>
125 Basis_HGRAD_TRI_C1_FEM::
126 getValues( Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
127 const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
128 const EOperator operatorType ) {
129 typedef Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValueViewType;
130 typedef Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPointViewType;
131 typedef typename ExecSpace<typename inputPointViewType::execution_space,SpT>::ExecSpaceType ExecSpaceType;
134 const auto loopSize = inputPoints.extent(0);
135 Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
137 switch (operatorType) {
138 case OPERATOR_VALUE: {
139 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_VALUE> FunctorType;
140 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
145 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_GRAD> FunctorType;
146 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
149 case OPERATOR_CURL: {
150 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_CURL> FunctorType;
151 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
155 INTREPID2_TEST_FOR_EXCEPTION( operatorType == OPERATOR_DIV, std::invalid_argument,
156 ">>> ERROR (Basis_HGRAD_TRI_C1_FEM): DIV is invalid operator for rank-0 (scalar) functions in 2D");
168 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_MAX> FunctorType;
169 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
173 INTREPID2_TEST_FOR_EXCEPTION( !Intrepid2::isValidOperator(operatorType), std::invalid_argument,
174 ">>> ERROR (Basis_HGRAD_TRI_C1_FEM): Invalid operator type");
181 template<
typename SpT,
typename OT,
typename PT>
184 this->basisCardinality_ = 3;
185 this->basisDegree_ = 1;
186 this->basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Triangle<3> >() );
187 this->basisType_ = BASIS_FEM_DEFAULT;
188 this->basisCoordinates_ = COORDINATES_CARTESIAN;
189 this->functionSpace_ = FUNCTION_SPACE_HGRAD;
194 const ordinal_type tagSize = 4;
195 const ordinal_type posScDim = 0;
196 const ordinal_type posScOrd = 1;
197 const ordinal_type posDfOrd = 2;
200 ordinal_type tags[12] = { 0, 0, 0, 1,
210 this->setOrdinalTagData(this->tagToOrdinal_,
213 this->basisCardinality_,
227 Kokkos::DynRankView<typename ScalarViewType::value_type,typename SpT::array_layout,Kokkos::HostSpace>
228 dofCoords(
"dofCoordsHost", this->basisCardinality_,this->basisCellTopology_.getDimension());
230 dofCoords(0,0) = 0.0; dofCoords(0,1) = 0.0;
231 dofCoords(1,0) = 1.0; dofCoords(1,1) = 0.0;
232 dofCoords(2,0) = 0.0; dofCoords(2,1) = 1.0;
234 this->dofCoords_ = Kokkos::create_mirror_view(
typename SpT::memory_space(), dofCoords);
235 Kokkos::deep_copy(this->dofCoords_, dofCoords);
Kokkos::View< ordinal_type *, typename ExecSpaceType::array_layout, Kokkos::HostSpace > OrdinalTypeArray1DHost
View type for 1d host array.
Basis_HGRAD_TRI_C1_FEM()
Constructor.