Skip to content

Commit 63db632

Browse files
committed
reordering: moving controllers into own subfolder
1 parent 8b0fd93 commit 63db632

File tree

18 files changed

+221
-217
lines changed

18 files changed

+221
-217
lines changed

examples/advection_diffusion/mpi_pfasst.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ using namespace std;
1414
#include <fftw3.h>
1515

1616
#include <pfasst.hpp>
17-
#include <pfasst/pfasst.hpp>
17+
#include <pfasst/controller/pfasst.hpp>
1818
#include <pfasst/mpi_communicator.hpp>
1919
#include <pfasst/encap/automagic.hpp>
2020
#include <pfasst/encap/mpi_vector.hpp>

examples/advection_diffusion/serial_mlsdc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ using namespace std;
1212
#include <pfasst.hpp>
1313
#include <pfasst/logging.hpp>
1414
#include <pfasst/config.hpp>
15-
#include <pfasst/mlsdc.hpp>
15+
#include <pfasst/controller/mlsdc.hpp>
1616
#include <pfasst/encap/vector.hpp>
1717
using namespace pfasst::encap;
1818

examples/advection_diffusion/serial_mlsdc_autobuild.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ using namespace std;
1919
#include <pfasst.hpp>
2020
#include <pfasst/logging.hpp>
2121
#include <pfasst/config.hpp>
22-
#include <pfasst/mlsdc.hpp>
22+
#include <pfasst/controller/mlsdc.hpp>
2323
#include <pfasst/encap/automagic.hpp>
2424
#include <pfasst/encap/vector.hpp>
2525
using namespace pfasst;

examples/advection_diffusion/vanilla_sdc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <pfasst.hpp>
1313
#include <pfasst/logging.hpp>
1414
#include <pfasst/config.hpp>
15-
#include <pfasst/sdc.hpp>
15+
#include <pfasst/controller/sdc.hpp>
1616
#include <pfasst/encap/vector.hpp>
1717

1818
#include "advection_diffusion_sweeper.hpp"

examples/boris/boris_mlsdc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#include <pfasst.hpp>
44
#include <pfasst/config.hpp>
55
#include <pfasst/logging.hpp>
6-
#include <pfasst/sdc.hpp>
7-
#include <pfasst/mlsdc.hpp>
6+
#include <pfasst/controller/sdc.hpp>
7+
#include <pfasst/controller/mlsdc.hpp>
88

99
#include "particle.hpp"
1010
#include "particle_cloud.hpp"

examples/boris/boris_sdc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <pfasst.hpp>
44
#include <pfasst/config.hpp>
55
#include <pfasst/logging.hpp>
6-
#include <pfasst/sdc.hpp>
6+
#include <pfasst/controller/sdc.hpp>
77

88
#include "particle.hpp"
99
#include "particle_cloud.hpp"

examples/scalar/scalar_sdc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ using namespace std;
1616
#include <pfasst.hpp>
1717
#include <pfasst/config.hpp>
1818
#include <pfasst/logging.hpp>
19-
#include <pfasst/sdc.hpp>
19+
#include <pfasst/controller/sdc.hpp>
2020
#include <pfasst/encap/vector.hpp>
2121

2222
#include "scalar_sweeper.hpp"

examples/vanderpol/vdp_sdc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <pfasst.hpp>
66
#include <pfasst/config.hpp>
77
#include <pfasst/logging.hpp>
8-
#include <pfasst/sdc.hpp>
8+
#include <pfasst/controller/sdc.hpp>
99
#include <pfasst/encap/vector.hpp>
1010

1111
#include "vdp_sweeper.hpp"

include/pfasst.hpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33

44
#include "pfasst/config.hpp"
55
#include "pfasst/logging.hpp"
6-
#include "pfasst/interfaces.hpp"
7-
#include "pfasst/quadrature.hpp"
8-
#include "pfasst/sdc.hpp"
9-
#include "pfasst/encap/encap_sweeper.hpp"
6+
107

118
namespace pfasst
129
{
13-
inline static void init(int argc, char** argv, std::function<void()> opts=nullptr, std::function<void()> logs=nullptr)
10+
inline static void init(int argc, char** argv,
11+
std::function<void()> opts = nullptr,
12+
std::function<void()> logs = nullptr)
1413
{
1514
if (opts) {
1615
opts();

include/pfasst/controller.hpp

Lines changed: 4 additions & 197 deletions
Original file line numberDiff line numberDiff line change
@@ -1,199 +1,6 @@
1-
#ifndef _PFASST_CONTROLLER_HPP_
2-
#define _PFASST_CONTROLLER_HPP_
1+
#ifndef _PFASST__CONTROLLER_HPP
2+
#define _PFASST__CONTROLLER_HPP
33

4-
#include <cassert>
5-
#include <deque>
6-
#include <iterator>
7-
#include <memory>
8-
using namespace std;
4+
#include "controller/controller.hpp"
95

10-
#include "interfaces.hpp"
11-
12-
13-
namespace pfasst
14-
{
15-
/**
16-
* base SDC/MLSDC/PFASST controller.
17-
*
18-
* Base controller (see also SDC, MLSDC, and PFASST controllers).
19-
*
20-
* @tparam time time precision;
21-
* defaults to pfasst::time_precision
22-
*/
23-
template<typename time = time_precision>
24-
class Controller
25-
{
26-
protected:
27-
//! @{
28-
deque<shared_ptr<ISweeper<time>>> levels;
29-
deque<shared_ptr<ITransfer<time>>> transfer;
30-
//! @}
31-
32-
//! @{
33-
size_t step, iteration, max_iterations;
34-
time t, dt, tend;
35-
//! @}
36-
37-
public:
38-
Controller();
39-
virtual ~Controller();
40-
41-
//! @{
42-
virtual void set_options(bool all_sweepers = true);
43-
virtual void setup();
44-
virtual void set_duration(time t0, time tend, time dt, size_t niters);
45-
virtual void add_level(shared_ptr<ISweeper<time>> swpr,
46-
shared_ptr<ITransfer<time>> trnsfr = shared_ptr<ITransfer<time>>(nullptr),
47-
bool coarse = true);
48-
//! @}
49-
50-
//! @{
51-
virtual size_t nlevels();
52-
53-
template<typename R = ISweeper<time>>
54-
shared_ptr<R> get_level(size_t level)
55-
{
56-
shared_ptr<R> r = dynamic_pointer_cast<R>(levels[level]);
57-
assert(r);
58-
return r;
59-
}
60-
61-
template<typename R = ISweeper<time>>
62-
shared_ptr<R> get_finest()
63-
{
64-
return get_level<R>(nlevels() - 1);
65-
}
66-
67-
template<typename R = ISweeper<time>>
68-
shared_ptr<R> get_coarsest()
69-
{
70-
return get_level<R>(0);
71-
}
72-
73-
template<typename R = ITransfer<time>>
74-
shared_ptr<R> get_transfer(size_t level)
75-
{
76-
shared_ptr<R> r = dynamic_pointer_cast<R>(transfer[level]);
77-
assert(r);
78-
return r;
79-
}
80-
//! @}
81-
82-
//! @{
83-
/**
84-
* Get current time step number.
85-
*/
86-
virtual size_t get_step();
87-
virtual void set_step(size_t n);
88-
virtual time get_time_step();
89-
virtual time get_time();
90-
virtual void advance_time(size_t nsteps = 1);
91-
virtual time get_end_time();
92-
virtual size_t get_iteration();
93-
virtual void set_iteration(size_t iter);
94-
virtual void advance_iteration();
95-
virtual size_t get_max_iterations();
96-
//! @}
97-
98-
/**
99-
* level (MLSDC/PFASST) iterator.
100-
*
101-
* This iterator is used to walk through the MLSDC/PFASST hierarchy of sweepers.
102-
* It keeps track of the _current_ level, and has convenience routines to return the
103-
* LevelIter::current(), LevelIter::fine() (i.e. `current+1`), and LevelIter::coarse()
104-
* (`current-1`) sweepers.
105-
*
106-
* Under the hood it satisfies the requirements of std::random_access_iterator_tag, thus
107-
* implementing a `RandomAccessIterator`.
108-
*/
109-
class LevelIter
110-
: iterator<random_access_iterator_tag, shared_ptr<ISweeper<time>>, int,
111-
ISweeper<time>*, ISweeper<time>>
112-
{
113-
protected:
114-
Controller* ts;
115-
116-
public:
117-
//! @{
118-
typedef int difference_type;
119-
typedef shared_ptr<ISweeper<time>> value_type;
120-
typedef ISweeper<time>* pointer;
121-
typedef ISweeper<time> reference;
122-
typedef random_access_iterator_tag iterator_category;
123-
//! @}
124-
125-
//! @{
126-
int level;
127-
//! @}
128-
129-
//! @{
130-
LevelIter(int level, Controller* ts);
131-
//! @}
132-
133-
//! @{
134-
template<typename R = ISweeper<time>>
135-
shared_ptr<R> current()
136-
{
137-
return ts->template get_level<R>(level);
138-
}
139-
140-
template<typename R = ISweeper<time>>
141-
shared_ptr<R> fine()
142-
{
143-
return ts->template get_level<R>(level + 1);
144-
}
145-
146-
template<typename R = ISweeper<time>>
147-
shared_ptr<R> coarse()
148-
{
149-
return ts->template get_level<R>(level - 1);
150-
}
151-
152-
template<typename R = ITransfer<time>>
153-
shared_ptr<R> transfer()
154-
{
155-
return ts->template get_transfer<R>(level);
156-
}
157-
//! @}
158-
159-
//! @{
160-
// required by std::iterator
161-
template<typename R = reference>
162-
shared_ptr<R> operator*()
163-
{
164-
return current<R>();
165-
}
166-
167-
// required by std::input_iterator_tag
168-
template<typename R = reference>
169-
shared_ptr<R> operator->()
170-
{
171-
return current<R>();
172-
}
173-
174-
virtual LevelIter operator++();
175-
virtual bool operator==(LevelIter i);
176-
virtual bool operator!=(LevelIter i);
177-
// required by std::bidirectional_iterator_tag
178-
virtual LevelIter operator--();
179-
// required by std::random_access_iterator_tag
180-
virtual LevelIter operator- (difference_type i);
181-
virtual LevelIter operator+ (difference_type i);
182-
virtual bool operator<=(LevelIter i);
183-
virtual bool operator>=(LevelIter i);
184-
virtual bool operator< (LevelIter i);
185-
virtual bool operator> (LevelIter i);
186-
//! @}
187-
};
188-
189-
//! @{
190-
virtual LevelIter finest();
191-
virtual LevelIter coarsest();
192-
//! @}
193-
};
194-
195-
} // ::pfasst
196-
197-
#include "controller_impl.hpp"
198-
199-
#endif
6+
#endif // _PFASST__CONTROLLER_HPP

0 commit comments

Comments
 (0)