49 #ifndef __INTREPID2_HGRAD_LINE_C1_FEM_DEF_HPP__
50 #define __INTREPID2_HGRAD_LINE_C1_FEM_DEF_HPP__
58 template<EOperator opType>
59 template<
typename OutputViewType,
60 typename inputViewType>
61 KOKKOS_INLINE_FUNCTION
63 Basis_HGRAD_LINE_C1_FEM::Serial<opType>::
64 getValues( OutputViewType output,
65 const inputViewType input ) {
67 case OPERATOR_VALUE : {
68 const auto x = input(0);
70 output.access(0) = (1.0 - x)/2.0;
71 output.access(1) = (1.0 + x)/2.0;
74 case OPERATOR_GRAD : {
75 output.access(0, 0) = -0.5;
76 output.access(1, 0) = 0.5;
80 const ordinal_type jend = output.extent(1);
81 const ordinal_type iend = output.extent(0);
83 for (ordinal_type j=0;j<jend;++j)
84 for (ordinal_type i=0;i<iend;++i)
85 output.access(i, j) = 0.0;
89 INTREPID2_TEST_FOR_ABORT( opType != OPERATOR_VALUE &&
90 opType != OPERATOR_GRAD &&
91 opType != OPERATOR_MAX,
92 ">>> ERROR: (Intrepid2::Basis_HGRAD_LINE_C1_FEM::Serial::getValues) operator is not supported");
98 template<
typename SpT,
99 typename outputValueValueType,
class ...outputValueProperties,
100 typename inputPointValueType,
class ...inputPointProperties>
102 Basis_HGRAD_LINE_C1_FEM::
103 getValues( Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
104 const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
105 const EOperator operatorType ) {
106 typedef Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValueViewType;
107 typedef Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPointViewType;
108 typedef typename ExecSpace<typename inputPointViewType::execution_space,SpT>::ExecSpaceType ExecSpaceType;
111 const auto loopSize = inputPoints.extent(0);
112 Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(0, loopSize);
114 switch (operatorType) {
116 case OPERATOR_VALUE: {
117 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_VALUE> FunctorType;
118 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
125 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_GRAD> FunctorType;
126 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
138 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_MAX> FunctorType;
139 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
143 INTREPID2_TEST_FOR_EXCEPTION( !Intrepid2::isValidOperator(operatorType), std::invalid_argument,
144 ">>> ERROR (Basis_HGRAD_LINE_C1_FEM): Invalid operator type");
155 template<
typename SpT,
typename OT,
typename PT>
158 this->basisCardinality_ = 2;
159 this->basisDegree_ = 1;
160 this->basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Line<2> >() );
161 this->basisType_ = BASIS_FEM_DEFAULT;
162 this->basisCoordinates_ = COORDINATES_CARTESIAN;
163 this->functionSpace_ = FUNCTION_SPACE_HGRAD;
168 const ordinal_type tagSize = 4;
169 const ordinal_type posScDim = 0;
170 const ordinal_type posScOrd = 1;
171 const ordinal_type posDfOrd = 2;
174 ordinal_type tags[8] = { 0, 0, 0, 1,
184 this->setOrdinalTagData(this->tagToOrdinal_,
187 this->basisCardinality_,
201 Kokkos::DynRankView<typename ScalarViewType::value_type,typename SpT::array_layout,Kokkos::HostSpace>
202 dofCoords(
"dofCoordsHost", this->basisCardinality_,this->basisCellTopology_.getDimension());
204 dofCoords(0,0) = -1.0;
205 dofCoords(1,0) = 1.0;
207 this->dofCoords_ = Kokkos::create_mirror_view(
typename SpT::memory_space(), dofCoords);
208 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_LINE_C1_FEM()
Constructor.