Intrepid
Intrepid_CubatureLineSorted.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 #ifndef INTREPID_CUBATURE_LINESORTED_HPP
50 #define INTREPID_CUBATURE_LINESORTED_HPP
51 
52 #include "Intrepid_ConfigDefs.hpp"
53 #include "Intrepid_Cubature.hpp"
55 #include "Teuchos_Assert.hpp"
56 #include "Teuchos_Array.hpp"
58 
59 namespace Intrepid {
60 
61 enum EIntrepidGrowth {
62  GROWTH_DEFAULT = 0,
63  GROWTH_SLOWLIN,
64  GROWTH_SLOWLINODD,
65  GROWTH_MODLIN,
66  GROWTH_SLOWEXP,
67  GROWTH_MODEXP,
68  GROWTH_FULLEXP
69 };
70 
88 template<class Scalar, class ArrayPoint = FieldContainer<Scalar>, class ArrayWeight = ArrayPoint>
89 class CubatureLineSorted : public Intrepid::Cubature<Scalar,ArrayPoint,ArrayWeight> {
90 
91 private:
92 
95  std::map<Scalar,int> points_; // keys = nodes, map values = location of weights
96 
99  std::vector<Scalar> weights_;
100 
104 
108  int degree_;
109 
112  EIntrepidBurkardt rule_type_;
113 
116  static const char *cubature_name_;
117 
118 public:
119 
120  ~CubatureLineSorted() {}
121 
127  CubatureLineSorted(int degree = 0, EIntrepidBurkardt rule = BURK_CLENSHAWCURTIS, bool isNormalized = false);
128 
133  CubatureLineSorted(EIntrepidBurkardt rule = BURK_CLENSHAWCURTIS, int numPoints = 0, bool isNormalized = false);
134 
135  CubatureLineSorted(std::vector<Scalar> & points, std::vector<Scalar> & weights);
136 
137  // Access Operators
144  void getCubature(ArrayPoint & cubPoints,
145  ArrayWeight & cubWeights) const;
146 
154  void getCubature(ArrayPoint& cubPoints,
155  ArrayWeight& cubWeights,
156  ArrayPoint& cellCoords) const;
157 
160  int getNumPoints() const;
161 
165  void getAccuracy(std::vector<int> & accuracy) const;
166 
169  int getDimension() const;
170 
173  const char* getName() const;
174 
177  Scalar getNode(typename std::map<Scalar,int>::iterator it);
178 
181  Scalar getWeight(int weight);
182 
185  Scalar getWeight(Scalar point);
186 
189  typename std::map<Scalar,int>::iterator begin(void);
190 
193  typename std::map<Scalar,int>::iterator end(void);
194 
198  void update(Scalar alpha2, CubatureLineSorted<Scalar> & cubRule2, Scalar alpha1);
199 };
200 
201 int growthRule1D(int index, EIntrepidGrowth growth, EIntrepidBurkardt rule);
202 
203 } // Intrepid Namespace
204 
205 // include templated definitions
207 
208 #endif
CubatureLineSorted(int degree=0, EIntrepidBurkardt rule=BURK_CLENSHAWCURTIS, bool isNormalized=false)
Constructor.
Utilizes cubature (integration) rules contained in the library sandia_rules (John Burkardt...
std::map< Scalar, int >::iterator begin(void)
Initiate iterator at the beginning of data.
void update(Scalar alpha2, CubatureLineSorted< Scalar > &cubRule2, Scalar alpha1)
Replace CubatureLineSorted values with &quot;this = alpha1*this+alpha2*cubRule2&quot;.
EIntrepidBurkardt rule_type_
Type of integration points.
Header file for utility class to provide multidimensional containers.
std::vector< Scalar > weights_
Contains points of this cubature rule.
void getAccuracy(std::vector< int > &accuracy) const
Returns max. degree of polynomials that are integrated exactly. The return vector has size 1...
void getCubature(ArrayPoint &cubPoints, ArrayWeight &cubWeights) const
Returns cubature points and weights (return arrays must be pre-sized/pre-allocated).
Header file for integration rules provided by John Burkardt. &lt;&gt;
static const char * cubature_name_
Cubature name.
int getNumPoints() const
Returns the number of cubature points.
int getDimension() const
Returns dimension of domain of integration.
Defines the base class for cubature (integration) rules in Intrepid.
Scalar getNode(typename std::map< Scalar, int >::iterator it)
Get a specific node described by the iterator location.
const char * getName() const
Returns cubature name.
Definition file for the Intrepid::CubatureLineSorted class.
std::map< Scalar, int > points_
Contains points of this cubature rule.
Header file for the Intrepid::Cubature class.
int numPoints_
Contains the number of nodes for this cubature rule.
int degree_
The degree of polynomials that are integrated exactly by this cubature rule.
Scalar getWeight(int weight)
Get a specific weight described by the integer location.
std::map< Scalar, int >::iterator end(void)
Initiate iterator at the end of data.