Intrepid2
Intrepid2_HGRAD_TET_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
17#ifndef __INTREPID2_HGRAD_TET_Cn_FEM_ORTH_HPP__
18#define __INTREPID2_HGRAD_TET_Cn_FEM_ORTH_HPP__
19
20#include "Intrepid2_Basis.hpp"
21
22namespace Intrepid2 {
23
32namespace Impl {
33
36template<typename OutputViewType,
37typename inputViewType,
38typename workViewType,
39bool hasDeriv, ordinal_type n>
41 KOKKOS_INLINE_FUNCTION
42 static void
43 generate( OutputViewType output,
44 const inputViewType input,
45 workViewType work,
46 const ordinal_type p );
47};
48
51template<typename OutputViewType,
52typename inputViewType,
53typename workViewType,
54bool hasDeriv>
55struct OrthPolynomialTet<OutputViewType,inputViewType,workViewType,hasDeriv,0> {
56 KOKKOS_INLINE_FUNCTION
57 static void
58 generate( OutputViewType output,
59 const inputViewType input,
60 workViewType work,
61 const ordinal_type p );
62};
63
66template<typename OutputViewType,
67typename inputViewType,
68typename workViewType,
69bool hasDeriv>
70struct OrthPolynomialTet<OutputViewType,inputViewType,workViewType,hasDeriv,1> {
71 KOKKOS_INLINE_FUNCTION
72 static void
73 generate( OutputViewType output,
74 const inputViewType input,
75 workViewType work,
76 const ordinal_type p );
77};
78
83public:
84
88 template<EOperator opType>
89 struct Serial {
90 template<typename OutputViewType,
91 typename inputViewType,
92 typename workViewType>
93 KOKKOS_INLINE_FUNCTION
94 static void
95 getValues( OutputViewType output,
96 const inputViewType input,
97 workViewType work,
98 const ordinal_type order);
99 };
100
101 template<typename DeviceType, ordinal_type numPtsPerEval,
102 typename outputValueValueType, class ...outputValueProperties,
103 typename inputPointValueType, class ...inputPointProperties>
104 static void
105 getValues( const typename DeviceType::execution_space& space,
106 Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
107 const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
108 const ordinal_type order,
109 const EOperator operatorType );
110
114 template<typename outputValueViewType,
115 typename inputPointViewType,
116 typename workViewType,
117 EOperator opType,
118 ordinal_type numPtsEval>
119 struct Functor {
120 outputValueViewType _outputValues;
121 const inputPointViewType _inputPoints;
122 workViewType _work;
123 const ordinal_type _order;
124
125 KOKKOS_INLINE_FUNCTION
126 Functor( outputValueViewType outputValues_,
127 inputPointViewType inputPoints_,
128 workViewType work_,
129 const ordinal_type order_ )
130 : _outputValues(outputValues_), _inputPoints(inputPoints_), _work(work_),_order(order_){}
131
132 KOKKOS_INLINE_FUNCTION
133 void operator()(const size_type iter) const {
134 const auto ptBegin = Util<ordinal_type>::min(iter*numPtsEval, _inputPoints.extent(0));
135 const auto ptEnd = Util<ordinal_type>::min(ptBegin+numPtsEval, _inputPoints.extent(0));
136
137 const auto ptRange = Kokkos::pair<ordinal_type,ordinal_type>(ptBegin, ptEnd);
138 const auto input = Kokkos::subview( _inputPoints, ptRange, Kokkos::ALL() );
139
140 switch (opType) {
141 case OPERATOR_VALUE : {
142 auto output = Kokkos::subview( _outputValues, Kokkos::ALL(), ptRange );
143 Serial<opType>::getValues( output, input, _work, _order ); //here work is not used
144 break;
145 }
146 case OPERATOR_GRAD :
147 case OPERATOR_D1 :
148 {
149 const auto work = Kokkos::subview( _work, Kokkos::ALL(), ptRange, Kokkos::ALL() );
150 auto output = Kokkos::subview( _outputValues, Kokkos::ALL(), ptRange, Kokkos::ALL() );
151 Serial<opType>::getValues( output, input, work, _order);
152 break;
153 }
154 case OPERATOR_D2 :
155 case OPERATOR_D3 :
156 case OPERATOR_D4 :
157 case OPERATOR_D5 :
158 case OPERATOR_D6 :
159 case OPERATOR_D7 :
160 case OPERATOR_D8 :
161 case OPERATOR_D9 :
162 case OPERATOR_D10 :
163 {
164 auto output = Kokkos::subview( _outputValues, Kokkos::ALL(), ptRange, Kokkos::ALL() );
165 Serial<opType>::getValues( output, input, _work, _order); //here work is not used
166 break;
167 }
168 default: {
169 INTREPID2_TEST_FOR_ABORT( true,
170 ">>> ERROR: (Intrepid2::Basis_HGRAD_TET_Cn_FEM_ORTH::Functor) operator is not supported");
171
172 }
173 }
174 }
175 };
176
177};
178
179}
180
181template<typename DeviceType = void,
182 typename outputValueType = double,
183 typename pointValueType = double>
185 : public Basis<DeviceType,outputValueType,pointValueType> {
186 public:
187 typedef double value_type;
188
190 using typename BasisBase::ExecutionSpace;
191
195
196 using typename BasisBase::OutputViewType;
197 using typename BasisBase::PointViewType ;
198 using typename BasisBase::ScalarViewType;
199
202 Basis_HGRAD_TET_Cn_FEM_ORTH( const ordinal_type order );
203
205
206 virtual
207 void
209 OutputViewType outputValues,
210 const PointViewType inputPoints,
211 const EOperator operatorType = OPERATOR_VALUE ) const override {
212 #ifdef HAVE_INTREPID2_DEBUG
214 inputPoints,
215 operatorType,
216 this->getBaseCellTopology(),
217 this->getCardinality() );
218 #endif
219 constexpr ordinal_type numPtsPerEval = Parameters::MaxNumPtsPerBasisEval;
220 Impl::Basis_HGRAD_TET_Cn_FEM_ORTH::
221 getValues<DeviceType,numPtsPerEval>(space,
222 outputValues,
223 inputPoints,
224 this->getDegree(),
225 operatorType);
226 }
227};
228
229}// namespace Intrepid2
230
232
233#endif
234
Header file for the abstract base class Intrepid2::Basis.
void getValues_HGRAD_Args(const outputValueViewType outputValues, const inputPointViewType inputPoints, const EOperator operatorType, const shards::CellTopology cellTopo, const ordinal_type basisCard)
Runtime check of the arguments for the getValues method in an HGRAD-conforming FEM basis....
Definition file for FEM orthogonal basis functions of degree n for H(grad) functions on TET cells.
Implementation of the default H(grad)-compatible orthogonal basis of arbitrary degree on tetrahedron.
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.
An abstract base class that defines interface for concrete basis implementations for Finite Element (...
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.
Kokkos::DynRankView< OutputValueType, Kokkos::LayoutStride, DeviceType > OutputViewType
View type for basis value output.
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.
ordinal_type getCardinality() const
Returns cardinality of the basis.
Kokkos::DynRankView< scalarType, Kokkos::LayoutStride, DeviceType > ScalarViewType
View type for scalars.
Kokkos::View< ordinal_type **, typename ExecutionSpace::array_layout, Kokkos::HostSpace > OrdinalTypeArray2DHost
View type for 2d host array.
shards::CellTopology getBaseCellTopology() const
Returns the base cell topology for which the basis is defined. See Shards documentation https://trili...
Kokkos::View< ordinal_type *, typename ExecutionSpace::array_layout, Kokkos::HostSpace > OrdinalTypeArray1DHost
View type for 1d 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.
small utility functions
See Intrepid2::Basis_HGRAD_TET_Cn_FEM_ORTH.