10 #include "TriKota_ConfigDefs.hpp"
11 #include "sandia_sgmg.hpp"
12 #include "sandia_rules.hpp"
15 template <
typename ordinal_type,
typename value_type>
16 Stokhos::SparseGridQuadrature<ordinal_type, value_type>::
18 const Teuchos::RCP<
const ProductBasis<ordinal_type,value_type> >& product_basis,
22 coordinate_bases(product_basis->getCoordinateBases())
24 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
47 compute1DPoints[i] = &(getMyPoints);
48 compute1DWeights[i] = &(getMyWeights);
49 growth_rules[i] = coordinate_bases[i]->getSparseGridGrowthRule();
59 webbur::sgmg_size_total(d, level, growth_rate, &growth_rules[0]);
61 webbur::sgmg_size(d, level, &compute1DPoints[0], duplicate_tol,
62 growth_rate, &growth_rules[0]);
66 quad_points.resize(ntot);
67 quad_weights.resize(ntot);
68 quad_values.resize(ntot);
71 webbur::sgmg_unique_index(d, level, &compute1DPoints[0],
72 duplicate_tol, ntot, num_total_pts,
73 growth_rate, &growth_rules[0],
74 &sparse_unique_index[0]);
75 webbur::sgmg_index(d, level, ntot, num_total_pts,
76 &sparse_unique_index[0], growth_rate,
78 &sparse_order[0], &sparse_index[0]);
79 webbur::sgmg_weight(d, level, &compute1DWeights[0],
81 &sparse_unique_index[0], growth_rate,
84 webbur::sgmg_point(d, level, &compute1DPoints[0],
85 ntot, &sparse_order[0],
86 &sparse_index[0], growth_rate,
91 quad_values[i].resize(sz);
92 quad_points[i].resize(d);
94 quad_points[i][
j] = gp[i*d+
j];
95 product_basis->evaluateBases(quad_points[i], quad_values[i]);
101 template <
typename ordinal_type,
typename value_type>
103 Stokhos::SparseGridQuadrature<ordinal_type, value_type>::
104 getQuadPoints()
const
109 template <
typename ordinal_type,
typename value_type>
111 Stokhos::SparseGridQuadrature<ordinal_type, value_type>::
112 getQuadWeights()
const
117 template <
typename ordinal_type,
typename value_type>
119 Stokhos::SparseGridQuadrature<ordinal_type, value_type>::
120 getBasisAtQuadPoints()
const
125 template <
typename ordinal_type,
typename value_type>
127 Stokhos::SparseGridQuadrature<ordinal_type,value_type>::
128 getMyPoints(
int order,
int dim,
double x[] )
133 ordinal_type p = sgq->coordinate_bases[dim]->quadDegreeOfExactness(order);
134 sgq->coordinate_bases[dim]->getQuadPoints(p, quad_points,
135 quad_weights, quad_values);
137 for (
int i = 0; i<quad_points.
size(); i++) {
138 x[i] = quad_points[i];
142 template <
typename ordinal_type,
typename value_type>
144 Stokhos::SparseGridQuadrature<ordinal_type,value_type>::
145 getMyWeights(
int order,
int dim,
double w[] )
150 ordinal_type p = sgq->coordinate_bases[dim]->quadDegreeOfExactness(order);
151 sgq->coordinate_bases[dim]->getQuadPoints(p, quad_points,
152 quad_weights, quad_values);
154 for (
int i = 0; i<quad_points.
size(); i++) {
155 w[i] = quad_weights[i];
159 template <
typename ordinal_type,
typename value_type>
161 Stokhos::SparseGridQuadrature<ordinal_type,value_type>::
162 print(std::ostream& os)
const
165 os <<
"Sparse Grid Quadrature with " << nqp <<
" points:"
166 << std::endl <<
"Weight : Points" << std::endl;
168 os << i <<
": " << quad_weights[i] <<
" : ";
171 os << quad_points[i][
j] <<
" ";
174 os <<
"Basis values at quadrature points:" << std::endl;
176 os << i <<
" " <<
": ";
179 os << quad_values[i][
j] <<
" ";
#define TEUCHOS_FUNC_TIME_MONITOR(FUNCNAME)
#define TEUCHOS_ASSERT(assertion_test)