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( 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,typename DT::execution_space>::ExecSpaceType ExecSpaceType;
113 const auto loopSize = inputPoints.extent(0);
114 Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
116 switch (operatorType) {
118 case OPERATOR_VALUE: {
119 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_VALUE> FunctorType;
120 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
127 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_GRAD> FunctorType;
128 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
140 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_MAX> FunctorType;
141 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
145 INTREPID2_TEST_FOR_EXCEPTION( !Intrepid2::isValidOperator(operatorType), std::invalid_argument,
146 ">>> ERROR (Basis_HGRAD_LINE_C2_FEM): Invalid operator type");
157 template<
typename DT,
typename OT,
typename PT>
160 this->basisCardinality_ = 3;
161 this->basisDegree_ = 2;
162 this->basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Line<2> >() );
163 this->basisType_ = BASIS_FEM_DEFAULT;
164 this->basisCoordinates_ = COORDINATES_CARTESIAN;
165 this->functionSpace_ = FUNCTION_SPACE_HGRAD;
170 const ordinal_type tagSize = 4;
171 const ordinal_type posScDim = 0;
172 const ordinal_type posScOrd = 1;
173 const ordinal_type posDfOrd = 2;
176 ordinal_type tags[12] = { 0, 0, 0, 1,
181 OrdinalTypeArray1DHost tagView(&tags[0], 12);
185 this->setOrdinalTagData(this->tagToOrdinal_,
188 this->basisCardinality_,
196 Kokkos::DynRankView<typename ScalarViewType::value_type,typename DT::execution_space::array_layout,Kokkos::HostSpace>
197 dofCoords(
"dofCoordsHost", this->basisCardinality_,this->basisCellTopology_.getDimension());
199 dofCoords(0,0) = -1.0;
200 dofCoords(1,0) = 1.0;
201 dofCoords(2,0) = 0.0;
203 this->dofCoords_ = Kokkos::create_mirror_view(
typename DT::memory_space(), dofCoords);
204 Kokkos::deep_copy(this->dofCoords_, dofCoords);
Basis_HGRAD_LINE_C2_FEM()
Constructor.