Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Stokhos_UserDefinedQuadratureImp.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 template <typename ordinal_type, typename value_type>
15  const Teuchos::RCP<const Teuchos::Array<value_type> >& weights)
16  : quad_points(points),
17  quad_weights(weights)
18 {
19  ordinal_type nqp = points->size();
22  for (ordinal_type i=0; i<nqp; i++) {
23  (*qv)[i].resize(basis->size());
24  basis->evaluateBases((*points)[i], (*qv)[i]);
25  }
26  quad_values = qv;
27 }
28 
29 template <typename ordinal_type, typename value_type>
33 const Teuchos::RCP<const Teuchos::Array<value_type> >& weights,
35  : quad_points(points),
36  quad_weights(weights),
37  quad_values(values)
38 {
39 }
40 
41 template <typename ordinal_type, typename value_type>
45 {
46  return *quad_points;
47 }
48 
49 template <typename ordinal_type, typename value_type>
53 {
54  return *quad_weights;
55 }
56 
57 template <typename ordinal_type, typename value_type>
61 {
62  return *quad_values;
63 }
64 
65 template <typename ordinal_type, typename value_type>
66 std::ostream&
68 print(std::ostream& os) const
69 {
70  ordinal_type nqp = quad_weights->size();
71  os << "Sparse Grid Quadrature with " << nqp << " points:"
72  << std::endl << "Weight : Points" << std::endl;
73  for (ordinal_type i=0; i<nqp; i++) {
74  os << i << ": " << (*quad_weights)[i] << " : ";
75  for (ordinal_type j=0;
76  j<static_cast<ordinal_type>((*quad_points)[i].size());
77  j++)
78  os << (*quad_points)[i][j] << " ";
79  os << std::endl;
80  }
81  os << "Basis values at quadrature points:" << std::endl;
82  for (ordinal_type i=0; i<nqp; i++) {
83  os << i << " " << ": ";
84  for (ordinal_type j=0;
85  j<static_cast<ordinal_type>((*quad_values)[i].size());
86  j++)
87  os << (*quad_values)[i][j] << " ";
88  os << std::endl;
89  }
90 
91  return os;
92 }
virtual const Teuchos::Array< Teuchos::Array< value_type > > & getQuadPoints() const
Get quadrature points.
Teuchos::RCP< const Teuchos::Array< Teuchos::Array< value_type > > > quad_values
Quadrature values.
Abstract base class for multivariate orthogonal polynomials.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
virtual std::ostream & print(std::ostream &os) const
Print quadrature data.
virtual const Teuchos::Array< value_type > & getQuadWeights() const
Get quadrature weights.
virtual const Teuchos::Array< Teuchos::Array< value_type > > & getBasisAtQuadPoints() const
Get values of basis at quadrature points.
UserDefinedQuadrature(const Teuchos::RCP< const OrthogPolyBasis< ordinal_type, value_type > > &basis, const Teuchos::RCP< const Teuchos::Array< Teuchos::Array< value_type > > > &points, const Teuchos::RCP< const Teuchos::Array< value_type > > &weights)
Constructor.