Intrepid2
Intrepid2_HGRAD_PYR_C1_FEM.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_PYR_C1_FEM_HPP__
17 #define __INTREPID2_HGRAD_PYR_C1_FEM_HPP__
18 
19 #include "Intrepid2_Basis.hpp"
22 
23 namespace Intrepid2 {
24 
53  namespace Impl {
54 
59  public:
60  typedef struct Pyramid<5> cell_topology_type;
64  template<EOperator opType>
65  struct Serial {
66  template<typename OutputViewType,
67  typename inputViewType>
68  KOKKOS_INLINE_FUNCTION
69  static void
70  getValues( OutputViewType output,
71  const inputViewType input );
72 
73  };
74 
75  template<typename DeviceType,
76  typename outputValueValueType, class ...outputValueProperties,
77  typename inputPointValueType, class ...inputPointProperties>
78  static void
79  getValues( Kokkos::DynRankView<outputValueValueType,outputValueProperties...> outputValues,
80  const Kokkos::DynRankView<inputPointValueType, inputPointProperties...> inputPoints,
81  const EOperator operatorType);
82 
86  template<typename outputValueViewType,
87  typename inputPointViewType,
88  EOperator opType>
89  struct Functor {
90  outputValueViewType _outputValues;
91  const inputPointViewType _inputPoints;
92 
93  KOKKOS_INLINE_FUNCTION
94  Functor( outputValueViewType outputValues_,
95  inputPointViewType inputPoints_ )
96  : _outputValues(outputValues_), _inputPoints(inputPoints_) {}
97 
98  KOKKOS_INLINE_FUNCTION
99  void operator()(const ordinal_type pt) const {
100  switch (opType) {
101  case OPERATOR_VALUE : {
102  auto output = Kokkos::subview( _outputValues, Kokkos::ALL(), pt );
103  const auto input = Kokkos::subview( _inputPoints, pt, Kokkos::ALL() );
104  Serial<opType>::getValues( output, input );
105  break;
106  }
107  case OPERATOR_GRAD :
108  case OPERATOR_CURL :
109  case OPERATOR_D2 : {
110  auto output = Kokkos::subview( _outputValues, Kokkos::ALL(), pt, Kokkos::ALL() );
111  const auto input = Kokkos::subview( _inputPoints, pt, Kokkos::ALL() );
112  Serial<opType>::getValues( output, input );
113  break;
114  }
115  default: {
116  INTREPID2_TEST_FOR_ABORT( opType != OPERATOR_VALUE &&
117  opType != OPERATOR_GRAD &&
118  opType != OPERATOR_CURL &&
119  opType != OPERATOR_D2,
120  ">>> ERROR: (Intrepid2::Basis_HGRAD_PYR_C1_FEM::Serial::getValues) operator is not supported");
121  }
122  }
123  }
124  };
125 
126  };
127  }
128  template<typename DeviceType = void,
129  typename outputValueType = double,
130  typename pointValueType = double>
131  class Basis_HGRAD_PYR_C1_FEM : public Basis<DeviceType,outputValueType,pointValueType> {
132  public:
133  using OrdinalTypeArray1DHost = typename Basis<DeviceType,outputValueType,pointValueType>::OrdinalTypeArray1DHost;
134  using OrdinalTypeArray2DHost = typename Basis<DeviceType,outputValueType,pointValueType>::OrdinalTypeArray2DHost;
135  using OrdinalTypeArray3DHost = typename Basis<DeviceType,outputValueType,pointValueType>::OrdinalTypeArray3DHost;
136 
140 
144 
146 
147  virtual
148  void
149  getValues( OutputViewType outputValues,
150  const PointViewType inputPoints,
151  const EOperator operatorType = OPERATOR_VALUE ) const override {
152 #ifdef HAVE_INTREPID2_DEBUG
153  // Verify arguments
154  Intrepid2::getValues_HGRAD_Args(outputValues,
155  inputPoints,
156  operatorType,
157  this->getBaseCellTopology(),
158  this->getCardinality() );
159 #endif
160  Impl::Basis_HGRAD_PYR_C1_FEM::
161  getValues<DeviceType>( outputValues,
162  inputPoints,
163  operatorType );
164  }
165 
166  virtual void
167  getScratchSpaceSize( ordinal_type& perTeamSpaceSize,
168  ordinal_type& perThreadSpaceSize,
169  const PointViewType inputPointsconst,
170  const EOperator operatorType = OPERATOR_VALUE) const override;
171 
172  KOKKOS_INLINE_FUNCTION
173  virtual void
174  getValues(
175  OutputViewType outputValues,
176  const PointViewType inputPoints,
177  const EOperator operatorType,
178  const typename Kokkos::TeamPolicy<typename DeviceType::execution_space>::member_type& team_member,
179  const typename DeviceType::execution_space::scratch_memory_space & scratchStorage,
180  const ordinal_type subcellDim = -1,
181  const ordinal_type subcellOrdinal = -1) const override;
182 
183  virtual
184  void
185  getDofCoords( ScalarViewType dofCoords ) const override {
186 #ifdef HAVE_INTREPID2_DEBUG
187  // Verify rank of output array.
188  INTREPID2_TEST_FOR_EXCEPTION( dofCoords.rank() != 2, std::invalid_argument,
189  ">>> ERROR: (Intrepid2::Basis_HGRAD_PYR_C1_FEM::getDofCoords) rank = 2 required for dofCoords array");
190  // Verify 0th dimension of output array.
191  INTREPID2_TEST_FOR_EXCEPTION( static_cast<ordinal_type>(dofCoords.extent(0)) != this->getCardinality(), std::invalid_argument,
192  ">>> ERROR: (Intrepid2::Basis_HGRAD_PYR_C1_FEM::getDofCoords) mismatch in number of dof and 0th dimension of dofCoords array");
193  // Verify 1st dimension of output array.
194  INTREPID2_TEST_FOR_EXCEPTION( dofCoords.extent(1) != this->getBaseCellTopology().getDimension(), std::invalid_argument,
195  ">>> ERROR: (Intrepid2::Basis_HGRAD_PYR_C1_FEM::getDofCoords) incorrect reference cell (1st) dimension in dofCoords array");
196 #endif
197  Kokkos::deep_copy(dofCoords, this->dofCoords_);
198  }
199 
200  virtual
201  void
202  getDofCoeffs( ScalarViewType dofCoeffs ) const override {
203 #ifdef HAVE_INTREPID2_DEBUG
204  // Verify rank of output array.
205  INTREPID2_TEST_FOR_EXCEPTION( dofCoeffs.rank() != 1, std::invalid_argument,
206  ">>> ERROR: (Intrepid2::Basis_HGRAD_PYR_C1_FEM::getdofCoeffs) rank = 1 required for dofCoeffs array");
207  // Verify 0th dimension of output array.
208  INTREPID2_TEST_FOR_EXCEPTION( static_cast<ordinal_type>(dofCoeffs.extent(0)) != this->getCardinality(), std::invalid_argument,
209  ">>> ERROR: (Intrepid2::Basis_HGRAD_PYR_C1_FEM::getdofCoeffs) mismatch in number of dof and 0th dimension of dofCoeffs array");
210 #endif
211  Kokkos::deep_copy(dofCoeffs, 1.0);
212  }
213 
214  virtual
215  const char*
216  getName() const override {
217  return "Intrepid2_HGRAD_PYR_C1_FEM";
218  }
219 
228  BasisPtr<DeviceType,outputValueType,pointValueType>
229  getSubCellRefBasis(const ordinal_type subCellDim, const ordinal_type subCellOrd) const override{
230  if(subCellDim == 1) {
231  return Teuchos::rcp(new
233  } else if(subCellDim == 2) {
234  if(subCellOrd == 0) //pyramid base
235  return Teuchos::rcp(new
237  else
238  return Teuchos::rcp(new
240  }
241  INTREPID2_TEST_FOR_EXCEPTION(true,std::invalid_argument,"Input parameters out of bounds");
242  }
243 
244  BasisPtr<typename Kokkos::HostSpace::device_type,outputValueType,pointValueType>
245  getHostBasis() const override{
247  }
248  };
249 }// namespace Intrepid2
250 
252 
253 #endif
Implementation of the default H(grad)-compatible FEM basis of degree 1 on Quadrilateral cell...
Header file for the Intrepid2::Basis_HGRAD_TRI_C1_FEM class.
ordinal_type getCardinality() const
Returns cardinality of the basis.
Header file for the Intrepid2::Basis_HGRAD_QUAD_C1_FEM class.
Implementation of the default H(grad)-compatible FEM basis of degree 1 on Triangle cell...
Implementation of the default H(grad)-compatible FEM basis of degree 1 on Pyramid cell...
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...
See Intrepid2::Basis_HGRAD_PYR_C1_FEM.
BasisPtr< typename Kokkos::HostSpace::device_type, outputValueType, pointValueType > getHostBasis() const override
Creates and returns a Basis object whose DeviceType template argument is Kokkos::HostSpace::device_ty...
Definition file for FEM basis functions of degree 1 for H(grad) functions on PYR cells.
Implementation of the default H(grad)-compatible FEM basis of degree 1 on Line cell.
BasisPtr< DeviceType, outputValueType, pointValueType > getSubCellRefBasis(const ordinal_type subCellDim, const ordinal_type subCellOrd) const override
returns the basis associated to a subCell.
Kokkos::DynRankView< scalarType, DeviceType > dofCoords_
Coordinates of degrees-of-freedom for basis functions defined in physical space.
virtual const char * getName() const override
Returns basis name.
Header file for the abstract base class Intrepid2::Basis.