44 template <
typename ordinal_type,
typename value_type>
45 Stokhos::PecosOneDOrthogPolyBasis<ordinal_type, value_type>::
46 PecosOneDOrthogPolyBasis(
49 pecosPoly(pecosPoly_),
52 sparse_grid_growth_rule(webbur::level_to_order_linear_wn),
56 norms[i] = pecosPoly->norm_squared(i);
59 template <
typename ordinal_type,
typename value_type>
60 Stokhos::PecosOneDOrthogPolyBasis<ordinal_type, value_type>::
61 PecosOneDOrthogPolyBasis(
62 ordinal_type p_,
const PecosOneDOrthogPolyBasis& basis) :
63 pecosPoly(basis.pecosPoly),
66 sparse_grid_growth_rule(basis.sparse_grid_growth_rule),
70 norms[i] = pecosPoly->norm_squared(i);
73 template <
typename ordinal_type,
typename value_type>
74 Stokhos::PecosOneDOrthogPolyBasis<ordinal_type, value_type>::
75 ~PecosOneDOrthogPolyBasis()
79 template <
typename ordinal_type,
typename value_type>
81 Stokhos::PecosOneDOrthogPolyBasis<ordinal_type, value_type>::
87 template <
typename ordinal_type,
typename value_type>
89 Stokhos::PecosOneDOrthogPolyBasis<ordinal_type, value_type>::
95 template <
typename ordinal_type,
typename value_type>
97 Stokhos::PecosOneDOrthogPolyBasis<ordinal_type, value_type>::
103 template <
typename ordinal_type,
typename value_type>
105 Stokhos::PecosOneDOrthogPolyBasis<ordinal_type, value_type>::
111 template <
typename ordinal_type,
typename value_type>
113 Stokhos::PecosOneDOrthogPolyBasis<ordinal_type, value_type>::
114 computeTripleProductTensor()
const
119 Teuchos::rcp(
new Dense3Tensor<ordinal_type, value_type>(sz));
122 getQuadPoints(3*p, points, weights, values);
131 weights[l]*(values[l][i])*(values[l][
j])*(values[l][k]);
133 (*Cijk)(i,
j,k) = triple_product;
141 template <
typename ordinal_type,
typename value_type>
143 Stokhos::PecosOneDOrthogPolyBasis<ordinal_type, value_type>::
144 computeSparseTripleProductTensor(
ordinal_type order)
const
150 Teuchos::rcp(
new Sparse3Tensor<ordinal_type, value_type>());
153 getQuadPoints(3*p, points, weights, values);
162 weights[l]*(values[l][i])*(values[l][
j])*(values[l][k]);
164 if (
std::abs(triple_product/norms[i]) > sparse_tol)
165 Cijk->add_term(i,
j,k,triple_product);
169 Cijk->fillComplete();
174 template <
typename ordinal_type,
typename value_type>
176 Stokhos::PecosOneDOrthogPolyBasis<ordinal_type, value_type>::
177 computeDerivDoubleProductTensor()
const
182 getQuadPoints(2*p, points, weights, values);
188 evaluateBasesAndDerivatives(points[i], values[i], derivs[i]);
195 for (
int qp=0; qp<nqp; qp++)
196 b += weights[qp]*derivs[qp][i]*values[qp][
j];
204 template <
typename ordinal_type,
typename value_type>
206 Stokhos::PecosOneDOrthogPolyBasis<ordinal_type,value_type>::
210 basis_pts[i] = pecosPoly->type1_value(x, i);
213 template <
typename ordinal_type,
typename value_type>
215 Stokhos::PecosOneDOrthogPolyBasis<ordinal_type,value_type>::
216 evaluateBasesAndDerivatives(
const value_type& x,
221 vals[i] = pecosPoly->type1_value(x, i);
222 derivs[i] = pecosPoly->type1_gradient(x, i);
226 template <
typename ordinal_type,
typename value_type>
228 Stokhos::PecosOneDOrthogPolyBasis<ordinal_type,value_type>::
231 return pecosPoly->type1_value(x, k);
234 template <
typename ordinal_type,
typename value_type>
236 Stokhos::PecosOneDOrthogPolyBasis<ordinal_type, value_type>::
237 print(std::ostream& os)
const
239 os <<
"Pecos " << name <<
" basis of order " << p <<
"." << std::endl;
240 os <<
"Basis polynomial norms (squared):\n\t";
242 os << norms[i] <<
" ";
246 template <
typename ordinal_type,
typename value_type>
248 Stokhos::PecosOneDOrthogPolyBasis<ordinal_type, value_type>::
254 template <
typename ordinal_type,
typename value_type>
256 Stokhos::PecosOneDOrthogPolyBasis<ordinal_type,value_type>::
265 const Pecos::RealArray& gp = pecosPoly->collocation_points(num_points);
266 const Pecos::RealArray& gw = pecosPoly->type1_collocation_weights(num_points);
267 quad_points.
resize(num_points);
268 quad_weights.
resize(num_points);
270 quad_points[i] = gp[i];
271 quad_weights[i] = gw[i];
275 quad_values.
resize(num_points);
277 quad_values[i].resize(p+1);
278 evaluateBases(quad_points[i], quad_values[i]);
282 template <
typename ordinal_type,
typename value_type>
284 Stokhos::PecosOneDOrthogPolyBasis<ordinal_type,value_type>::
290 template <
typename ordinal_type,
typename value_type>
292 Stokhos::PecosOneDOrthogPolyBasis<ordinal_type,value_type>::
296 Teuchos::rcp(
new Stokhos::PecosOneDOrthogPolyBasis<ordinal_type,value_type>(p,*
this));
299 template <
typename ordinal_type,
typename value_type>
301 Stokhos::PecosOneDOrthogPolyBasis<ordinal_type,value_type>::
307 template <
typename ordinal_type,
typename value_type>
309 Stokhos::PecosOneDOrthogPolyBasis<ordinal_type,value_type>::
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
KOKKOS_INLINE_FUNCTION PCE< Storage > ceil(const PCE< Storage > &a)
KOKKOS_INLINE_FUNCTION PCE< Storage > abs(const PCE< Storage > &a)
void resize(size_type new_size, const value_type &x=value_type())