Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Stokhos_RecurrenceBasis.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Stokhos Package
5 // Copyright (2009) 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 Eric T. Phipps (etphipp@sandia.gov).
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #ifndef STOKHOS_RECURRENCEBASIS_HPP
43 #define STOKHOS_RECURRENCEBASIS_HPP
44 
46 
47 namespace Stokhos {
48 
50  enum GrowthPolicy {
53  };
54 
84  template <typename ordinal_type, typename value_type>
86  public OneDOrthogPolyBasis<ordinal_type, value_type> {
87  public:
88 
90  virtual ~RecurrenceBasis();
91 
93 
94 
96  virtual ordinal_type order() const;
97 
99  virtual ordinal_type size() const;
100 
102 
106  virtual const Teuchos::Array<value_type>& norm_squared() const;
107 
109  virtual const value_type& norm_squared(ordinal_type i) const;
110 
112 
124 
126 
136  virtual
139 
141 
151 
153 
157  virtual void evaluateBases(const value_type& point,
158  Teuchos::Array<value_type>& basis_pts) const;
159 
164  virtual value_type evaluate(const value_type& point,
165  ordinal_type order) const;
166 
168  virtual void print(std::ostream& os) const;
169 
171  virtual const std::string& getName() const;
172 
190  virtual void
191  getQuadPoints(ordinal_type quad_order,
194  Teuchos::Array< Teuchos::Array<value_type> >& values) const;
195 
201 
204 
206  virtual ordinal_type pointGrowth(ordinal_type n) const;
207 
210 
212 
222  return sparse_grid_growth_rule; }
223 
226  sparse_grid_growth_rule = ptr; }
227 
229 
235 
237  virtual void evaluateBasesAndDerivatives(const value_type& point,
239  Teuchos::Array<value_type>& derivs) const;
240 
242  virtual void setQuadZeroTol(value_type tol) {
243  quad_zero_tol = tol; }
244 
245  protected:
246 
248 
256  RecurrenceBasis(const std::string& name, ordinal_type p, bool normalize,
258 
261 
263 
272  virtual bool
277  Teuchos::Array<value_type>& gamma) const = 0;
278 
280 
284  virtual void setup();
285 
292 
293  private:
294 
295  // Prohibit copying
297 
298  // Prohibit Assignment
300 
301  protected:
302 
304  std::string name;
305 
308 
310  bool normalize;
311 
314 
317 
320 
323 
326 
329 
332 
335 
336  }; // class RecurrenceBasis
337 
338 } // Namespace Stokhos
339 
340 // Include template definitions
342 
343 #endif
Teuchos::Array< value_type > delta
Recurrence coefficients.
virtual void evaluateBases(const value_type &point, Teuchos::Array< value_type > &basis_pts) const
Evaluate each basis polynomial at given point point.
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeSparseTripleProductTensor(ordinal_type order) const
Compute triple product tensor.
value_type quad_zero_tol
Tolerance for quadrature points near zero.
virtual void getRecurrenceCoefficients(Teuchos::Array< value_type > &alpha, Teuchos::Array< value_type > &beta, Teuchos::Array< value_type > &delta, Teuchos::Array< value_type > &gamma) const
Return recurrence coefficients defined by above formula.
virtual const std::string & getName() const
Return string name of basis.
Teuchos::Array< value_type > norms
Norms.
Implementation of OneDOrthogPolyBasis based on the general three-term recurrence relationship: for ...
std::string name
Name of basis.
virtual value_type evaluate(const value_type &point, ordinal_type order) const
Evaluate basis polynomial given by order order at given point point.
virtual ordinal_type pointGrowth(ordinal_type n) const
Evaluate point growth rule for Smolyak-type bases.
virtual void getQuadPoints(ordinal_type quad_order, Teuchos::Array< value_type > &points, Teuchos::Array< value_type > &weights, Teuchos::Array< Teuchos::Array< value_type > > &values) const
Compute quadrature points, weights, and values of basis polynomials at given set of points points...
Teuchos::Array< value_type > beta
Recurrence coefficients.
GrowthPolicy
Enumerated type for determining Smolyak growth policies.
virtual void setQuadZeroTol(value_type tol)
Set tolerance for zero in quad point generation.
virtual Teuchos::RCP< Stokhos::Dense3Tensor< ordinal_type, value_type > > computeTripleProductTensor() const
Compute triple product tensor.
Teuchos::Array< value_type > alpha
Recurrence coefficients.
void normalizeRecurrenceCoefficients(Teuchos::Array< value_type > &alpha, Teuchos::Array< value_type > &beta, Teuchos::Array< value_type > &delta, Teuchos::Array< value_type > &gamma) const
Normalize coefficients.
virtual void evaluateBasesAndDerivatives(const value_type &point, Teuchos::Array< value_type > &vals, Teuchos::Array< value_type > &derivs) const
Evaluate basis polynomials and their derivatives at given point point.
OneDOrthogPolyBasis< ordinal_type, value_type >::LevelToOrderFnPtr LevelToOrderFnPtr
Function pointer needed for level_to_order mappings.
virtual ordinal_type quadDegreeOfExactness(ordinal_type n) const
virtual Teuchos::RCP< Teuchos::SerialDenseMatrix< ordinal_type, value_type > > computeDerivDoubleProductTensor() const
Compute derivative double product tensor.
virtual ordinal_type order() const
Return order of basis (largest monomial degree ).
virtual void print(std::ostream &os) const
Print basis to stream os.
LevelToOrderFnPtr sparse_grid_growth_rule
Sparse grid growth rule (as determined by Pecos)
virtual ordinal_type coefficientGrowth(ordinal_type n) const
Evaluate coefficient growth rule for Smolyak-type bases.
virtual void setup()
Setup basis after computing recurrence coefficients.
virtual bool computeRecurrenceCoefficients(ordinal_type n, Teuchos::Array< value_type > &alpha, Teuchos::Array< value_type > &beta, Teuchos::Array< value_type > &delta, Teuchos::Array< value_type > &gamma) const =0
Compute recurrence coefficients.
Abstract base class for 1-D orthogonal polynomials.
RecurrenceBasis & operator=(const RecurrenceBasis &b)
virtual ordinal_type size() const
Return total size of basis (given by order() + 1).
ordinal_type p
Order of basis.
Teuchos::Array< value_type > gamma
Recurrence coefficients.
virtual void setSparseGridGrowthRule(LevelToOrderFnPtr ptr)
Set sparse grid rule.
virtual LevelToOrderFnPtr getSparseGridGrowthRule() const
Get sparse grid level_to_order mapping function.
virtual const Teuchos::Array< value_type > & norm_squared() const
Return array storing norm-squared of each basis polynomial.
RecurrenceBasis(const std::string &name, ordinal_type p, bool normalize, GrowthPolicy growth=SLOW_GROWTH)
Constructor to be called by derived classes.
GrowthPolicy growth
Smolyak growth policy.
int n