Intrepid2
Intrepid2_HGRAD_TRI_Cn_FEM_ORTH.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_TRI_CN_FEM_ORTH_HPP__
17 #define __INTREPID2_HGRAD_TRI_CN_FEM_ORTH_HPP__
18 
19 #include "Intrepid2_Basis.hpp"
20 
21 namespace Intrepid2 {
22 
32 namespace Impl {
33 
37 template<typename OutputViewType,
38 typename inputViewType,
39 typename workViewType,
40 bool hasDeriv, ordinal_type n>
42  KOKKOS_INLINE_FUNCTION
43  static void
44  generate( OutputViewType output,
45  const inputViewType input,
46  workViewType work,
47  const ordinal_type p );
48 };
49 
53 template<typename OutputViewType,
54 typename inputViewType,
55 typename workViewType,
56 bool hasDeriv>
57 struct OrthPolynomialTri<OutputViewType,inputViewType,workViewType,hasDeriv,0> {
58  KOKKOS_INLINE_FUNCTION
59  static void
60  generate( OutputViewType output,
61  const inputViewType input,
62  workViewType work,
63  const ordinal_type p );
64 };
65 
69 template<typename OutputViewType,
70 typename inputViewType,
71 typename workViewType,
72 bool hasDeriv>
73 struct OrthPolynomialTri<OutputViewType,inputViewType,workViewType,hasDeriv,1> {
74  KOKKOS_INLINE_FUNCTION
75  static void
76  generate( OutputViewType output,
77  const inputViewType input,
78  workViewType work,
79  const ordinal_type p );
80 };
81 
86 public:
87 
91  template<EOperator opType>
92  struct Serial {
93  template<typename OutputViewType,
94  typename inputViewType,
95  typename workViewType>
96  KOKKOS_INLINE_FUNCTION
97  static void
98  getValues( OutputViewType output,
99  const inputViewType input,
100  workViewType work,
101  const ordinal_type order);
102  };
103 
104  template<typename DeviceType, ordinal_type numPtsPerEval,
105  typename outputValueValueType, class ...outputValueProperties,
106  typename inputPointValueType, class ...inputPointProperties>
107  static void
108  getValues( const typename DeviceType::execution_space& space,
109  Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
110  const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
111  const ordinal_type order,
112  const EOperator operatorType );
113 
117  template<typename outputValueViewType,
118  typename inputPointViewType,
119  typename workViewType,
120  EOperator opType,
121  ordinal_type numPtsEval>
122  struct Functor {
123  outputValueViewType _outputValues;
124  const inputPointViewType _inputPoints;
125  workViewType _work;
126  const ordinal_type _order;
127 
128  KOKKOS_INLINE_FUNCTION
129  Functor( outputValueViewType outputValues_,
130  inputPointViewType inputPoints_,
131  workViewType work_,
132  const ordinal_type order_ )
133  : _outputValues(outputValues_), _inputPoints(inputPoints_), _work(work_),_order(order_){}
134 
135  KOKKOS_INLINE_FUNCTION
136  void operator()(const size_type iter) const {
137  const auto ptBegin = Util<ordinal_type>::min(iter*numPtsEval, _inputPoints.extent(0));
138  const auto ptEnd = Util<ordinal_type>::min(ptBegin+numPtsEval, _inputPoints.extent(0));
139 
140  const auto ptRange = Kokkos::pair<ordinal_type,ordinal_type>(ptBegin, ptEnd);
141  const auto input = Kokkos::subview( _inputPoints, ptRange, Kokkos::ALL() );
142 
143  switch (opType) {
144  case OPERATOR_VALUE : {
145  auto output = Kokkos::subview( _outputValues, Kokkos::ALL(), ptRange );
146  Serial<opType>::getValues( output, input, _work, _order ); //here work is not used
147  break;
148  }
149  case OPERATOR_GRAD :
150  case OPERATOR_D1 :
151  {
152  const auto work = Kokkos::subview( _work, Kokkos::ALL(), ptRange, Kokkos::ALL() );
153  auto output = Kokkos::subview( _outputValues, Kokkos::ALL(), ptRange, Kokkos::ALL() );
154  Serial<opType>::getValues( output, input, work, _order);
155  break;
156  }
157  case OPERATOR_D2 :
158  case OPERATOR_D3 :
159  case OPERATOR_D4 :
160  case OPERATOR_D5 :
161  case OPERATOR_D6 :
162  case OPERATOR_D7 :
163  case OPERATOR_D8 :
164  case OPERATOR_D9 :
165  case OPERATOR_D10 :
166  {
167  auto output = Kokkos::subview( _outputValues, Kokkos::ALL(), ptRange, Kokkos::ALL() );
168  Serial<opType>::getValues( output, input, _work, _order); //here work is not used
169  break;
170  }
171  default: {
172  INTREPID2_TEST_FOR_ABORT( true,
173  ">>> ERROR: (Intrepid2::Basis_HGRAD_TRI_Cn_FEM_ORTH::Functor) operator is not supported");
174 
175  }
176  }
177  }
178  };
179 
180 };
181 
182 }
183 
184 template<typename DeviceType = void,
185  typename outputValueType = double,
186  typename pointValueType = double>
188  : public Basis<DeviceType,outputValueType,pointValueType> {
189  public:
190  typedef double value_type;
191 
193  using typename BasisBase::ExecutionSpace;
194 
195  using typename BasisBase::OrdinalTypeArray1DHost;
196  using typename BasisBase::OrdinalTypeArray2DHost;
197  using typename BasisBase::OrdinalTypeArray3DHost;
198 
199  using typename BasisBase::OutputViewType;
200  using typename BasisBase::PointViewType ;
201  using typename BasisBase::ScalarViewType;
202 
205  Basis_HGRAD_TRI_Cn_FEM_ORTH( const ordinal_type order );
206 
207  using BasisBase::getValues;
208 
209  virtual
210  void
211  getValues( const ExecutionSpace& space,
212  OutputViewType outputValues,
213  const PointViewType inputPoints,
214  const EOperator operatorType = OPERATOR_VALUE ) const override {
215  #ifdef HAVE_INTREPID2_DEBUG
216  Intrepid2::getValues_HGRAD_Args(outputValues,
217  inputPoints,
218  operatorType,
219  this->getBaseCellTopology(),
220  this->getCardinality() );
221  #endif
222  constexpr ordinal_type numPtsPerEval = Parameters::MaxNumPtsPerBasisEval;
223  Impl::Basis_HGRAD_TRI_Cn_FEM_ORTH::
224  getValues<DeviceType,numPtsPerEval>(space,
225  outputValues,
226  inputPoints,
227  this->getDegree(),
228  operatorType);
229  }
230 };
231 
232 }// namespace Intrepid2
233 
235 
236 #endif
237 
Kokkos::View< ordinal_type *, typename ExecutionSpace::array_layout, Kokkos::HostSpace > OrdinalTypeArray1DHost
View type for 1d host array.
small utility functions
ordinal_type getCardinality() const
Returns cardinality of the basis.
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...
Implementation of the default H(grad)-compatible orthogonal basis (Dubiner) of arbitrary degree on tr...
Kokkos::DynRankView< scalarType, Kokkos::LayoutStride, DeviceType > ScalarViewType
View type for scalars.
Kokkos::DynRankView< PointValueType, Kokkos::LayoutStride, DeviceType > PointViewType
View type for input points.
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.
See Intrepid2::Basis_HGRAD_TRI_Cn_FEM_ORTH.
See Intrepid2::Basis_HGRAD_TRI_Cn_FEM_ORTH.
Kokkos::View< ordinal_type **, typename ExecutionSpace::array_layout, Kokkos::HostSpace > OrdinalTypeArray2DHost
View type for 2d host array.
typename DeviceType::execution_space ExecutionSpace
(Kokkos) Execution space for basis.
static constexpr ordinal_type MaxNumPtsPerBasisEval
The maximum number of points to eval in serial mode.
Kokkos::DynRankView< OutputValueType, Kokkos::LayoutStride, DeviceType > OutputViewType
View type for basis value output.
Definition file for FEM orthogonal basis functions of arbitrary degree for H(grad) functions on TRI...
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.
Basis_HGRAD_TRI_Cn_FEM_ORTH(const ordinal_type order)
Constructor.
Kokkos::View< ordinal_type ***, typename ExecutionSpace::array_layout, Kokkos::HostSpace > OrdinalTypeArray3DHost
View type for 3d host array.
Kokkos::DynRankView< OutputValueType, Kokkos::LayoutStride, DeviceType > OutputViewType
View type for basis value output.
ordinal_type getDegree() const
Returns the degree of the basis.
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.