Stokhos Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
Stokhos_TensorProductBasis.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_TENSOR_PRODUCT_BASIS_HPP
43#define STOKHOS_TENSOR_PRODUCT_BASIS_HPP
44
45#include "Teuchos_RCP.hpp"
46
50
51namespace Stokhos {
52
66 template <typename ordinal_type, typename value_type,
67 typename coeff_compare_type =
68 TotalOrderLess<MultiIndex<ordinal_type> > >
70 public ProductBasis<ordinal_type,value_type> {
71 public:
72
74
80 const Teuchos::Array< Teuchos::RCP<const OneDOrthogPolyBasis<ordinal_type,
81 value_type> > >& bases,
82 const value_type& sparse_tol = 1.0e-12,
84 const coeff_compare_type& coeff_compare = coeff_compare_type());
85
87 virtual ~TensorProductBasis();
88
90
91
93 ordinal_type order() const;
94
96 ordinal_type dimension() 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
118 virtual
119 Teuchos::RCP< Stokhos::Sparse3Tensor<ordinal_type, value_type> >
121
123 virtual
124 Teuchos::RCP< Stokhos::Sparse3Tensor<ordinal_type, value_type> >
126
128 virtual value_type evaluateZero(ordinal_type i) const;
129
131
135 virtual void evaluateBases(
136 const Teuchos::ArrayView<const value_type>& point,
137 Teuchos::Array<value_type>& basis_vals) const;
138
140 virtual void print(std::ostream& os) const;
141
143 virtual const std::string& getName() const;
144
146
148
149
151
156 virtual const MultiIndex<ordinal_type>& term(ordinal_type i) const;
157
159
163 virtual ordinal_type index(const MultiIndex<ordinal_type>& term) const;
164
166
169 Teuchos::Array< Teuchos::RCP<const OneDOrthogPolyBasis<ordinal_type,
170 value_type> > >
171 getCoordinateBases() const;
172
175
177
178 private:
179
180 // Prohibit copying
182
183 // Prohibit Assignment
185
186 protected:
187
189 typedef std::map<coeff_type,ordinal_type,coeff_compare_type> coeff_set_type;
190 typedef Teuchos::Array<coeff_type> coeff_map_type;
191
193 std::string name;
194
196 ordinal_type p;
197
199 ordinal_type d;
200
202 ordinal_type sz;
203
205 Teuchos::Array< Teuchos::RCP<const OneDOrthogPolyBasis<ordinal_type, value_type> > > bases;
206
208 value_type sparse_tol;
209
212
215
218
220 Teuchos::Array<value_type> norms;
221
223 mutable Teuchos::Array< Teuchos::Array<value_type> > basis_eval_tmp;
224
225 }; // class TensorProductBasis
226
227} // Namespace Stokhos
228
229// Include template definitions
231
232#endif
A multidimensional index.
Abstract base class for 1-D orthogonal polynomials.
Abstract base class for multivariate orthogonal polynomials generated from tensor products of univari...
Multivariate orthogonal polynomial basis generated from a tensor product of univariate polynomials.
Teuchos::Array< coeff_type > coeff_map_type
std::map< coeff_type, ordinal_type, coeff_compare_type > coeff_set_type
TensorProductBasis & operator=(const TensorProductBasis &b)
virtual const std::string & getName() const
Return string name of basis.
coeff_type max_orders
Maximum orders for each dimension.
virtual const MultiIndex< ordinal_type > & term(ordinal_type i) const
Get orders of each coordinate polynomial given an index i.
ordinal_type sz
Total size of basis.
virtual ordinal_type size() const
Return total size of basis.
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeLinearTripleProductTensor() const
Compute linear triple product tensor where k = 0,1,..,d.
virtual void evaluateBases(const Teuchos::ArrayView< const value_type > &point, Teuchos::Array< value_type > &basis_vals) const
Evaluate basis polynomials at given point point.
Teuchos::Array< Teuchos::Array< value_type > > basis_eval_tmp
Temporary array used in basis evaluation.
TensorProductBasis(const TensorProductBasis &)
Teuchos::Array< value_type > norms
Norms.
TensorProductBasis(const Teuchos::Array< Teuchos::RCP< const OneDOrthogPolyBasis< ordinal_type, value_type > > > &bases, const value_type &sparse_tol=1.0e-12, const MultiIndex< ordinal_type > &index=MultiIndex< ordinal_type >(), const coeff_compare_type &coeff_compare=coeff_compare_type())
Constructor.
virtual const Teuchos::Array< value_type > & norm_squared() const
Return array storing norm-squared of each basis polynomial.
virtual ordinal_type index(const MultiIndex< ordinal_type > &term) const
Get index of the multivariate polynomial given orders of each coordinate.
virtual value_type evaluateZero(ordinal_type i) const
Evaluate basis polynomial i at zero.
Teuchos::Array< Teuchos::RCP< const OneDOrthogPolyBasis< ordinal_type, value_type > > > getCoordinateBases() const
Return coordinate bases.
virtual Teuchos::RCP< Stokhos::Sparse3Tensor< ordinal_type, value_type > > computeTripleProductTensor() const
Compute triple product tensor.
ordinal_type order() const
Return order of basis.
ordinal_type p
Total order of basis.
ordinal_type dimension() const
Return dimension of basis.
Teuchos::Array< Teuchos::RCP< const OneDOrthogPolyBasis< ordinal_type, value_type > > > bases
Array of bases.
virtual MultiIndex< ordinal_type > getMaxOrders() const
Return maximum order allowable for each coordinate basis.
ordinal_type d
Total dimension of basis.
virtual void print(std::ostream &os) const
Print basis to stream os.
MultiIndex< ordinal_type > coeff_type
value_type sparse_tol
Tolerance for computing sparse Cijk.
Top-level namespace for Stokhos classes and functions.