44#include "Teuchos_UnitTestHarness.hpp"
45#include "Teuchos_TestingHelpers.hpp"
46#include "Teuchos_UnitTestRepository.hpp"
47#include "Teuchos_GlobalMPISession.hpp"
59 template <
typename OrdinalType,
typename ValueType>
64 Teuchos::RCP<const Stokhos::CompletePolynomialBasis<OrdinalType,ValueType> >
basis;
65 Teuchos::RCP<const Stokhos::Quadrature<OrdinalType,ValueType> >
quad;
67 Teuchos::RCP< Stokhos::QuadOrthogPolyExpansion<OrdinalType,ValueType> >
exp,
exp_linear;
68 Teuchos::RCP< Stokhos::QuadOrthogPolyExpansion<OrdinalType,ValueType> >
qexp;
69 Stokhos::OrthogPolyApprox<OrdinalType,ValueType> x,
y,
u,
u2,
cx,
cu,
cu2,
sx,
su,
su2,
c1;
71 Teuchos::RCP< Stokhos::DenseDirectDivisionExpansionStrategy<int,double,Stokhos::StandardStorage<int, double> > >
direct_division_strategy;
80 const OrdinalType d = 2;
81 const OrdinalType p = 7;
84 Teuchos::Array< Teuchos::RCP<const Stokhos::OneDOrthogPolyBasis<OrdinalType,ValueType> > > bases(d);
85 for (OrdinalType i=0; i<d; i++)
96 Cijk =
basis->computeTripleProductTensor();
128 for (OrdinalType i=0; i<d; i++) {
148 Teuchos::RCP< Stokhos::CGDivisionExpansionStrategy<int,double,Stokhos::StandardStorage<int, double> > > cg_division_strategy =
149 Teuchos::rcp(
new Stokhos::CGDivisionExpansionStrategy<
int,
double,
Stokhos::StandardStorage<int, double> >(
setup.basis,
setup.Cijk, 1, 1e-12, 0, 100, 0, 0,1));
156 Teuchos::RCP< Stokhos::CGDivisionExpansionStrategy<int,double,Stokhos::StandardStorage<int, double> > > cg_diag_division_strategy =
157 Teuchos::rcp(
new Stokhos::CGDivisionExpansionStrategy<
int,
double,
Stokhos::StandardStorage<int, double> >(
setup.basis,
setup.Cijk, 1, 1e-12, 2, 100, 0, 0,1));
158 cg_diag_division_strategy->divide(
setup.u, 1.0,
setup.c1,
setup.x, 0.0);
164 Teuchos::RCP< Stokhos::CGDivisionExpansionStrategy<int,double,Stokhos::StandardStorage<int, double> > > cg_jacobi_division_strategy =
165 Teuchos::rcp(
new Stokhos::CGDivisionExpansionStrategy<
int,
double,
Stokhos::StandardStorage<int, double> >(
setup.basis,
setup.Cijk, 1, 1e-12, 3, 100, 0, 0,1));
166 cg_jacobi_division_strategy->divide(
setup.u, 1.0,
setup.c1,
setup.x, 0.0);
172 Teuchos::RCP< Stokhos::CGDivisionExpansionStrategy<int,double,Stokhos::StandardStorage<int, double> > > cg_schur_division_strategy =
173 Teuchos::rcp(
new Stokhos::CGDivisionExpansionStrategy<
int,
double,
Stokhos::StandardStorage<int, double> >(
setup.basis,
setup.Cijk, 0, 1e-12, 4, 100, 0, 0,1));
174 cg_schur_division_strategy->divide(
setup.u, 1.0,
setup.c1,
setup.x, 0.0);
181 Teuchos::RCP< Stokhos::CGDivisionExpansionStrategy<int,double,Stokhos::StandardStorage<int, double> > > cg_nonlin_division_strategy =
182 Teuchos::rcp(
new Stokhos::CGDivisionExpansionStrategy<
int,
double,
Stokhos::StandardStorage<int, double> >(
setup.basis,
setup.Cijk, 1, 1e-12, 0, 100, 0, 0,1));
183 cg_nonlin_division_strategy->divide(
setup.u, 1.0,
setup.c1,
setup.cu, 0.0);
189 Teuchos::RCP< Stokhos::CGDivisionExpansionStrategy<int,double,Stokhos::StandardStorage<int, double> > > cg_nonlin_division_strategy =
190 Teuchos::rcp(
new Stokhos::CGDivisionExpansionStrategy<
int,
double,
Stokhos::StandardStorage<int, double> >(
setup.basis,
setup.Cijk, 1, 1e-12, 2, 100, 0, 0,1));
191 cg_nonlin_division_strategy->divide(
setup.u, 1.0,
setup.c1,
setup.cu, 0.0);
197 Teuchos::RCP< Stokhos::CGDivisionExpansionStrategy<int,double,Stokhos::StandardStorage<int, double> > > cg_nonlin_division_strategy =
198 Teuchos::rcp(
new Stokhos::CGDivisionExpansionStrategy<
int,
double,
Stokhos::StandardStorage<int, double> >(
setup.basis,
setup.Cijk, 1, 1e-12, 3, 100, 0, 0,1));
199 cg_nonlin_division_strategy->divide(
setup.u, 1.0,
setup.c1,
setup.cu, 0.0);
206 Teuchos::RCP< Stokhos::CGDivisionExpansionStrategy<int,double,Stokhos::StandardStorage<int, double> > > cg_nonlin_division_strategy =
207 Teuchos::rcp(
new Stokhos::CGDivisionExpansionStrategy<
int,
double,
Stokhos::StandardStorage<int, double> >(
setup.basis,
setup.Cijk, 0, 1e-12, 4, 100, 0, 0,1));
208 cg_nonlin_division_strategy->divide(
setup.u, 1.0,
setup.c1,
setup.cu, 0.0);
214 Teuchos::RCP< Stokhos::CGDivisionExpansionStrategy<int,double,Stokhos::StandardStorage<int, double> > > cg_nonlin_division_strategy =
215 Teuchos::rcp(
new Stokhos::CGDivisionExpansionStrategy<
int,
double,
Stokhos::StandardStorage<int, double> >(
setup.basis,
setup.Cijk, 0, 1e-12, 4, 100, 1, 0,1));
216 cg_nonlin_division_strategy->divide(
setup.u, 1.0,
setup.c1,
setup.cu, 0.0);
222 Teuchos::RCP< Stokhos::GMRESDivisionExpansionStrategy<int,double,Stokhos::StandardStorage<int, double> > > gmres_division_strategy =
223 Teuchos::rcp(
new Stokhos::GMRESDivisionExpansionStrategy<
int,
double,
Stokhos::StandardStorage<int, double> >(
setup.basis,
setup.Cijk, 1, 1e-12, 0, 100, 0, 0,1));
231 Teuchos::RCP< Stokhos::GMRESDivisionExpansionStrategy<int,double,Stokhos::StandardStorage<int, double> > > gmres_division_strategy =
232 Teuchos::rcp(
new Stokhos::GMRESDivisionExpansionStrategy<
int,
double,
Stokhos::StandardStorage<int, double> >(
setup.basis,
setup.Cijk, 1, 1e-12, 2, 100, 0, 0,1));
239 Teuchos::RCP< Stokhos::GMRESDivisionExpansionStrategy<int,double,Stokhos::StandardStorage<int, double> > > gmres_division_strategy =
240 Teuchos::rcp(
new Stokhos::GMRESDivisionExpansionStrategy<
int,
double,
Stokhos::StandardStorage<int, double> >(
setup.basis,
setup.Cijk, 1, 1e-12, 3, 100, 0, 0,1));
248 Teuchos::RCP< Stokhos::GMRESDivisionExpansionStrategy<int,double,Stokhos::StandardStorage<int, double> > > gmres_division_strategy =
249 Teuchos::rcp(
new Stokhos::GMRESDivisionExpansionStrategy<
int,
double,
Stokhos::StandardStorage<int, double> >(
setup.basis,
setup.Cijk, 0, 1e-12, 4, 100, 0, 0,1));
256 Teuchos::RCP< Stokhos::GMRESDivisionExpansionStrategy<int,double,Stokhos::StandardStorage<int, double> > > gmres_division_strategy =
257 Teuchos::rcp(
new Stokhos::GMRESDivisionExpansionStrategy<
int,
double,
Stokhos::StandardStorage<int, double> >(
setup.basis,
setup.Cijk, 1, 1e-12, 0, 100, 0, 0,1));
258 gmres_division_strategy->divide(
setup.u, 1.0,
setup.c1,
setup.cu, 0.0);
264 Teuchos::RCP< Stokhos::GMRESDivisionExpansionStrategy<int,double,Stokhos::StandardStorage<int, double> > > gmres_division_strategy =
265 Teuchos::rcp(
new Stokhos::GMRESDivisionExpansionStrategy<
int,
double,
Stokhos::StandardStorage<int, double> >(
setup.basis,
setup.Cijk, 1, 1e-12, 2, 100, 0, 0,1));
266 gmres_division_strategy->divide(
setup.u, 1.0,
setup.c1,
setup.cu, 0.0);
273 Teuchos::RCP< Stokhos::GMRESDivisionExpansionStrategy<int,double,Stokhos::StandardStorage<int, double> > > gmres_division_strategy =
274 Teuchos::rcp(
new Stokhos::GMRESDivisionExpansionStrategy<
int,
double,
Stokhos::StandardStorage<int, double> >(
setup.basis,
setup.Cijk, 1, 1e-12, 3, 100, 0, 0,1));
275 gmres_division_strategy->divide(
setup.u, 1.0,
setup.c1,
setup.cu, 0.0);
284 Teuchos::RCP< Stokhos::GMRESDivisionExpansionStrategy<int,double,Stokhos::StandardStorage<int, double> > > gmres_division_strategy =
285 Teuchos::rcp(
new Stokhos::GMRESDivisionExpansionStrategy<
int,
double,
Stokhos::StandardStorage<int, double> >(
setup.basis,
setup.Cijk, 0, 1e-12, 4, 100, 0, 0,1));
286 gmres_division_strategy->divide(
setup.u, 1.0,
setup.c1,
setup.cu, 0.0);
292 Teuchos::RCP< Stokhos::GMRESDivisionExpansionStrategy<int,double,Stokhos::StandardStorage<int, double> > > gmres_division_strategy =
293 Teuchos::rcp(
new Stokhos::GMRESDivisionExpansionStrategy<
int,
double,
Stokhos::StandardStorage<int, double> >(
setup.basis,
setup.Cijk, 0, 1e-12, 4, 100, 1, 0,1));
294 gmres_division_strategy->divide(
setup.u, 1.0,
setup.c1,
setup.cu, 0.0);
306 Teuchos::GlobalMPISession mpiSession(&argc, &
argv);
307 return Teuchos::UnitTestRepository::runUnitTestsFromMain(argc,
argv);
int main(int argc, char *argv[])
Strategy interface for computing PCE of a/b using only b[0].
Multivariate orthogonal polynomial basis generated from a total-order complete-polynomial tensor prod...
Strategy interface for computing PCE of a/b using only b[0].
Strategy interface for computing PCE of a/b using only b[0].
Legendre polynomial basis.
Class to store coefficients of a projection onto an orthogonal polynomial basis.
void reset(const Teuchos::RCP< const Stokhos::OrthogPolyBasis< ordinal_type, value_type > > &new_basis, ordinal_type sz=0)
Reset to a new basis.
reference term(ordinal_type dimension, ordinal_type order)
Get coefficient term for given dimension and order.
Orthogonal polynomial expansions based on numerical quadrature.
Defines quadrature for a tensor product basis by tensor products of 1-D quadrature rules.
TEUCHOS_UNIT_TEST(Stokhos_DivisionOperator, CG_Divide)
UnitTestSetup< int, double > setup
bool comparePCEs(const PCEType &a1, const std::string &a1_name, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &a2, const std::string &a2_name, const ValueType &rel_tol, const ValueType &abs_tol, Teuchos::FancyOStream &out)
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > c1
Teuchos::RCP< Stokhos::QuadOrthogPolyExpansion< OrdinalType, ValueType > > exp
Teuchos::RCP< Stokhos::Sparse3Tensor< int, double > > Cijk
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > x
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > u2
Teuchos::RCP< Stokhos::DenseDirectDivisionExpansionStrategy< int, double, Stokhos::StandardStorage< int, double > > > direct_division_strategy
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > cu
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > u
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > y
Teuchos::RCP< Stokhos::QuadOrthogPolyExpansion< OrdinalType, ValueType > > qexp
Teuchos::RCP< const Stokhos::CompletePolynomialBasis< OrdinalType, ValueType > > basis
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > sx
Teuchos::RCP< const Stokhos::Quadrature< OrdinalType, ValueType > > quad
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > cu2
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > su2
Teuchos::RCP< Stokhos::Sparse3Tensor< int, double > > Cijk_linear
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > cx
Stokhos::OrthogPolyApprox< OrdinalType, ValueType > su
Teuchos::RCP< Stokhos::QuadOrthogPolyExpansion< OrdinalType, ValueType > > exp_linear