16 #ifndef __INTREPID2_HGRAD_LINE_C1_FEM_DEF_HPP__
17 #define __INTREPID2_HGRAD_LINE_C1_FEM_DEF_HPP__
25 template<EOperator opType>
26 template<
typename OutputViewType,
27 typename inputViewType>
28 KOKKOS_INLINE_FUNCTION
30 Basis_HGRAD_LINE_C1_FEM::Serial<opType>::
31 getValues( OutputViewType output,
32 const inputViewType input ) {
34 case OPERATOR_VALUE : {
35 const auto x = input(0);
37 output.access(0) = (1.0 - x)/2.0;
38 output.access(1) = (1.0 + x)/2.0;
41 case OPERATOR_GRAD : {
42 output.access(0, 0) = -0.5;
43 output.access(1, 0) = 0.5;
47 const ordinal_type jend = output.extent(1);
48 const ordinal_type iend = output.extent(0);
50 for (ordinal_type j=0;j<jend;++j)
51 for (ordinal_type i=0;i<iend;++i)
52 output.access(i, j) = 0.0;
56 INTREPID2_TEST_FOR_ABORT( opType != OPERATOR_VALUE &&
57 opType != OPERATOR_GRAD &&
58 opType != OPERATOR_MAX,
59 ">>> ERROR: (Intrepid2::Basis_HGRAD_LINE_C1_FEM::Serial::getValues) operator is not supported");
66 typename outputValueValueType,
class ...outputValueProperties,
67 typename inputPointValueType,
class ...inputPointProperties>
69 Basis_HGRAD_LINE_C1_FEM::
70 getValues(
const typename DT::execution_space& space,
71 Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
72 const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
73 const EOperator operatorType ) {
74 typedef Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValueViewType;
75 typedef Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPointViewType;
76 typedef typename ExecSpace<typename inputPointViewType::execution_space,typename DT::execution_space>::ExecSpaceType ExecSpaceType;
79 const auto loopSize = inputPoints.extent(0);
80 Kokkos::RangePolicy<ExecSpaceType,Kokkos::Schedule<Kokkos::Static> > policy(space, 0, loopSize);
82 switch (operatorType) {
84 case OPERATOR_VALUE: {
85 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_VALUE> FunctorType;
86 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
93 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_GRAD> FunctorType;
94 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
106 typedef Functor<outputValueViewType,inputPointViewType,OPERATOR_MAX> FunctorType;
107 Kokkos::parallel_for( policy, FunctorType(outputValues, inputPoints) );
111 INTREPID2_TEST_FOR_EXCEPTION( !Intrepid2::isValidOperator(operatorType), std::invalid_argument,
112 ">>> ERROR (Basis_HGRAD_LINE_C1_FEM): Invalid operator type");
123 template<
typename DT,
typename OT,
typename PT>
126 const ordinal_type spaceDim = 1;
127 this->basisCardinality_ = 2;
128 this->basisDegree_ = 1;
129 this->basisCellTopologyKey_ = shards::Line<2>::key;
130 this->basisType_ = BASIS_FEM_DEFAULT;
131 this->basisCoordinates_ = COORDINATES_CARTESIAN;
132 this->functionSpace_ = FUNCTION_SPACE_HGRAD;
137 const ordinal_type tagSize = 4;
138 const ordinal_type posScDim = 0;
139 const ordinal_type posScOrd = 1;
140 const ordinal_type posDfOrd = 2;
143 ordinal_type tags[8] = { 0, 0, 0, 1,
153 this->setOrdinalTagData(this->tagToOrdinal_,
156 this->basisCardinality_,
170 Kokkos::DynRankView<typename ScalarViewType::value_type,typename DT::execution_space::array_layout,Kokkos::HostSpace>
171 dofCoords(
"dofCoordsHost", this->basisCardinality_,spaceDim);
173 dofCoords(0,0) = -1.0;
174 dofCoords(1,0) = 1.0;
176 this->dofCoords_ = Kokkos::create_mirror_view(
typename DT::memory_space(), dofCoords);
177 Kokkos::deep_copy(this->dofCoords_, dofCoords);
180 template<
typename DT,
typename OT,
typename PT>
183 ordinal_type& perTeamSpaceSize,
184 ordinal_type& perThreadSpaceSize,
186 const EOperator operatorType)
const {
187 perTeamSpaceSize = 0;
188 perThreadSpaceSize = 0;
191 template<
typename DT,
typename OT,
typename PT>
192 KOKKOS_INLINE_FUNCTION
195 OutputViewType outputValues,
196 const PointViewType inputPoints,
197 const EOperator operatorType,
198 const typename Kokkos::TeamPolicy<typename DT::execution_space>::member_type& team_member,
199 const typename DT::execution_space::scratch_memory_space & scratchStorage,
200 const ordinal_type subcellDim,
201 const ordinal_type subcellOrdinal)
const {
203 INTREPID2_TEST_FOR_ABORT( !((subcellDim <= 0) && (subcellOrdinal == -1)),
204 ">>> ERROR: (Intrepid2::Basis_HGRAD_LINE_C1_FEM::getValues), The capability of selecting subsets of basis functions has not been implemented yet.");
206 (void) scratchStorage;
208 const int numPoints = inputPoints.extent(0);
210 switch(operatorType) {
212 Kokkos::parallel_for (Kokkos::TeamThreadRange (team_member, numPoints), [=] (ordinal_type& pt) {
213 auto output = Kokkos::subview( outputValues, Kokkos::ALL(), pt, Kokkos::ALL() );
214 const auto input = Kokkos::subview( inputPoints, pt, Kokkos::ALL() );
219 Kokkos::parallel_for (Kokkos::TeamThreadRange (team_member, numPoints), [=] (ordinal_type& pt) {
220 auto output = Kokkos::subview( outputValues, Kokkos::ALL(), pt, Kokkos::ALL() );
221 const auto input = Kokkos::subview( inputPoints, pt, Kokkos::ALL() );
222 Impl::Basis_HGRAD_LINE_C1_FEM::Serial<OPERATOR_GRAD>::getValues( output, input);
Kokkos::DynRankView< PointValueType, Kokkos::LayoutStride, DeviceType > PointViewType
View type for input points.
virtual void getValues(const ExecutionSpace &space, OutputViewType outputValues, const PointViewType inputPoints, const EOperator operatorType=OPERATOR_VALUE) const override
Evaluation of a FEM basis on a reference cell.
Kokkos::View< ordinal_type *, typename ExecutionSpace::array_layout, Kokkos::HostSpace > OrdinalTypeArray1DHost
View type for 1d host array.
virtual void getScratchSpaceSize(ordinal_type &perTeamSpaceSize, ordinal_type &perThreadSpaceSize, const PointViewType inputPointsconst, const EOperator operatorType=OPERATOR_VALUE) const override
Return the size of the scratch space, in bytes, needed for using the team-level implementation of get...
Basis_HGRAD_LINE_C1_FEM()
Constructor.
See Intrepid2::Basis_HGRAD_LINE_C1_FEM.