Skip to content

Commit 64902bb

Browse files
committed
internals: splitting up decls/defs for sdc controller
towards fixing #84
1 parent f053346 commit 64902bb

File tree

2 files changed

+39
-33
lines changed

2 files changed

+39
-33
lines changed

include/pfasst/sdc.hpp

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,23 @@
1-
/*
2-
* Vanilla SDC controller.
3-
*/
4-
51
#ifndef _PFASST_SDC_HPP_
62
#define _PFASST_SDC_HPP_
73

8-
#include <iostream>
9-
using namespace std;
10-
114
#include "controller.hpp"
12-
#include "config.hpp"
5+
136

147
namespace pfasst
158
{
9+
/**
10+
* Vanilla SDC controller.
11+
*/
1612
template<typename time = time_precision>
1713
class SDC
1814
: public Controller<time>
1915
{
2016
public:
21-
void run()
22-
{
23-
auto sweeper = this->get_level(0);
24-
25-
for (; this->get_time() < this->get_end_time(); this->advance_time()) {
26-
bool initial = this->get_step() == 0;
27-
for (this->set_iteration(0);
28-
this->get_iteration() < this->get_max_iterations();
29-
this->advance_iteration()) {
30-
bool predict = this->get_iteration() == 0;
31-
if (predict) {
32-
sweeper->predict(initial);
33-
sweeper->post_predict();
34-
} else {
35-
sweeper->sweep();
36-
sweeper->post_sweep();
37-
}
38-
if (sweeper->converged()) {
39-
break;
40-
}
41-
}
42-
sweeper->post_step();
43-
sweeper->advance();
44-
}
45-
}
17+
virtual void run();
4618
};
4719
} // ::pfasst
4820

21+
#include "sdc_impl.hpp"
22+
4923
#endif

include/pfasst/sdc_impl.hpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#include "sdc.hpp"
2+
3+
4+
namespace pfasst
5+
{
6+
template<typename time>
7+
void SDC<time>::run()
8+
{
9+
auto sweeper = this->get_level(0);
10+
11+
for (; this->get_time() < this->get_end_time(); this->advance_time()) {
12+
bool initial = this->get_step() == 0;
13+
for (this->set_iteration(0);
14+
this->get_iteration() < this->get_max_iterations();
15+
this->advance_iteration()) {
16+
bool predict = this->get_iteration() == 0;
17+
if (predict) {
18+
sweeper->predict(initial);
19+
sweeper->post_predict();
20+
} else {
21+
sweeper->sweep();
22+
sweeper->post_sweep();
23+
}
24+
if (sweeper->converged()) {
25+
break;
26+
}
27+
}
28+
sweeper->post_step();
29+
sweeper->advance();
30+
}
31+
}
32+
} // ::pfasst

0 commit comments

Comments
 (0)