Intrepid2
Intrepid2_CubatureControlVolumeBoundary.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ************************************************************************
3 //
4 // Intrepid2 Package
5 // Copyright (2007) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Kyungjoo Kim (kyukim@sandia.gov), or
38 // Mauro Perego (mperego@sandia.gov)
39 //
40 // ************************************************************************
41 // @HEADER
42 
49 #ifndef __INTREPID2_CUBATURE_CONTROLVOLUME_BOUNDARY_HPP__
50 #define __INTREPID2_CUBATURE_CONTROLVOLUME_BOUNDARY_HPP__
51 
52 #include "Intrepid2_ConfigDefs.hpp"
53 #include "Intrepid2_Cubature.hpp"
54 
55 #include "Shards_CellTopology.hpp"
56 #include "Intrepid2_CellTools.hpp"
57 
59 
60 namespace Intrepid2{
61 
69  template<typename ExecSpaceType = void,
70  typename pointValueType = double,
71  typename weightValueType = double>
73  : public Cubature<ExecSpaceType,pointValueType,weightValueType> {
74  public:
75 
76  template<typename cubPointViewType,
77  typename subcvCoordViewType,
78  typename mapViewType>
79  struct Functor {
80  cubPointViewType _cubPoints;
81  const subcvCoordViewType _subcvCoords;
82  const mapViewType _sideMap;
83 
84  KOKKOS_INLINE_FUNCTION
85  Functor( cubPointViewType cubPoints_,
86  subcvCoordViewType subcvCoords_,
87  mapViewType sideMap_ )
88  : _cubPoints(cubPoints_),
89  _subcvCoords(subcvCoords_), _sideMap(sideMap_) {}
90 
91  KOKKOS_INLINE_FUNCTION
92  void operator()(const ordinal_type cell) const {
93  const ordinal_type numNodesPerSide = _sideMap(0);
94  const ordinal_type spaceDim = _cubPoints.extent(1);
95 
96  // compute side centers
97  typename cubPointViewType::value_type val[3] = {};
98  for (ordinal_type j=0;j<numNodesPerSide;++j) {
99  for (ordinal_type i=0;i<spaceDim;++i)
100  val[i] += _subcvCoords(cell, _sideMap(j+1), i);
101  }
102  for (ordinal_type i=0;i<spaceDim;++i)
103  _cubPoints(cell, i) = (val[i]/numNodesPerSide);
104 
105  }
106  };
107 
108  protected:
109 
112  shards::CellTopology primaryCellTopo_;
113 
116  shards::CellTopology subcvCellTopo_;
117 
120  ordinal_type degree_;
121 
124  ordinal_type sideIndex_;
125 
126  // cubature points and weights associated with sub-control volume.
127  Kokkos::View<ordinal_type**,Kokkos::HostSpace> boundarySidesHost_;
128  Kokkos::View<ordinal_type**,Kokkos::LayoutRight,ExecSpaceType> sideNodeMap_;
129  Kokkos::DynRankView<pointValueType, ExecSpaceType> sidePoints_;
130 
131  public:
132  typedef typename Cubature<ExecSpaceType,pointValueType,weightValueType>::PointViewType PointViewType;
133  typedef typename Cubature<ExecSpaceType,pointValueType,weightValueType>::weightViewType weightViewType;
134 
136 
144  virtual
145  void
146  getCubature( PointViewType cubPoints,
147  weightViewType cubWeights,
148  PointViewType cellCoords) const;
149 
152  virtual
153  ordinal_type
154  getNumPoints() const {
155  // one control volume boundary cubature point per subcell node (for now)
156  const ordinal_type sideDim = primaryCellTopo_.getDimension() - 1;
157  return primaryCellTopo_.getNodeCount(sideDim, sideIndex_);
158  }
159 
162  virtual
163  ordinal_type
164  getDimension() const {
165  return primaryCellTopo_.getDimension();
166  }
167 
170  virtual
171  const char*
172  getName() const {
173  return "CubatureControlVolumeBoundary";
174  }
175 
181  CubatureControlVolumeBoundary(const shards::CellTopology cellTopology,
182  const ordinal_type sideIndex);
183  virtual ~CubatureControlVolumeBoundary() {}
184 
185  };
186 
187 }
188 
190 
191 #endif
192 
Defines the base class for cubature (integration) rules in Intrepid.
shards::CellTopology primaryCellTopo_
The topology of the primary cell side.
Defines cubature (integration) rules over Neumann boundaries for control volume method.
CubatureControlVolumeBoundary(const shards::CellTopology cellTopology, const ordinal_type sideIndex)
virtual ordinal_type getNumPoints() const
Returns the number of cubature points.
virtual ordinal_type getDimension() const
Returns dimension of integration domain.
Header file for the Intrepid2::Cubature class.
Definition file for the Intrepid2::CubatureControlVolumeBoundary class.
Header file for the Intrepid2::FunctionSpaceTools class.
virtual void getCubature(PointViewType cubPoints, weightViewType cubWeights, PointViewType cellCoords) const
Returns cubature points and weights (return arrays must be pre-sized/pre-allocated).
virtual const char * getName() const
Returns cubature name.
shards::CellTopology subcvCellTopo_
The topology of the sub-control volume.
Header file for the Intrepid2::CellTools class.
ordinal_type degree_
The degree of the polynomials that are integrated exactly.