Intrepid2
Intrepid2_HGRAD_LINE_Cn_FEM_JACOBI.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Intrepid2 Package
4 //
5 // Copyright 2007 NTESS and the Intrepid2 contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
16 #ifndef __INTREPID2_HGRAD_LINE_CN_FEM_JACOBI_HPP__
17 #define __INTREPID2_HGRAD_LINE_CN_FEM_JACOBI_HPP__
18 
19 #include "Intrepid2_Basis.hpp"
20 #include "Intrepid2_Polylib.hpp"
21 
22 namespace Intrepid2 {
23 
98  namespace Impl {
99 
104  public:
105 
109  template<EOperator opType>
110  struct Serial {
111  template<typename OutputViewType,
112  typename inputViewType>
113  KOKKOS_INLINE_FUNCTION
114  static void
115  getValues( OutputViewType output,
116  const inputViewType input,
117  const ordinal_type order,
118  const double alpha,
119  const double beta,
120  const ordinal_type opDn = 0 );
121  };
122 
123  template<typename DeviceType, ordinal_type numPtsPerEval,
124  typename outputValueValueType, class ...outputValueProperties,
125  typename inputPointValueType, class ...inputPointProperties>
126  static void
127  getValues( const typename DeviceType::execution_space& space,
128  Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
129  const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
130  const ordinal_type order,
131  const double alpha,
132  const double beta,
133  const EOperator operatorType );
134 
138  template<typename outputValueViewType,
139  typename inputPointViewType,
140  EOperator opType,
141  ordinal_type numPtsEval>
142  struct Functor {
143  outputValueViewType _outputValues;
144  const inputPointViewType _inputPoints;
145  const ordinal_type _order;
146  const double _alpha, _beta;
147  const ordinal_type _opDn;
148 
149  KOKKOS_INLINE_FUNCTION
150  Functor( outputValueViewType outputValues_,
151  inputPointViewType inputPoints_,
152  const ordinal_type order_,
153  const double alpha_,
154  const double beta_,
155  const ordinal_type opDn_ = 0 )
156  : _outputValues(outputValues_), _inputPoints(inputPoints_),
157  _order(order_), _alpha(alpha_), _beta(beta_), _opDn(opDn_) {}
158 
159  KOKKOS_INLINE_FUNCTION
160  void operator()(const size_type iter) const {
161  const auto ptBegin = Util<ordinal_type>::min(iter*numPtsEval, _inputPoints.extent(0));
162  const auto ptEnd = Util<ordinal_type>::min(ptBegin+numPtsEval, _inputPoints.extent(0));
163 
164  const auto ptRange = Kokkos::pair<ordinal_type,ordinal_type>(ptBegin, ptEnd);
165  const auto input = Kokkos::subview( _inputPoints, ptRange, Kokkos::ALL() );
166 
167  if (input.extent(0)) {
168  switch (opType) {
169  case OPERATOR_VALUE : {
170  auto output = Kokkos::subview( _outputValues, Kokkos::ALL(), ptRange );
171  Serial<opType>::getValues( output, input, _order, _alpha, _beta );
172  break;
173  }
174  case OPERATOR_GRAD : {
175  auto output = Kokkos::subview( _outputValues, Kokkos::ALL(), ptRange, Kokkos::ALL() );
176  Serial<opType>::getValues( output, input, _order, _alpha, _beta );
177  break;
178  }
179  case OPERATOR_Dn: {
180  auto output = Kokkos::subview( _outputValues, Kokkos::ALL(), ptRange, Kokkos::ALL() );
181  Serial<opType>::getValues( output, input, _order, _alpha, _beta, _opDn );
182  break;
183  }
184  default: {
185  INTREPID2_TEST_FOR_ABORT( true,
186  ">>> ERROR: (Intrepid2::Basis_HGRAD_LINE_Cn_FEM_JACOBI::Functor) operator is not supported");
187 
188  }
189  }
190  }
191  }
192  };
193  };
194  }
195 
196  template<typename DeviceType = void,
197  typename outputValueType = double,
198  typename pointValueType = double>
200  : public Basis<DeviceType,outputValueType,pointValueType> {
201  public:
202  typedef double value_type;
203 
205  using typename BasisBase::ExecutionSpace;
206 
207  using typename BasisBase::OrdinalTypeArray1DHost;
208  using typename BasisBase::OrdinalTypeArray2DHost;
209  using typename BasisBase::OrdinalTypeArray3DHost;
210 
211  using typename BasisBase::OutputViewType;
212  using typename BasisBase::PointViewType ;
213  using typename BasisBase::ScalarViewType;
214 
217  Basis_HGRAD_LINE_Cn_FEM_JACOBI( const ordinal_type order,
218  const double alpha = 0,
219  const double beta = 0 );
220 
221  using BasisBase::getValues;
222 
223  virtual
224  void
225  getValues( const ExecutionSpace& space,
226  OutputViewType outputValues,
227  const PointViewType inputPoints,
228  const EOperator operatorType = OPERATOR_VALUE ) const override {
229 #ifdef HAVE_INTREPID2_DEBUG
230  Intrepid2::getValues_HGRAD_Args(outputValues,
231  inputPoints,
232  operatorType,
233  this->getBaseCellTopology(),
234  this->getCardinality() );
235 #endif
236  constexpr ordinal_type numPtsPerEval = 1;
237  Impl::Basis_HGRAD_LINE_Cn_FEM_JACOBI::
238  getValues<DeviceType,numPtsPerEval>(space,
239  outputValues,
240  inputPoints,
241  this->getDegree(),
242  this->alpha_,
243  this->beta_,
244  operatorType);
245  }
246 
247  private:
248  double alpha_, beta_;
249 
250  };
251 
252 }
253 
255 
256 #endif
Kokkos::DynRankView< OutputValueType, Kokkos::LayoutStride, DeviceType > OutputViewType
View type for basis value output.
Kokkos::View< ordinal_type *, typename ExecutionSpace::array_layout, Kokkos::HostSpace > OrdinalTypeArray1DHost
View type for 1d host array.
small utility functions
Kokkos::DynRankView< PointValueType, Kokkos::LayoutStride, DeviceType > PointViewType
View type for input points.
ordinal_type getCardinality() const
Returns cardinality of the basis.
Basis_HGRAD_LINE_Cn_FEM_JACOBI(const ordinal_type order, const double alpha=0, const double beta=0)
Constructor.
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.
Header file for Intrepid2::Polylib class providing orthogonal polynomial calculus and interpolation...
An abstract base class that defines interface for concrete basis implementations for Finite Element (...
shards::CellTopology getBaseCellTopology() const
Returns the base cell topology for which the basis is defined. See Shards documentation https://trili...
Kokkos::DynRankView< scalarType, Kokkos::LayoutStride, DeviceType > ScalarViewType
View type for scalars.
virtual KOKKOS_INLINE_FUNCTION void getValues(OutputViewType, const PointViewType, const EOperator, const typename Kokkos::TeamPolicy< ExecutionSpace >::member_type &teamMember, const typename ExecutionSpace::scratch_memory_space &scratchStorage, const ordinal_type subcellDim=-1, const ordinal_type subcellOrdinal=-1) const
Team-level evaluation of basis functions on a reference cell.
typename DeviceType::execution_space ExecutionSpace
(Kokkos) Execution space for basis.
Kokkos::View< ordinal_type **, typename ExecutionSpace::array_layout, Kokkos::HostSpace > OrdinalTypeArray2DHost
View type for 2d host array.
Kokkos::DynRankView< OutputValueType, Kokkos::LayoutStride, DeviceType > OutputViewType
View type for basis value output.
Implementation of the locally H(grad)-compatible FEM basis of variable order on the [-1...
Kokkos::View< ordinal_type ***, typename ExecutionSpace::array_layout, Kokkos::HostSpace > OrdinalTypeArray3DHost
View type for 3d host array.
ordinal_type getDegree() const
Returns the degree of the basis.
Definition file for FEM orthogonal basis functions of degree n for H(grad) functions on LINE...
Kokkos::DynRankView< PointValueType, Kokkos::LayoutStride, DeviceType > PointViewType
View type for input points.
Header file for the abstract base class Intrepid2::Basis.
typename DeviceType::execution_space ExecutionSpace
(Kokkos) Execution space for basis.