Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Stokhos_PseudoSpectralOperatorFactoryImp.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Stokhos Package
4 //
5 // Copyright 2009 NTESS and the Stokhos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #include "Stokhos_BasisFactory.hpp"
11 #include "Stokhos_ProductBasis.hpp"
16 
17 template <typename ordinal_type, typename value_type>
21 {
22  // Check if operator is already there
23  Teuchos::ParameterList& psopParams =
24  sgParams.sublist("Pseudospectral Operator");
26  psopParams.template get< Teuchos::RCP<const psop_type> >("Stochastic Galerkin Pseudospectral Operator", Teuchos::null);
27  if (psop != Teuchos::null)
28  return psop;
29 
30  // Get basis
31  Teuchos::ParameterList& basisParams = sgParams.sublist("Basis");
33  if (basisParams.template isType< Teuchos::RCP< const OrthogPolyBasis<ordinal_type,value_type> > >("Stochastic Galerkin Basis"))
34  basis = basisParams.template get< Teuchos::RCP<const OrthogPolyBasis<ordinal_type,value_type> > >("Stochastic Galerkin Basis");
35  else
37 
38  // Create operator
39  std::string type = psopParams.get("Type", "Tensor Product");
40 
41  if (type == "Tensor Product") {
42  bool use_pst = psopParams.get("Use PST", false);
43  Teuchos::RCP<const ProductBasis<ordinal_type,value_type> > product_basis = Teuchos::rcp_dynamic_cast<const ProductBasis<ordinal_type,value_type> >(basis, true);
44  psop =
46  }
47 
48  else if (type == "Smolyak") {
49  bool use_pst = psopParams.get("Use PST", true);
50  bool use_smolyak = psopParams.get("Use Smolyak Apply", true);
51  Teuchos::RCP<const SmolyakBasis<ordinal_type,value_type> > smolyak_basis = Teuchos::rcp_dynamic_cast<const SmolyakBasis<ordinal_type,value_type> >(basis, true);
52  psop =
54  *smolyak_basis, use_smolyak, use_pst));
55  }
56 
57  else if (type == "Quadrature") {
58  Teuchos::ParameterList& quadParams = sgParams.sublist("Quadrature");
60  if (quadParams.template isType<Teuchos::RCP<const Stokhos::Quadrature<ordinal_type,value_type> > >("Stochastic Galerkin Quadrature"))
61  quad = quadParams.template get<Teuchos::RCP<const Stokhos::Quadrature<ordinal_type,value_type> > >("Stochastic Galerkin Quadrature");
62  else {
63  quad =
65  quadParams.set("Stochastic Galerkin Quadrature", quad);
66  }
67  psop =
69  }
70 
71  else
74  std::endl <<
75  "Invalid pseudospectral operator type " << type << std::endl);
76 
77  psopParams.set("Stochastic Galerkin Pseudospectral Operator", psop);
78  return psop;
79 }
static Teuchos::RCP< const psop_type > create(Teuchos::ParameterList &sgParams)
Generate pseudospectral operator object.
T & get(ParameterList &l, const std::string &name)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
RCP< ParameterList > sublist(const RCP< ParameterList > &paramList, const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
Abstract base class for multivariate orthogonal polynomials.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Abstract base class for quadrature methods.
An operator for building pseudo-spectral coefficients using a sparse Smolyak construction.
Abstract base class for multivariate orthogonal polynomials generated from tensor products of univari...
Multivariate orthogonal polynomial basis generated from a Smolyak sparse grid.
Factory for building multivariate orthogonal polynomial bases.
An operator for building pseudo-spectral coefficients using tensor-product quadrature.
static Teuchos::RCP< const Stokhos::Quadrature< ordinal_type, value_type > > create(Teuchos::ParameterList &sgParams)
Generate quadrature object.
An operator for building pseudo-spectral coefficients using an arbitrary quadrature rule...