44#include "Teuchos_Assert.hpp"
56template <
typename ordinal_type,
typename value_type>
57Teuchos::RCP<Stokhos::OrthogPolyExpansion<ordinal_type, value_type> >
59create(Teuchos::ParameterList& sgParams)
62 Teuchos::ParameterList& expParams = sgParams.sublist(
"Expansion");
63 Teuchos::RCP< Stokhos::OrthogPolyExpansion<ordinal_type,value_type> > expansion = expParams.template get< Teuchos::RCP< Stokhos::OrthogPolyExpansion<ordinal_type,value_type> > >(
"Stochastic Galerkin Expansion", Teuchos::null);
64 if (expansion != Teuchos::null)
68 Teuchos::ParameterList& basisParams = sgParams.sublist(
"Basis");
69 Teuchos::RCP< const Stokhos::OrthogPolyBasis<ordinal_type,value_type> > basis;
74 basisParams.set(
"Stochastic Galerkin Basis", basis);
78 Teuchos::RCP<const Stokhos::Sparse3Tensor<ordinal_type,value_type> > Cijk;
80 Cijk = sgParams.template get<Teuchos::RCP<const Stokhos::Sparse3Tensor<ordinal_type,value_type> > >(
"Triple Product Tensor");
82 std::string tp_type = sgParams.get(
"Triple Product Size",
"Full");
83 TEUCHOS_TEST_FOR_EXCEPTION(
84 tp_type !=
"Full" && tp_type !=
"Linear",
85 Teuchos::Exceptions::InvalidParameter,
86 std::endl <<
"Invalid triple product expansion type " << tp_type <<
89 if (tp_type ==
"Full")
90 Cijk = basis->computeTripleProductTensor();
92 Cijk = basis->computeLinearTripleProductTensor();
94 sgParams.set(
"Triple Product Tensor", Cijk);
98 std::string exp_type = expParams.get(
"Type",
"Algebraic");
99 if (exp_type ==
"Algebraic")
103 else if (exp_type ==
"Quadrature") {
104 Teuchos::ParameterList& quadParams = sgParams.sublist(
"Quadrature");
105 Teuchos::RCP<const Stokhos::Quadrature<ordinal_type,value_type> > quad;
107 quad = quadParams.template get<Teuchos::RCP<const Stokhos::Quadrature<ordinal_type,value_type> > >(
"Stochastic Galerkin Quadrature");
111 quadParams.set(
"Stochastic Galerkin Quadrature", quad);
117 else if (exp_type ==
"For UQTK") {
118#ifdef HAVE_STOKHOS_FORUQTK
119 typename Stokhos::ForUQTKOrthogPolyExpansion<ordinal_type,value_type>::EXPANSION_METHOD method =
120 expParams.get(
"ForUQTK Expansion Method",
121 Stokhos::ForUQTKOrthogPolyExpansion<ordinal_type,value_type>::TAYLOR);
122 value_type rtol = expParams.get(
"ForUQTK Expansion Tolerance", 1e-12);
124 Teuchos::rcp(
new Stokhos::ForUQTKOrthogPolyExpansion<ordinal_type,value_type>(basis, Cijk, method, rtol));
126 TEUCHOS_TEST_FOR_EXCEPTION(
true, Teuchos::Exceptions::InvalidParameter,
128 "Error! Stokhos::ExpansionFactory::create(): " <<
129 "ForUQTK expansion requires ForUQTK!" << std::endl);
157 else if (exp_type ==
"Pseudospectral") {
159 Teuchos::ParameterList& psopParams =
160 sgParams.sublist(
"Pseudospectral Operator");
161 Teuchos::RCP<const psop_type> psop;
162 if (psopParams.template isType<Teuchos::RCP<const psop_type> >(
163 "Stochastic Galerkin Pseudospectral Operator"))
164 psop = psopParams.template get<Teuchos::RCP<const psop_type> >(
165 "Stochastic Galerkin Pseudospectral Operator");
169 psopParams.set(
"Stochastic Galerkin Pseudospectral Operator", psop);
176 TEUCHOS_TEST_FOR_EXCEPTION(
true, Teuchos::Exceptions::InvalidParameter,
178 "Error! Stokhos::ExpansionFactory::create(): " <<
179 "Invalid expansion type " << exp_type << std::endl);
181 expParams.set(
"Stochastic Galerkin Expansion", expansion);
Orthogonal polynomial expansions limited to algebraic operations.
static Teuchos::RCP< const Stokhos::OrthogPolyBasis< ordinal_type, value_type > > create(Teuchos::ParameterList &sgParams)
Generate multivariate basis.
static Teuchos::RCP< Stokhos::OrthogPolyExpansion< ordinal_type, value_type > > create(Teuchos::ParameterList &sgParams)
Generate multivariate expansion.
Abstract base class for multivariate orthogonal polynomials.
static Teuchos::RCP< const psop_type > create(Teuchos::ParameterList &sgParams)
Generate pseudospectral operator object.
An operator interface for building pseudo-spectral approximations.
Orthogonal polynomial expansions based on numerical quadrature.
Orthogonal polynomial expansions based on numerical quadrature.
static Teuchos::RCP< const Stokhos::Quadrature< ordinal_type, value_type > > create(Teuchos::ParameterList &sgParams)
Generate quadrature object.
Abstract base class for quadrature methods.
Data structure storing a sparse 3-tensor C(i,j,k) in a a compressed format.