Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Stokhos_OneDOrthogPolyBasis.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_ONEDORTHOGPOLYBASIS_HPP
43 #define STOKHOS_ONEDORTHOGPOLYBASIS_HPP
44 
45 #include <ostream>
46 #include <string>
47 #include "Stokhos_Dense3Tensor.hpp"
49 #include "Teuchos_Array.hpp"
51 
52 #include "Stokhos_ConfigDefs.h"
53 #ifdef HAVE_STOKHOS_DAKOTA
54 #include "sandia_rules.hpp"
55 #endif
56 
58 namespace Stokhos {
59 
61 
80  template <typename ordinal_type, typename value_type>
82  public:
83 
86 
88  virtual ~OneDOrthogPolyBasis() {};
89 
91  virtual ordinal_type order() const = 0;
92 
94  virtual ordinal_type size() const = 0;
95 
97 
101  virtual const Teuchos::Array<value_type>& norm_squared() const = 0;
102 
104  virtual const value_type& norm_squared(ordinal_type i) const = 0;
105 
107 
114  virtual
116  computeTripleProductTensor() const = 0;
117 
119 
126  virtual
129 
131 
137  virtual
140 
142 
146  virtual void evaluateBases(const value_type& point,
147  Teuchos::Array<value_type>& basis_pts) const = 0;
148 
153  virtual value_type evaluate(const value_type& point,
154  ordinal_type order) const = 0;
155 
157  virtual void print(std::ostream& os) const {};
158 
160  virtual const std::string& getName() const = 0;
161 
173  virtual void
174  getQuadPoints(ordinal_type quad_order,
177  Teuchos::Array< Teuchos::Array<value_type> >& values) const = 0;
178 
183  virtual ordinal_type quadDegreeOfExactness(ordinal_type n) const = 0;
184 
196 
198  virtual ordinal_type coefficientGrowth(ordinal_type n) const = 0;
199 
201  virtual ordinal_type pointGrowth(ordinal_type n) const = 0;
202 
204  typedef int ( *LevelToOrderFnPtr ) ( int level, int growth );
205 
207 
216  virtual LevelToOrderFnPtr getSparseGridGrowthRule() const = 0;
217 
219  virtual void setSparseGridGrowthRule(LevelToOrderFnPtr ptr) = 0;
220 
221  private:
222 
223  // Prohibit copying
225 
226  // Prohibit Assignment
228 
229 
230  }; // class OrthogPolyBasis
231 
233  template <typename ordinal_type, typename value_type>
234  std::ostream&
235  operator << (std::ostream& os,
237  b.print(os);
238  return os;
239  }
240 
241 } // Namespace Stokhos
242 
243 #endif
OneDOrthogPolyBasis & operator=(const OneDOrthogPolyBasis &b)
virtual ordinal_type coefficientGrowth(ordinal_type n) const =0
Evaluate coefficient growth rule for Smolyak-type bases.
virtual void evaluateBases(const value_type &point, Teuchos::Array< value_type > &basis_pts) const =0
Evaluate each basis polynomial at given point point.
virtual ordinal_type pointGrowth(ordinal_type n) const =0
Evaluate point growth rule for Smolyak-type bases.
virtual const Teuchos::Array< value_type > & norm_squared() const =0
Return array storing norm-squared of each basis polynomial.
virtual value_type evaluate(const value_type &point, ordinal_type order) const =0
Evaluate basis polynomial given by order order at given point point.
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 =0
Compute quadrature points, weights, and values of basis polynomials at given set of points points...
virtual void print(std::ostream &os) const
Print basis to stream os.
virtual ordinal_type quadDegreeOfExactness(ordinal_type n) const =0
int(* LevelToOrderFnPtr)(int level, int growth)
Function pointer needed for level_to_order mappings.
std::ostream & operator<<(std::ostream &os, const ProductContainer< coeff_type > &vec)
virtual ordinal_type size() const =0
Return total size of basis (given by order() + 1).
virtual void setSparseGridGrowthRule(LevelToOrderFnPtr ptr)=0
Set sparse grid rule.
Abstract base class for 1-D orthogonal polynomials.
virtual Teuchos::RCP< Stokhos::Dense3Tensor< ordinal_type, value_type > > computeTripleProductTensor() const =0
Compute triple product tensor.
virtual Teuchos::RCP< Teuchos::SerialDenseMatrix< ordinal_type, value_type > > computeDerivDoubleProductTensor() const =0
Compute derivative double product tensor.
virtual Teuchos::RCP< OneDOrthogPolyBasis< ordinal_type, value_type > > cloneWithOrder(ordinal_type p) const =0
Clone this object with the option of building a higher order basis.
virtual const std::string & getName() const =0
Return string name of basis.
virtual ordinal_type order() const =0
Return order of basis (largest monomial degree ).
virtual LevelToOrderFnPtr getSparseGridGrowthRule() const =0
Get sparse grid level_to_order mapping function.
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeSparseTripleProductTensor(ordinal_type order) const =0
Compute triple product tensor.