44 #include "Teuchos_Assert.hpp" 51 template <
typename ordinal_type,
typename value_type>
52 Teuchos::RCP<const Stokhos::Quadrature<ordinal_type, value_type> >
54 create(Teuchos::ParameterList& sgParams)
57 Teuchos::ParameterList& quadParams = sgParams.sublist(
"Quadrature");
58 Teuchos::RCP<const Stokhos::Quadrature<ordinal_type,value_type> > quad =
59 quadParams.template get< Teuchos::RCP<const Stokhos::Quadrature<ordinal_type,value_type> > >(
"Stochastic Galerkin Quadrature", Teuchos::null);
60 if (quad != Teuchos::null)
64 Teuchos::ParameterList& basisParams = sgParams.sublist(
"Basis");
65 Teuchos::RCP< const Stokhos::OrthogPolyBasis<ordinal_type,value_type> > basis;
67 basis = basisParams.template get< Teuchos::RCP<const Stokhos::OrthogPolyBasis<ordinal_type,value_type> > >(
"Stochastic Galerkin Basis");
73 std::string quad_type = quadParams.get(
"Type",
"Tensor Product");
74 if (quad_type ==
"Tensor Product") {
75 if (quadParams.isType<
ordinal_type>(
"Quadrature Order")) {
85 else if (quad_type ==
"Sparse Grid") {
86 #ifdef HAVE_STOKHOS_DAKOTA 87 ordinal_type level = quadParams.get(
"Sparse Grid Level", 0);
88 value_type dup_tol = quadParams.get(
"Duplicate Tolerance", 1e-12);
90 "Growth Rule", Pecos::SLOW_RESTRICTED_GROWTH);
92 Teuchos::rcp(
new Stokhos::SparseGridQuadrature<ordinal_type,value_type>(
93 product_basis, level, dup_tol, growth));
95 TEUCHOS_TEST_FOR_EXCEPTION(
true, Teuchos::Exceptions::InvalidParameter,
97 "Error! Stokhos::QuadratureFactory::create(): " <<
98 "Sparse Grid Quadrature requires Dakota!" << std::endl);
102 TEUCHOS_TEST_FOR_EXCEPTION(
true, Teuchos::Exceptions::InvalidParameter,
104 "Error! Stokhos::QuadratureFactory::create(): " <<
105 "Invalid quadrature type " << quad_type << std::endl);
107 quadParams.set(
"Stochastic Galerkin Quadrature", quad);
Abstract base class for multivariate orthogonal polynomials.
Abstract base class for multivariate orthogonal polynomials generated from tensor products of univari...
static Teuchos::RCP< const Stokhos::OrthogPolyBasis< ordinal_type, value_type > > create(Teuchos::ParameterList &sgParams)
Generate multivariate basis.
static Teuchos::RCP< const Stokhos::Quadrature< ordinal_type, value_type > > create(Teuchos::ParameterList &sgParams)
Generate quadrature object.
Defines quadrature for a tensor product basis by tensor products of 1-D quadrature rules...