1+ /* *
2+ * @file pfasst/quadrature.hpp
3+ * @since v0.1.0
4+ */
15#ifndef _PFASST__QUADRATURE_HPP_
26#define _PFASST__QUADRATURE_HPP_
37
48#include < cmath>
59#include < exception>
6- #include < type_traits>
710#include < vector>
11+ using namespace std ;
812
913#include < Eigen/Dense>
14+ template <typename scalar>
15+ using Matrix = Eigen::Matrix<scalar, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>;
16+
1017#include < boost/math/constants/constants.hpp>
1118
1219#include " pfasst/config.hpp"
1926#include " pfasst/quadrature/clenshaw_curtis.hpp"
2027#include " pfasst/quadrature/uniform.hpp"
2128
22- template <typename scalar>
23- using Matrix = Eigen::Matrix<scalar, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>;
24-
25- using namespace std ;
2629
2730namespace pfasst
2831{
29-
32+ /* *
33+ * functionality related to computing quadrature nodes and weights.
34+ *
35+ * @note Please note, that all quadrature nodes are in the range \\( [0, 1] \\).
36+ */
3037 namespace quadrature
3138 {
32-
39+ /* *
40+ * instantiates quadrature handler for given number of nodes and type descriptor.
41+ *
42+ * @tparam precision numerical type of the nodes (e.g. `double`)
43+ * @param[in] nnodes number of quadrature nodes
44+ * @param[in] qtype type descriptor of the quadrature
45+ * @returns instance of pfasst::quadrature::IQuadrature of specified type with desired number
46+ * of nodes
47+ * @throws pfasst::ValueError if @p qtype is not a valid quadrature type descriptor
48+ */
3349 template <typename precision = pfasst::time_precision>
34- shared_ptr<IQuadrature<precision>> quadrature_factory (const size_t nnodes, const QuadratureType qtype)
50+ shared_ptr<IQuadrature<precision>> quadrature_factory (const size_t nnodes,
51+ const QuadratureType qtype)
3552 {
3653 if (qtype == QuadratureType::GaussLegendre) {
3754 return make_shared<GaussLegendre<precision>>(nnodes);
@@ -49,12 +66,28 @@ namespace pfasst
4966 }
5067 }
5168
69+ /* *
70+ * compute quadrature nodes for given quadrature type descriptor.
71+ *
72+ * @tparam precision numerical type of the nodes (e.g. `double`)
73+ * @param[in] nnodes number of quadrature nodes to compute
74+ * @param[in] qtype type descriptor of the quadrature nodes
75+ * @returns std::vector of quadrature nodes of given type
76+ *
77+ * @see pfasst::quadrature::QuadratureType for valid types
78+ * @see pfasst::quadrature::quadrature_factory for further details
79+ */
5280 template <typename precision = pfasst::time_precision>
5381 vector<precision> compute_nodes (size_t nnodes, QuadratureType qtype)
5482 {
5583 return quadrature_factory<precision>(nnodes, qtype)->get_nodes ();
5684 }
5785
86+ /* *
87+ * @todo write documentation
88+ *
89+ * @tparam precision numerical type of the interpolation (e.g. `double`)
90+ */
5891 template <typename precision = time_precision>
5992 Matrix<precision> compute_interp (vector<precision> dst, vector<precision> src)
6093 {
@@ -84,13 +117,12 @@ namespace pfasst
84117
85118 return mat;
86119 }
87-
88120 } // ::pfasst::quadrature
89121
122+
90123 namespace config
91124 {
92- // note: GCC fails with "error: explicit template specialization cannot have a storage class"
93- // if this template specialization is also declared 'static'; Clang does not care.
125+ // ! @overload
94126 template <>
95127 inline quadrature::QuadratureType get_value (const string& name)
96128 {
@@ -110,21 +142,18 @@ namespace pfasst
110142 }
111143 }
112144
113- // note: GCC fails with "error: explicit template specialization cannot have a storage class"
114- // if this template specialization is also declared 'static'; Clang does not care.
145+ // ! @overload
115146 template <>
116147 inline quadrature::QuadratureType get_value (const string& name,
117- const quadrature::QuadratureType& default_value)
148+ const quadrature::QuadratureType& default_value)
118149 {
119150 if (options::get_instance ().get_variables_map ().count (name) == 1 ) {
120151 return get_value<quadrature::QuadratureType>(name);
121152 } else {
122153 return default_value;
123154 }
124155 }
125-
126156 } // ::pfasst::config
127-
128157} // ::pfasst
129158
130159#endif // _PFASST__QUADRATURE_HPP_
0 commit comments