45#include "Teuchos_Assert.hpp"
46#include "Teuchos_Array.hpp"
59template <
typename ordinal_type,
typename value_type>
60Teuchos::RCP<const Stokhos::OrthogPolyBasis<ordinal_type, value_type> >
62create(Teuchos::ParameterList& sgParams)
64 Teuchos::ParameterList& basisParams = sgParams.sublist(
"Basis");
67 Teuchos::RCP< const OrthogPolyBasis<ordinal_type,value_type> > basis
68 = basisParams.template get< Teuchos::RCP< const OrthogPolyBasis<ordinal_type,value_type> > >(
"Stochastic Galerkin Basis", Teuchos::null);
69 if (basis != Teuchos::null)
72 ordinal_type dimension = basisParams.get(
"Dimension", 1);
73 bool isotropic = basisParams.get(
"Isotropic",
false);
75 Teuchos::Array< Teuchos::RCP<const OneDOrthogPolyBasis<ordinal_type,value_type> > > bases(dimension);
76 for (ordinal_type i=0; i<dimension; i++) {
78 bases[i] = create1DBasis(basisParams);
80 std::ostringstream ss;
82 Teuchos::ParameterList& bp = basisParams.sublist(ss.str());
83 bases[i] = create1DBasis(bp);
87 std::string type = basisParams.get(
"Multivariate Type",
"Complete");
88 value_type drop = basisParams.get(
"Cijk Drop Tolerance", 1e-12);
89 std::string ordering = basisParams.get(
"Coefficient Ordering",
"Total");
91 if (type ==
"Complete") {
92 bool use_old = basisParams.get(
"Use Old Cijk Algorithm",
false);
95 bases, drop, use_old));
98 else if (type ==
"Tensor Product") {
99 if (ordering ==
"Total")
102 else if (ordering ==
"Lexicographical")
106 TEUCHOS_TEST_FOR_EXCEPTION(
107 true, Teuchos::Exceptions::InvalidParameter,
108 std::endl <<
"Invalid coefficient ordering " << ordering << std::endl);
111 else if (type ==
"Total Order") {
112 if (ordering ==
"Total")
115 else if (ordering ==
"Lexicographical")
119 TEUCHOS_TEST_FOR_EXCEPTION(
120 true, Teuchos::Exceptions::InvalidParameter,
121 std::endl <<
"Invalid coefficient ordering " << ordering << std::endl);
124 else if (type ==
"Smolyak") {
125 ordinal_type order = basisParams.template get<ordinal_type>(
"Order");
127 if (ordering ==
"Total")
130 else if (ordering ==
"Lexicographical")
134 TEUCHOS_TEST_FOR_EXCEPTION(
135 true, Teuchos::Exceptions::InvalidParameter,
136 std::endl <<
"Invalid coefficient ordering " << ordering << std::endl);
140 TEUCHOS_TEST_FOR_EXCEPTION(
141 true, Teuchos::Exceptions::InvalidParameter,
142 std::endl <<
"Invalid multivariate basis type " << type << std::endl);
145 basisParams.set(
"Stochastic Galerkin Basis", basis);
150template <
typename ordinal_type,
typename value_type>
151Teuchos::RCP<const Stokhos::OneDOrthogPolyBasis<ordinal_type, value_type> >
155 Teuchos::RCP<OneDOrthogPolyBasis<ordinal_type,value_type> > basis;
157 std::string type = bp.get(
"Type",
"Legendre");
158 ordinal_type order = bp.get(
"Order", 3);
159 bool normalize = bp.get(
"Normalize",
false);
160 bool isotropic = bp.get(
"Isotropic",
false);
162 std::string growth_string = bp.get(
"Growth Policy",
"Slow");
164 if (growth_string ==
"Slow")
166 else if (growth_string ==
"Moderate")
169 TEUCHOS_TEST_FOR_EXCEPTION(
170 true, Teuchos::Exceptions::InvalidParameter,
171 std::endl <<
"Invalid growth policy " << growth_string << std::endl);
173 if (type ==
"Legendre")
175 else if (type ==
"Clenshaw-Curtis") {
178 else if (type ==
"Gauss-Patterson") {
181 else if (type ==
"Hermite")
183 else if (type ==
"Jacobi") {
184 value_type alpha = bp.get<value_type>(
"Jacobi Alpha");
185 value_type beta = bp.get<value_type>(
"Jacobi Beta");
188 else if (type ==
"Rys") {
189 value_type cut = bp.get(
"Weight Cut", 1.0);
193 TEUCHOS_TEST_FOR_EXCEPTION(
194 true, Teuchos::Exceptions::InvalidParameter,
195 std::endl <<
"Invalid basis type " << type << std::endl);
static Teuchos::RCP< const Stokhos::OneDOrthogPolyBasis< ordinal_type, value_type > > create1DBasis(Teuchos::ParameterList ¶ms)
Generate 1-D basis.
static Teuchos::RCP< const Stokhos::OrthogPolyBasis< ordinal_type, value_type > > create(Teuchos::ParameterList &sgParams)
Generate multivariate basis.
Legendre polynomial basis using Clenshaw-Curtis quadrature points.
Multivariate orthogonal polynomial basis generated from a total-order complete-polynomial tensor prod...
Legendre polynomial basis using Gauss-Patterson quadrature points.
Hermite polynomial basis.
Legendre polynomial basis.
A comparison functor implementing a strict weak ordering based lexographic ordering.
A multidimensional index.
Multivariate orthogonal polynomial basis generated from a Smolyak sparse grid.
Multivariate orthogonal polynomial basis generated from a tensor product of univariate polynomials.
Multivariate orthogonal polynomial basis generated from a total order tensor product of univariate po...
An isotropic total order index set.
A comparison functor implementing a strict weak ordering based total-order ordering,...
GrowthPolicy
Enumerated type for determining Smolyak growth policies.