44 #include "TriKota_ConfigDefs.hpp"
45 #include "sandia_sgmg.hpp"
46 #include "sandia_rules.hpp"
49 template <
typename ordinal_type,
typename value_type>
50 Stokhos::SparseGridQuadrature<ordinal_type, value_type>::
52 const Teuchos::RCP<
const ProductBasis<ordinal_type,value_type> >& product_basis,
56 coordinate_bases(product_basis->getCoordinateBases())
58 #ifdef STOKHOS_TEUCHOS_TIME_MONITOR
81 compute1DPoints[i] = &(getMyPoints);
82 compute1DWeights[i] = &(getMyWeights);
83 growth_rules[i] = coordinate_bases[i]->getSparseGridGrowthRule();
93 webbur::sgmg_size_total(d, level, growth_rate, &growth_rules[0]);
95 webbur::sgmg_size(d, level, &compute1DPoints[0], duplicate_tol,
96 growth_rate, &growth_rules[0]);
100 quad_points.resize(ntot);
101 quad_weights.resize(ntot);
102 quad_values.resize(ntot);
105 webbur::sgmg_unique_index(d, level, &compute1DPoints[0],
106 duplicate_tol, ntot, num_total_pts,
107 growth_rate, &growth_rules[0],
108 &sparse_unique_index[0]);
109 webbur::sgmg_index(d, level, ntot, num_total_pts,
110 &sparse_unique_index[0], growth_rate,
112 &sparse_order[0], &sparse_index[0]);
113 webbur::sgmg_weight(d, level, &compute1DWeights[0],
115 &sparse_unique_index[0], growth_rate,
118 webbur::sgmg_point(d, level, &compute1DPoints[0],
119 ntot, &sparse_order[0],
120 &sparse_index[0], growth_rate,
125 quad_values[i].resize(sz);
126 quad_points[i].resize(d);
128 quad_points[i][
j] = gp[i*d+
j];
129 product_basis->evaluateBases(quad_points[i], quad_values[i]);
135 template <
typename ordinal_type,
typename value_type>
137 Stokhos::SparseGridQuadrature<ordinal_type, value_type>::
138 getQuadPoints()
const
143 template <
typename ordinal_type,
typename value_type>
145 Stokhos::SparseGridQuadrature<ordinal_type, value_type>::
146 getQuadWeights()
const
151 template <
typename ordinal_type,
typename value_type>
153 Stokhos::SparseGridQuadrature<ordinal_type, value_type>::
154 getBasisAtQuadPoints()
const
159 template <
typename ordinal_type,
typename value_type>
161 Stokhos::SparseGridQuadrature<ordinal_type,value_type>::
162 getMyPoints(
int order,
int dim,
double x[] )
167 ordinal_type p = sgq->coordinate_bases[dim]->quadDegreeOfExactness(order);
168 sgq->coordinate_bases[dim]->getQuadPoints(p, quad_points,
169 quad_weights, quad_values);
171 for (
int i = 0; i<quad_points.
size(); i++) {
172 x[i] = quad_points[i];
176 template <
typename ordinal_type,
typename value_type>
178 Stokhos::SparseGridQuadrature<ordinal_type,value_type>::
179 getMyWeights(
int order,
int dim,
double w[] )
184 ordinal_type p = sgq->coordinate_bases[dim]->quadDegreeOfExactness(order);
185 sgq->coordinate_bases[dim]->getQuadPoints(p, quad_points,
186 quad_weights, quad_values);
188 for (
int i = 0; i<quad_points.
size(); i++) {
189 w[i] = quad_weights[i];
193 template <
typename ordinal_type,
typename value_type>
195 Stokhos::SparseGridQuadrature<ordinal_type,value_type>::
196 print(std::ostream& os)
const
199 os <<
"Sparse Grid Quadrature with " << nqp <<
" points:"
200 << std::endl <<
"Weight : Points" << std::endl;
202 os << i <<
": " << quad_weights[i] <<
" : ";
205 os << quad_points[i][
j] <<
" ";
208 os <<
"Basis values at quadrature points:" << std::endl;
210 os << i <<
" " <<
": ";
213 os << quad_values[i][
j] <<
" ";
#define TEUCHOS_FUNC_TIME_MONITOR(FUNCNAME)
#define TEUCHOS_ASSERT(assertion_test)