Intrepid2
Intrepid2_CubatureControlVolumeSide.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_SIDE_HPP__
17 #define __INTREPID2_CUBATURE_CONTROLVOLUME_SIDE_HPP__
18 
19 #include "Intrepid2_ConfigDefs.hpp"
20 #include "Intrepid2_Cubature.hpp"
21 
22 #include "Shards_CellTopology.hpp"
23 #include "Intrepid2_CellTools.hpp"
24 
25 namespace Intrepid2{
26 
30  template<typename DeviceType = void,
31  typename pointValueType = double,
32  typename weightValueType = double>
34  : public Cubature<DeviceType,pointValueType,weightValueType> {
35  public:
36 
37  template<typename cubPointViewType,
38  typename cubWeightViewType,
39  typename subcvCoordViewType,
40  typename subcvSideNormalViewType,
41  typename mapViewType>
42  struct Functor {
43  cubPointViewType _cubPoints;
44  cubWeightViewType _cubWeights;
45  const subcvCoordViewType _subcvCoords;
46  const subcvSideNormalViewType _subcvSideNormals;
47  const mapViewType _sideMap;
48 
49  KOKKOS_INLINE_FUNCTION
50  Functor( cubPointViewType cubPoints_,
51  cubWeightViewType cubWeights_,
52  subcvCoordViewType subcvCoords_,
53  subcvSideNormalViewType subcvSideNormals_,
54  mapViewType sideMap_ )
55  : _cubPoints(cubPoints_), _cubWeights(cubWeights_),
56  _subcvCoords(subcvCoords_), _subcvSideNormals(subcvSideNormals_), _sideMap(sideMap_) {}
57 
58  KOKKOS_INLINE_FUNCTION
59  void operator()(const ordinal_type cell) const {
60  const ordinal_type numNodesPerCell = _cubPoints.extent(1);
61  const ordinal_type spaceDim = _cubPoints.extent(2);
62 
63  const ordinal_type numNodesPerSide = _sideMap(0);
64  const ordinal_type numSubcvPoints = _subcvSideNormals.extent(2);
65 
66  const ordinal_type sideDim = spaceDim - 1;
67 
68  // compute side centers
69  for (ordinal_type node=0;node<numNodesPerCell;++node) {
70  typename cubPointViewType::value_type val[3] = {};
71  for (ordinal_type j=0;j<numNodesPerSide;++j) {
72  for (ordinal_type i=0;i<spaceDim;++i)
73  val[i] += _subcvCoords(cell, node, _sideMap(j+1), i);
74  }
75  for (ordinal_type i=0;i<spaceDim;++i)
76  _cubPoints(cell, node, i) = (val[i]/numNodesPerSide);
77  }
78 
79  // compute weights (area or volume)
80  for (ordinal_type node=0;node<numNodesPerCell;++node) {
81  for (ordinal_type i=0;i<spaceDim;++i) {
82  typename cubWeightViewType::value_type val = 0;
83  for (ordinal_type pt=0;pt<numSubcvPoints;++pt)
84  val += _subcvSideNormals(cell, node, pt, i)*pow(2,sideDim);
85  _cubWeights(cell, node, i) = val;
86  }
87  }
88  }
89  };
90 
91  protected:
92 
95  shards::CellTopology primaryCellTopo_;
96 
99  shards::CellTopology subcvCellTopo_;
100 
103  ordinal_type degree_;
104 
105  // cubature points and weights associated with sub-control volume.
106  Kokkos::View<ordinal_type**,Kokkos::LayoutRight,DeviceType> sideNodeMap_;
107  Kokkos::DynRankView<pointValueType, DeviceType> sidePoints_;
108 
109  public:
110  typedef typename Cubature<DeviceType,pointValueType,weightValueType>::PointViewType PointViewType;
111  typedef typename Cubature<DeviceType,pointValueType,weightValueType>::weightViewType weightViewType;
112 
114 
122  virtual
123  void
124  getCubature( PointViewType cubPoints,
125  weightViewType cubWeights,
126  PointViewType cellCoords) const override;
127 
130  virtual
131  ordinal_type
132  getNumPoints() const override {
133  return primaryCellTopo_.getEdgeCount();
134  }
135 
138  virtual
139  ordinal_type
140  getDimension() const override {
141  return primaryCellTopo_.getDimension();
142  }
143 
146  virtual
147  const char*
148  getName() const override {
149  return "CubatureControlVolumeSide";
150  }
151 
155  CubatureControlVolumeSide(const shards::CellTopology cellTopology);
156  virtual ~CubatureControlVolumeSide() {}
157 
158  }; // end class CubatureControlVolume
159 
160 } // end namespace Intrepid2
161 
163 
164 #endif
165 
Header file for the Intrepid2::CubatureControlVolume class.
Defines the base class for cubature (integration) rules in Intrepid.
Defines cubature (integration) rules over control volumes.
virtual const char * getName() const override
Returns cubature name.
virtual ordinal_type getDimension() const override
Returns dimension of integration domain.
virtual ordinal_type getNumPoints() const override
Returns the number of cubature points.
Header file for the Intrepid2::Cubature class.
shards::CellTopology subcvCellTopo_
The topology of the sub-control volume.
ordinal_type degree_
The degree of the polynomials that are integrated exactly.
virtual void getCubature(PointViewType cubPoints, weightViewType cubWeights, PointViewType cellCoords) const override
Returns cubature points and weights (return arrays must be pre-sized/pre-allocated).
shards::CellTopology primaryCellTopo_
The topology of the primary cell.
CubatureControlVolumeSide(const shards::CellTopology cellTopology)
Header file for the Intrepid2::CellTools class.