47 #ifndef __INTREPID2_HGRAD_LINE_C2_FEM_DEF_HPP__
48 #define __INTREPID2_HGRAD_LINE_C2_FEM_DEF_HPP__
56 template<EOperator opType>
57 template<
typename OutputViewType,
58 typename inputViewType>
59 KOKKOS_INLINE_FUNCTION
61 Basis_HGRAD_LINE_C2_FEM::Serial<opType>::
62 getValues( OutputViewType output,
63 const inputViewType input ) {
65 case OPERATOR_VALUE : {
66 const auto x = input(0);
68 output.access(0) = (x - 1.0)*x/2.0;
69 output.access(1) = (1.0 + x)*x/2.0;
70 output.access(2) = (1.0 + x)*(1.0 - x);
73 case OPERATOR_GRAD : {
74 const auto x = input(0);
76 output.access(0, 0) = x-0.5;
77 output.access(1, 0) = x+0.5;
78 output.access(2, 0) = -2.0*x;
82 const ordinal_type jend = output.extent(1);
83 const ordinal_type iend = output.extent(0);
85 for (ordinal_type j=0;j<jend;++j)
86 for (ordinal_type i=0;i<iend;++i)
87 output.access(i, j) = 0.0;
91 INTREPID2_TEST_FOR_ABORT( opType != OPERATOR_VALUE &&
92 opType != OPERATOR_GRAD &&
93 opType != OPERATOR_MAX,
94 ">>> ERROR: (Intrepid2::Basis_HGRAD_LINE_C2_FEM::Serial::getValues) operator is not supported");
100 template<
typename DT,
101 typename outputValueValueType,
class ...outputValueProperties,
102 typename inputPointValueType,
class ...inputPointProperties>
104 Basis_HGRAD_LINE_C2_FEM::
105 getValues(
const typename DT::execution_space& space,
106 Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
107 const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
108 const EOperator operatorType ) {
109 typedef Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValueViewType;
110 typedef Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPointViewType;
111 typedef typename ExecSpace<typename inputPointViewType::execution_space,typename DT::execution_space>::ExecSpaceType ExecSpaceType;
114 const auto loopSize = inputPoints.extent(0);
115 Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(space, 0, loopSize);
117 switch (operatorType) {
119 case OPERATOR_VALUE: {
120 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_VALUE> FunctorType;
121 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
128 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_GRAD> FunctorType;
129 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
141 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_MAX> FunctorType;
142 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
146 INTREPID2_TEST_FOR_EXCEPTION( !Intrepid2::isValidOperator(operatorType), std::invalid_argument,
147 ">>> ERROR (Basis_HGRAD_LINE_C2_FEM): Invalid operator type");
158 template<
typename DT,
typename OT,
typename PT>
161 this->basisCardinality_ = 3;
162 this->basisDegree_ = 2;
163 this->basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Line<2> >() );
164 this->basisType_ = BASIS_FEM_DEFAULT;
165 this->basisCoordinates_ = COORDINATES_CARTESIAN;
166 this->functionSpace_ = FUNCTION_SPACE_HGRAD;
171 const ordinal_type tagSize = 4;
172 const ordinal_type posScDim = 0;
173 const ordinal_type posScOrd = 1;
174 const ordinal_type posDfOrd = 2;
177 ordinal_type tags[12] = { 0, 0, 0, 1,
186 this->setOrdinalTagData(this->tagToOrdinal_,
189 this->basisCardinality_,
197 Kokkos::DynRankView<typename ScalarViewType::value_type,typename DT::execution_space::array_layout,Kokkos::HostSpace>
198 dofCoords(
"dofCoordsHost", this->basisCardinality_,this->basisCellTopology_.getDimension());
200 dofCoords(0,0) = -1.0;
201 dofCoords(1,0) = 1.0;
202 dofCoords(2,0) = 0.0;
204 this->dofCoords_ = Kokkos::create_mirror_view(
typename DT::memory_space(), dofCoords);
205 Kokkos::deep_copy(this->dofCoords_, dofCoords);
Basis_HGRAD_LINE_C2_FEM()
Constructor.
Kokkos::View< ordinal_type *, typename ExecutionSpace::array_layout, Kokkos::HostSpace > OrdinalTypeArray1DHost
View type for 1d host array.