Intrepid2
Intrepid2_ProjectionStruct.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 
47 #ifndef __INTREPID2_PROJECTIONSTRUCT_HPP__
48 #define __INTREPID2_PROJECTIONSTRUCT_HPP__
49 
50 #include "Intrepid2_ConfigDefs.hpp"
51 #include "Intrepid2_Types.hpp"
52 
53 #include <array>
54 
55 namespace Intrepid2 {
56 
57 namespace Experimental {
58 
79 template<typename SpT, typename ValueType>
81 public:
82 
83  typedef Kokkos::pair<ordinal_type,ordinal_type> range_type;
84  typedef typename Kokkos::Impl::is_space<SpT>::host_mirror_space::execution_space host_space_type;
85  typedef Kokkos::DynRankView<ValueType,host_space_type> view_type;
86  typedef std::array<std::array<range_type, 12>,4> range_tag;
87  typedef std::array<std::array<view_type, 12>,4> view_tag;
88  typedef std::array<std::array<unsigned, 12>,4> key_tag;
89 
92  ordinal_type getNumBasisEvalPoints() {
93  return numBasisEvalPoints;
94  }
95 
98  ordinal_type getNumBasisDerivEvalPoints() {
99  return numBasisDerivEvalPoints;
100  }
101 
104  ordinal_type getNumTargetEvalPoints() {
105  return numTargetEvalPoints;
106  }
107 
111  return numTargetDerivEvalPoints;
112  }
113 
120  ordinal_type getNumBasisEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId) {
121  return basisCubPoints[subCellDim][subCellId].extent(0);
122  }
123 
130  ordinal_type getNumBasisDerivEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId) {
131  return basisDerivCubPoints[subCellDim][subCellId].extent(0);
132  }
133 
140  ordinal_type getNumTargetEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId) {
141  return targetCubPoints[subCellDim][subCellId].extent(0);
142  }
143 
150  ordinal_type getNumTargetDerivEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId) {
151  return targetDerivCubPoints[subCellDim][subCellId].extent(0);
152  }
153 
166  view_type getBasisEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId) {
167  return basisCubPoints[subCellDim][subCellId];
168  }
169 
182  view_type getBasisDerivEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId) {
183  return basisDerivCubPoints[subCellDim][subCellId];
184  }
185 
198  view_type getTargetEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId) {
199  return targetCubPoints[subCellDim][subCellId];
200  }
201 
214  view_type getTargetDerivEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId) {
215  return targetDerivCubPoints[subCellDim][subCellId];
216  }
217 
229  view_type getBasisEvalWeights(const ordinal_type subCellDim, const ordinal_type subCellId) {
230  return basisCubWeights[subCellDim][subCellId];
231  }
232 
244  view_type getBasisDerivEvalWeights(const ordinal_type subCellDim, const ordinal_type subCellId) {
245  return basisDerivCubWeights[subCellDim][subCellId];
246  }
247 
259  view_type getTargetEvalWeights(const ordinal_type subCellDim, const ordinal_type subCellId) {
260  return targetCubWeights[subCellDim][subCellId];
261  }
262 
274  view_type getTargetDerivEvalWeights(const ordinal_type subCellDim, const ordinal_type subCellId) {
275  return targetDerivCubWeights[subCellDim][subCellId];
276  }
277 
284  range_type getBasisPointsRange(const ordinal_type subCellDim, const ordinal_type subCellId) {
285  return basisPointsRange[subCellDim][subCellId];
286  }
287 
294  range_type getBasisDerivPointsRange(const ordinal_type subCellDim, const ordinal_type subCellId) {
295  return basisDerivPointsRange[subCellDim][subCellId];
296  }
297 
304  range_type getTargetPointsRange(const ordinal_type subCellDim, const ordinal_type subCellId) {
305  return targetPointsRange[subCellDim][subCellId];
306  }
307 
314  range_type getTargetDerivPointsRange(const ordinal_type subCellDim, const ordinal_type subCellId) {
315  return targetDerivPointsRange[subCellDim][subCellId];
316  }
317 
324  unsigned getTopologyKey(const ordinal_type subCellDim, const ordinal_type subCellId) {
325  return subCellTopologyKey[subCellDim][subCellId];
326  }
327 
332  template<typename BasisPtrType>
333  void createL2ProjectionStruct(const BasisPtrType cellBasis,
334  const ordinal_type targetCubDegree);
335 
341  template<typename BasisPtrType>
342  void createHGradProjectionStruct(const BasisPtrType cellBasis,
343  const ordinal_type targetCubDegree,
344  const ordinal_type targetGradCubDegre);
345 
351  template<typename BasisPtrType>
352  void createHCurlProjectionStruct(const BasisPtrType cellBasis,
353  const ordinal_type targetCubDegree,
354  const ordinal_type targetCurlCubDegre);
355 
361  template<typename BasisPtrType>
362  void createHDivProjectionStruct(const BasisPtrType cellBasis,
363  const ordinal_type targetCubDegree,
364  const ordinal_type targetDivCubDegre);
365 
370  template<typename BasisPtrType>
371  void createHVolProjectionStruct(const BasisPtrType cellBasis,
372  const ordinal_type targetCubDegree);
373 
374  key_tag subCellTopologyKey;
375  range_tag basisPointsRange;
376  range_tag basisDerivPointsRange;
377  range_tag targetPointsRange;
378  range_tag targetDerivPointsRange;
379  view_tag basisCubPoints;
380  view_tag basisCubWeights;
381  view_tag basisDerivCubPoints;
382  view_tag basisDerivCubWeights;
383  view_tag targetCubPoints;
384  view_tag targetCubWeights;
385  view_tag targetDerivCubPoints;
386  view_tag targetDerivCubWeights;
387  ordinal_type numBasisEvalPoints;
388  ordinal_type numBasisDerivEvalPoints;
389  ordinal_type numTargetEvalPoints;
390  ordinal_type numTargetDerivEvalPoints;
391 };
392 
393 }
394 }
396 #endif
397 
398 
399 
400 
401 
range_type getTargetDerivPointsRange(const ordinal_type subCellDim, const ordinal_type subCellId)
Returns the range of the target function derivative evaluation points corresponding to a subcell...
unsigned getTopologyKey(const ordinal_type subCellDim, const ordinal_type subCellId)
Returns the key of a subcell topology.
void createL2ProjectionStruct(const BasisPtrType cellBasis, const ordinal_type targetCubDegree)
Initialize the ProjectionStruct for L2 projections.
void createHDivProjectionStruct(const BasisPtrType cellBasis, const ordinal_type targetCubDegree, const ordinal_type targetDivCubDegre)
Initialize the ProjectionStruct for HDIV projections.
ordinal_type getNumTargetEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId)
Returns number of points where to evaluate the target function on a subcell.
ordinal_type getNumBasisEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId)
Returns number of basis evaluation points on a subcell.
range_type getTargetPointsRange(const ordinal_type subCellDim, const ordinal_type subCellId)
Returns the range of the target function evaluation points corresponding to a subcell.
view_type getTargetDerivEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId)
Returns the points where to evaluate the derivatives of the target function on a subcell.
view_type getTargetEvalWeights(const ordinal_type subCellDim, const ordinal_type subCellId)
Returns the function evaluation weights on a subcell.
view_type getTargetDerivEvalWeights(const ordinal_type subCellDim, const ordinal_type subCellId)
Returns the function derivatives evaluation weights on a subcell.
view_type getBasisEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId)
Returns the basis evaluation points on a subcell.
ordinal_type getNumTargetDerivEvalPoints()
Returns number of points where to evaluate the derivatives of the target function.
Contains definitions of custom data types in Intrepid2.
ordinal_type getNumBasisDerivEvalPoints()
Returns number of evaluation points for basis derivatives.
void createHVolProjectionStruct(const BasisPtrType cellBasis, const ordinal_type targetCubDegree)
Initialize the ProjectionStruct for HVOL (local-L2) projection.
void createHCurlProjectionStruct(const BasisPtrType cellBasis, const ordinal_type targetCubDegree, const ordinal_type targetCurlCubDegre)
Initialize the ProjectionStruct for HCURL projections.
void createHGradProjectionStruct(const BasisPtrType cellBasis, const ordinal_type targetCubDegree, const ordinal_type targetGradCubDegre)
Initialize the ProjectionStruct for HGRAD projections.
ordinal_type getNumTargetDerivEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId)
Returns number of points where to evaluate the derivatives of the target function on a subcell...
view_type getBasisDerivEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId)
Returns the evaluation points for basis derivatives on a subcell.
ordinal_type getNumBasisEvalPoints()
Returns number of basis evaluation points.
view_type getBasisDerivEvalWeights(const ordinal_type subCellDim, const ordinal_type subCellId)
Returns the basis derivatives evaluation weights on a subcell.
view_type getTargetEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId)
Returns the points where to evaluate the target function on a subcell.
An helper class to compute the evaluation points and weights needed for performing projections...
ordinal_type getNumTargetEvalPoints()
Returns number of points where to evaluate the target function.
view_type getBasisEvalWeights(const ordinal_type subCellDim, const ordinal_type subCellId)
Returns the basis evaluation weights on a subcell.
range_type getBasisPointsRange(const ordinal_type subCellDim, const ordinal_type subCellId)
Returns the range of the basis evaluation points corresponding to a subcell.
ordinal_type getNumBasisDerivEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId)
Returns number of evaluation points for basis derivatives on a subcell.
Header file for the Intrepid2::Experimental::ProjectionStruct containing definitions.
range_type getBasisDerivPointsRange(const ordinal_type subCellDim, const ordinal_type subCellId)
Returns the range of the basis derivative evaluation points corresponding to a subcell.