Intrepid
Intrepid_CubatureDirectDef.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ************************************************************************
3 //
4 // Intrepid 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 Pavel Bochev (pbboche@sandia.gov)
38 // Denis Ridzal (dridzal@sandia.gov), or
39 // Kara Peterson (kjpeter@sandia.gov)
40 //
41 // ************************************************************************
42 // @HEADER
43 
49 namespace Intrepid {
50 
51 template <class Scalar, class ArrayPoint, class ArrayWeight>
53  ArrayWeight & cubWeights,
54  const CubatureTemplate * cubData) const {
55 
56  int numCubPoints = getNumPoints();
57  int cellDim = getDimension();
58  // check size of cubPoints and cubWeights
59  TEUCHOS_TEST_FOR_EXCEPTION( ( ( (int)cubPoints.size() < numCubPoints*cellDim ) || ( (int)cubWeights.size() < numCubPoints ) ),
60  std::out_of_range,
61  ">>> ERROR (CubatureDirect): Insufficient space allocated for cubature points or weights.");
62 
63  for (int pointId = 0; pointId < numCubPoints; pointId++) {
64  for (int dim = 0; dim < cellDim; dim++) {
65  cubPoints(pointId,dim) = cubData->points_[pointId][dim];
66  }
67  cubWeights(pointId) = cubData->weights_[pointId];
68  }
69 } // end getCubatureData
70 
71 
72 template <class Scalar, class ArrayPoint, class ArrayWeight>
74  ArrayWeight & cubWeights) const {
75  getCubatureData( cubPoints, cubWeights, &(exposeCubatureData()[degree_]) );
76 } // end getCubature
77 
78 template<class Scalar, class ArrayPoint, class ArrayWeight>
80  ArrayWeight& cubWeights,
81  ArrayPoint& cellCoords) const
82 {
83  TEUCHOS_TEST_FOR_EXCEPTION( (true), std::logic_error,
84  ">>> ERROR (CubatureDirect): Cubature defined in reference space calling method for physical space cubature.");
85 }
86 
87 
88 
89 template <class Scalar, class ArrayPoint, class ArrayWeight>
91  return exposeCubatureData()[degree_].numPoints_;
92 } // end getNumPoints
93 
94 
95 
96 template <class Scalar, class ArrayPoint, class ArrayWeight>
98  return dimension_;
99 } // end dimension
100 
101 
102 
103 template <class Scalar, class ArrayPoint, class ArrayWeight>
104 void CubatureDirect<Scalar,ArrayPoint,ArrayWeight>::getAccuracy(std::vector<int> & accuracy) const {
105  accuracy.assign(1, degree_);
106 } // end getAccuracy
107 
108 
109 } // end namespace Intrepid
110 
111 #if defined(Intrepid_SHOW_DEPRECATED_WARNINGS)
112 #ifdef __GNUC__
113 #warning "The Intrepid package is deprecated"
114 #endif
115 #endif
116 
virtual void getCubatureData(ArrayPoint &cubPoints, ArrayWeight &cubWeights, const CubatureTemplate *cubData) const
Extracts points and weights from cubData.
virtual void getAccuracy(std::vector< int > &accuracy) const
Returns max. degree of polynomials that are integrated exactly. The return vector has size 1...
virtual void getCubature(ArrayPoint &cubPoints, ArrayWeight &cubWeights) const
Returns cubature points and weights (return arrays must be pre-sized/pre-allocated).
virtual int getNumPoints() const
Returns the number of cubature points.
virtual int getDimension() const
Returns dimension of integration domain.
Template for the cubature rules used by Intrepid. Cubature template consists of cubature points and c...
double points_[INTREPID_MAX_INTEGRATION_POINTS][INTREPID_MAX_DIMENSION]
Array with the (X,Y,Z) coordinates of the cubature points.
double weights_[INTREPID_MAX_INTEGRATION_POINTS]
Array with the associated cubature weights.