1- /*
2- * Host based encapsulated base sweeper.
1+ /* *
2+ * @file pfasst/encap/encap_sweeper.hpp
3+ * @since v0.1.0
34 */
4-
55#ifndef _PFASST_ENCAP_ENCAP_SWEEPER_HPP_
66#define _PFASST_ENCAP_ENCAP_SWEEPER_HPP_
77
@@ -20,139 +20,215 @@ namespace pfasst
2020 {
2121 using namespace pfasst ::quadrature;
2222
23+
24+ /* *
25+ * host based encapsulated base sweeper.
26+ *
27+ * @tparam time time precision; defaults to pfasst::time_precision
28+ */
2329 template <typename time = time_precision>
2430 class EncapSweeper
2531 : public ISweeper<time>
2632 {
2733 protected:
2834 // ! @{
35+ // ! quadrature rule used by this sweeper
2936 shared_ptr<IQuadrature<time>> quadrature;
37+
38+ // ! encapsulation data structure factory
3039 shared_ptr<EncapFactory<time>> factory;
40+
41+ // ! separate start state, i.e. initial condition for the sweeper's current time step
3142 shared_ptr<Encapsulation<time>> start_state;
43+
44+ // ! current solution at \\( T_{end} \\)
3245 shared_ptr<Encapsulation<time>> end_state;
46+
47+ /* *
48+ * place for the residuals at the different time nodes
49+ *
50+ * The index of the vector corresponds to the index of the quadrature nodes, i.e.
51+ * `residuals.size() == quadrature->get_num_nodes()`.
52+ */
3353 vector<shared_ptr<Encapsulation<time>>> residuals;
3454 // ! @}
3555
3656 // ! @{
3757 /* *
38- * Solution values \\( U \\) at all time nodes of the current iteration.
58+ * solution values \\( U \\) at all time nodes of the current iteration.
59+ *
60+ * The index of the vector corresponds to the index of the quadrature nodes, i.e.
61+ * `state.size() == quadrature->get_num_nodes()`.
3962 */
4063 vector<shared_ptr<Encapsulation<time>>> state;
4164
4265 /* *
43- * Solution values \\( U \\) at all time nodes of the previous iteration.
66+ * solution values \\( U \\) at all time nodes of the previous iteration.
67+ *
68+ * The index of the vector corresponds to the index of the quadrature nodes, i.e.
69+ * `saved_state.size() == quadrature->get_num_nodes()`.
4470 */
4571 vector<shared_ptr<Encapsulation<time>>> saved_state;
4672
4773 /* *
4874 * FAS corrections \\( \\tau \\) at all time nodes of the current iteration.
75+ *
76+ * The index of the vector corresponds to the index of the quadrature nodes, i.e.
77+ * `fas_corrections.size() == quadrature->get_num_nodes()`.
4978 */
5079 vector<shared_ptr<Encapsulation<time>>> fas_corrections;
5180 // ! @}
5281
82+ // ! @{
83+ // ! @todo Write documentation for this member.
5384 int residual_norm_order;
54- time abs_residual_tol, rel_residual_tol;
85+
86+ /* *
87+ * tolerance for absolute residual.
88+ *
89+ * The absolute residual is the residual between the very first iteration and the current
90+ * state.
91+ */
92+ time abs_residual_tol;
93+
94+ /* *
95+ * tolerance for relative residual.
96+ *
97+ * The relative residual is the residual between the previous iteration and current state.
98+ */
99+ time rel_residual_tol;
100+ // ! @}
55101
56102 public:
57103 EncapSweeper ();
58104
59105 // ! @{
60106 /* *
61- * Retrieve solution values of current iteration at time node index `m` .
107+ * retrieve solution values of current iteration at time node index @p m .
62108 *
63109 * @param[in] m 0-based index of time node
64110 */
65111 virtual shared_ptr<Encapsulation<time>> get_state (size_t m) const ;
66112
67113 /* *
68- * Retrieve FAS correction of current iteration at time node index `m` .
114+ * retrieve FAS correction of current iteration at time node index @p m .
69115 *
70116 * @param[in] m 0-based index of time node
71117 */
72118 virtual shared_ptr<Encapsulation<time>> get_tau (size_t m) const ;
73119
74120 /* *
75- * Retrieve solution values of previous iteration at time node index `m` .
121+ * retrieve solution values of previous iteration at time node index @p m .
76122 *
77123 * @param[in] m 0-based index of time node
78124 */
79125 virtual shared_ptr<Encapsulation<time>> get_saved_state (size_t m) const ;
80126 // ! @}
81127
82128 // ! @{
129+ /* *
130+ * @copybrief ISweeper::set_options()
131+ */
83132 virtual void set_options () override ;
133+
134+ /* *
135+ * @copybrief ISweeper::setup()
136+ */
84137 virtual void setup (bool coarse) override ;
85138 // ! @}
86139
87140 // ! @{
141+ /* *
142+ * @copybrief ISweeper::spread()
143+ */
88144 virtual void spread () override ;
89145
90146 /* *
91- * Save current solution states.
147+ * @copybrief ISweeper::save()
92148 */
93149 virtual void save (bool initial_only) override ;
94150 // ! @}
95151
96152 // ! @{
97153 virtual void set_quadrature (shared_ptr<IQuadrature<time>> quadrature);
98154 virtual shared_ptr<const IQuadrature<time>> get_quadrature () const ;
99- virtual shared_ptr<Encapsulation<time>> get_start_state () const ;
155+
100156 virtual const vector<time> get_nodes () const ;
157+
101158 virtual void set_factory (shared_ptr<EncapFactory<time>> factory);
102159 virtual shared_ptr<EncapFactory<time>> get_factory () const ;
160+
161+ virtual shared_ptr<Encapsulation<time>> get_start_state () const ;
103162 virtual shared_ptr<Encapsulation<time>> get_end_state ();
104163 // ! @}
105164
106165 // ! @{
107166 /* *
108- * @copydoc ISweeper::advance()
109- *
110- * @note This method must be implemented in derived sweepers.
167+ * @copybrief ISweeper::advance()
111168 */
112169 virtual void advance () override ;
113170
114171 /* *
115- * Re -evaluate function values.
172+ * re -evaluate function values.
116173 *
117- * @note This method must be implemented in derived sweepers.
174+ * @param[in] initial_only whether the right hand side should only be evaluated at the
175+ * initial time point
118176 */
119177 virtual void reevaluate (bool initial_only = false );
120178
121179 /* *
122180 * integrates values of right hand side at all time nodes \\( t \\in [0,M-1] \\)
123181 * simultaneously
124182 *
125- * @param[in] dt width of the time interval to integrate
183+ * @param[in] dt width of the time interval to integrate
126184 * @param[in,out] dst integrated values
127- *
128- * @note This method must be implemented in derived sweepers.
129185 */
130186 virtual void integrate (time dt, vector<shared_ptr<Encapsulation<time>>> dst) const ;
131187 // ! @}
132188
133189 // ! @{
134190 /* *
135- * Set residual tolerances for convergence checking.
191+ * set residual tolerances for convergence checking.
192+ *
193+ * @param[in] abs_residual_tol tolerance for the absolute residual
194+ * @param[in] rel_residual_tol tolerance for the relative residual
195+ * @param[in] order
136196 */
137197 void set_residual_tolerances (time abs_residual_tol, time rel_residual_tol, int order = 0 );
138198
139199 /* *
140- * Compute residual at each SDC node (including FAS corrections).
200+ * compute residual at each SDC node (including FAS corrections).
201+ *
202+ * @param[in] dt width of the time interval to compute the residual for
203+ * @param[in,out] dst place to store the residuals at time nodes
141204 */
142205 virtual void residual (time dt, vector<shared_ptr<Encapsulation<time>>> dst) const ;
143206
144207 /* *
145- * Return convergence status.
146- *
147- * This is used by controllers to shortcircuit iterations.
208+ * @copybrief ISweeper::converged()
148209 */
149210 virtual bool converged () override ;
150211 // ! @}
151212
152213 // ! @{
214+ /* *
215+ * @copybrief ISweeper::post()
216+ */
153217 virtual void post (ICommunicator* comm, int tag) override ;
218+
219+ /* *
220+ * @copybrief ISweeper::send()
221+ */
154222 virtual void send (ICommunicator* comm, int tag, bool blocking) override ;
223+
224+ /* *
225+ * @copybrief ISweeper::recv()
226+ */
155227 virtual void recv (ICommunicator* comm, int tag, bool blocking) override ;
228+
229+ /* *
230+ * @copybrief ISweeper::broadcast()
231+ */
156232 virtual void broadcast (ICommunicator* comm) override ;
157233 // ! @}
158234 };
0 commit comments