Intrepid2
Intrepid2_CubatureControlVolumeBoundary.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_CUBATURE_CONTROLVOLUME_BOUNDARY_HPP__
17 #define __INTREPID2_CUBATURE_CONTROLVOLUME_BOUNDARY_HPP__
18 
19 #include "Intrepid2_ConfigDefs.hpp"
20 #include "Intrepid2_Cubature.hpp"
21 
22 #include "Shards_CellTopology.hpp"
23 #include "Intrepid2_CellTools.hpp"
24 
26 
27 namespace Intrepid2{
28 
36  template<typename DeviceType = void,
37  typename pointValueType = double,
38  typename weightValueType = double>
40  : public Cubature<DeviceType,pointValueType,weightValueType> {
41  public:
42 
43  template<typename cubPointViewType,
44  typename subcvCoordViewType,
45  typename mapViewType>
46  struct Functor {
47  cubPointViewType _cubPoints;
48  const subcvCoordViewType _subcvCoords;
49  const mapViewType _sideMap;
50 
51  KOKKOS_INLINE_FUNCTION
52  Functor( cubPointViewType cubPoints_,
53  subcvCoordViewType subcvCoords_,
54  mapViewType sideMap_ )
55  : _cubPoints(cubPoints_),
56  _subcvCoords(subcvCoords_), _sideMap(sideMap_) {}
57 
58  KOKKOS_INLINE_FUNCTION
59  void operator()(const ordinal_type cell) const {
60  const ordinal_type numNodesPerSide = _sideMap(0);
61  const ordinal_type spaceDim = _cubPoints.extent(1);
62 
63  // compute side centers
64  typename cubPointViewType::value_type val[3] = {};
65  for (ordinal_type j=0;j<numNodesPerSide;++j) {
66  for (ordinal_type i=0;i<spaceDim;++i)
67  val[i] += _subcvCoords(cell, _sideMap(j+1), i);
68  }
69  for (ordinal_type i=0;i<spaceDim;++i)
70  _cubPoints(cell, i) = (val[i]/numNodesPerSide);
71 
72  }
73  };
74 
75  protected:
76 
79  shards::CellTopology primaryCellTopo_;
80 
83  shards::CellTopology subcvCellTopo_;
84 
87  ordinal_type degree_;
88 
91  ordinal_type sideIndex_;
92 
93  // cubature points and weights associated with sub-control volume.
94  Kokkos::View<ordinal_type**,Kokkos::HostSpace> boundarySidesHost_;
95  Kokkos::View<ordinal_type**,Kokkos::LayoutRight,DeviceType> sideNodeMap_;
96  Kokkos::DynRankView<pointValueType, DeviceType> sidePoints_;
97 
98  public:
99  typedef typename Cubature<DeviceType,pointValueType,weightValueType>::PointViewType PointViewType;
100  typedef typename Cubature<DeviceType,pointValueType,weightValueType>::weightViewType weightViewType;
101 
103 
111  virtual
112  void
113  getCubature( PointViewType cubPoints,
114  weightViewType cubWeights,
115  PointViewType cellCoords) const override;
116 
119  virtual
120  ordinal_type
121  getNumPoints() const override {
122  // one control volume boundary cubature point per subcell node (for now)
123  const ordinal_type sideDim = primaryCellTopo_.getDimension() - 1;
124  return primaryCellTopo_.getNodeCount(sideDim, sideIndex_);
125  }
126 
129  virtual
130  ordinal_type
131  getDimension() const override {
132  return primaryCellTopo_.getDimension();
133  }
134 
137  virtual
138  const char*
139  getName() const override {
140  return "CubatureControlVolumeBoundary";
141  }
142 
148  CubatureControlVolumeBoundary(const shards::CellTopology cellTopology,
149  const ordinal_type sideIndex);
150  virtual ~CubatureControlVolumeBoundary() {}
151 
152  };
153 
154 }
155 
157 
158 #endif
159 
Defines the base class for cubature (integration) rules in Intrepid.
ordinal_type degree_
The degree of the polynomials that are integrated exactly.
virtual ordinal_type getNumPoints() const override
Returns the number of cubature points.
Defines cubature (integration) rules over Neumann boundaries for control volume method.
CubatureControlVolumeBoundary(const shards::CellTopology cellTopology, const ordinal_type sideIndex)
Header file for the Intrepid2::Cubature class.
Definition file for the Intrepid2::CubatureControlVolumeBoundary class.
Header file for the Intrepid2::FunctionSpaceTools class.
virtual const char * getName() const override
Returns cubature name.
virtual void getCubature(PointViewType cubPoints, weightViewType cubWeights, PointViewType cellCoords) const override
Returns cubature points and weights (return arrays must be pre-sized/pre-allocated).
virtual ordinal_type getDimension() const override
Returns dimension of integration domain.
shards::CellTopology subcvCellTopo_
The topology of the sub-control volume.
shards::CellTopology primaryCellTopo_
The topology of the primary cell side.
Header file for the Intrepid2::CellTools class.