Skip to content

Commit 45f3d4f

Browse files
committed
a couple of code formatting tweaks
1 parent 561708e commit 45f3d4f

17 files changed

+171
-121
lines changed

examples/advection_diffusion/advection_diffusion_sweeper.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ class AdvectionDiffusionSweeper
220220
}
221221
}
222222
//! @}
223-
224223
};
225224

226225
#endif

examples/advection_diffusion/fft.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ class FFT
7272
x[i] = real(wk->z[i]);
7373
}
7474
}
75-
7675
};
7776

7877
#endif

examples/advection_diffusion/spectral_transfer_1d.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class SpectralTransfer1D
2626
FFT fft;
2727

2828
public:
29-
3029
void interpolate(shared_ptr<Encapsulation> dst, shared_ptr<const Encapsulation> src) override
3130
{
3231
auto& fine = pfasst::encap::as_vector<double, time>(dst);
@@ -63,7 +62,6 @@ class SpectralTransfer1D
6362
crse[i] = fine[xrat*i];
6463
}
6564
}
66-
6765
};
6866

6967
#endif

include/pfasst/controller.hpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,17 @@ namespace pfasst
119119
Controller* ts;
120120

121121
public:
122+
//! @{
122123
typedef int difference_type;
123124
typedef shared_ptr<ISweeper<time>> value_type;
124125
typedef ISweeper<time>* pointer;
125126
typedef ISweeper<time> reference;
126127
typedef random_access_iterator_tag iterator_category;
128+
//! @}
127129

130+
//! @{
128131
int level;
132+
//! @}
129133

130134
//! @{
131135
LevelIter(int level, Controller* ts)
@@ -183,7 +187,7 @@ namespace pfasst
183187
LevelIter coarsest() { return LevelIter(0, this); }
184188
//! @}
185189

186-
190+
//! @{
187191
/**
188192
* Get current time step number.
189193
*/
@@ -238,8 +242,9 @@ namespace pfasst
238242
{
239243
return max_iterations;
240244
}
241-
245+
//! @}
242246
};
243-
}
247+
248+
} // ::pfasst
244249

245250
#endif

include/pfasst/encap/automagic.hpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ namespace pfasst
1616
{
1717

1818
template<typename time = time_precision>
19-
using AutoBuildTuple = tuple<shared_ptr<pfasst::encap::EncapSweeper<time>>,
20-
shared_ptr<pfasst::ITransfer<time>>,
21-
shared_ptr<pfasst::encap::EncapFactory<time>>>;
19+
using AutoBuildTuple = tuple<
20+
shared_ptr<pfasst::encap::EncapSweeper<time>>,
21+
shared_ptr<pfasst::ITransfer<time>>,
22+
shared_ptr<pfasst::encap::EncapFactory<time>>
23+
>;
2224

2325
template<typename ControllerT, typename BuildT, typename time = time_precision>
2426
void auto_build(ControllerT& c, vector<pair<size_t, string>> nodes, BuildT build)
@@ -48,7 +50,7 @@ namespace pfasst
4850
}
4951
}
5052

51-
}
52-
}
53+
} // ::pfasst::encap
54+
} // ::pfasst
5355

5456
#endif

include/pfasst/encap/encap_sweeper.hpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ namespace pfasst
2323
class EncapSweeper
2424
: public ISweeper<time>
2525
{
26+
//! @{
2627
vector<time> nodes;
2728
shared_ptr<EncapFactory<time>> factory;
29+
//! @}
2830

2931
public:
3032
//! @{
@@ -33,29 +35,29 @@ namespace pfasst
3335
//! @}
3436

3537
//! @{
36-
virtual void spread()
38+
virtual void spread() override
3739
{
3840
for (size_t m = 1; m < nodes.size(); m++) {
3941
this->get_state(m)->copy(this->get_state(0));
4042
}
4143
}
4244

43-
virtual void post(ICommunicator* comm, int tag)
45+
virtual void post(ICommunicator* comm, int tag) override
4446
{
4547
this->get_state(0)->post(comm, tag);
4648
}
4749

48-
virtual void send(ICommunicator* comm, int tag, bool blocking)
50+
virtual void send(ICommunicator* comm, int tag, bool blocking) override
4951
{
5052
this->get_state(this->get_nodes().size() - 1)->send(comm, tag, blocking);
5153
}
5254

53-
virtual void recv(ICommunicator* comm, int tag, bool blocking)
55+
virtual void recv(ICommunicator* comm, int tag, bool blocking) override
5456
{
5557
this->get_state(0)->recv(comm, tag, blocking);
5658
}
5759

58-
virtual void broadcast(ICommunicator* comm)
60+
virtual void broadcast(ICommunicator* comm) override
5961
{
6062
if (comm->rank() == comm->size() - 1) {
6163
this->get_state(0)->copy(this->get_state(this->get_nodes().size() - 1));
@@ -200,6 +202,7 @@ namespace pfasst
200202
return *y.get();
201203
}
202204

205+
203206
template<typename time>
204207
const EncapSweeper<time>& as_encap_sweeper(shared_ptr<const ISweeper<time>> x)
205208
{
@@ -208,8 +211,7 @@ namespace pfasst
208211
return *y.get();
209212
}
210213

211-
}
212-
213-
}
214+
} // ::pfasst::encap
215+
} // ::pfasst
214216

215217
#endif

include/pfasst/encap/encapsulation.hpp

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <vector>
99
#include <memory>
1010

11+
#include "../globals.hpp"
1112
#include "../interfaces.hpp"
1213
#include "../quadrature.hpp"
1314

@@ -33,25 +34,32 @@ namespace pfasst
3334
{
3435
public:
3536
//! @{
36-
virtual ~Encapsulation() { }
37+
virtual ~Encapsulation()
38+
{}
3739
//! @}
3840

3941
//! @{
4042
// required for time-parallel communications
41-
virtual void post(ICommunicator* /*comm*/, int /*tag*/) { }
43+
virtual void post(ICommunicator* comm, int tag)
44+
{
45+
UNUSED(comm); UNUSED(tag);
46+
}
4247

43-
virtual void send(ICommunicator* /*comm*/, int /*tag*/, bool /*blocking*/)
48+
virtual void send(ICommunicator* comm, int tag, bool blocking)
4449
{
50+
UNUSED(comm); UNUSED(tag); UNUSED(blocking);
4551
throw NotImplementedYet("pfasst");
4652
}
4753

48-
virtual void recv(ICommunicator* /*comm*/, int /*tag*/, bool /*blocking*/)
54+
virtual void recv(ICommunicator* comm, int tag, bool blocking)
4955
{
56+
UNUSED(comm); UNUSED(tag); UNUSED(blocking);
5057
throw NotImplementedYet("pfasst");
5158
}
5259

53-
virtual void broadcast(ICommunicator* /*comm*/)
60+
virtual void broadcast(ICommunicator* comm)
5461
{
62+
UNUSED(comm);
5563
throw NotImplementedYet("pfasst");
5664
}
5765
//! @}
@@ -76,8 +84,9 @@ namespace pfasst
7684
* Here, \\(a\\) is a time point and \\(x\\) another data structure (usually of the
7785
* same type).
7886
*/
79-
virtual void saxpy(time /*a*/, shared_ptr<const Encapsulation<time>> /*x*/)
87+
virtual void saxpy(time a, shared_ptr<const Encapsulation<time>> x)
8088
{
89+
UNUSED(a); UNUSED(x);
8190
throw NotImplementedYet("encap");
8291
}
8392

@@ -113,7 +122,7 @@ namespace pfasst
113122
virtual shared_ptr<Encapsulation<time>> create(const EncapType) = 0;
114123
};
115124

116-
}
117-
}
125+
} // ::pfasst::encap
126+
} // ::pfasst
118127

119128
#endif

include/pfasst/encap/imex_sweeper.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,10 +365,9 @@ namespace pfasst
365365
throw NotImplementedYet("imex (f2comp)");
366366
}
367367
//! @}
368-
369368
};
370369

371-
}
372-
}
370+
} // ::pfasst::encap
371+
} // ::pfasst
373372

374373
#endif

include/pfasst/encap/mpi_vector.hpp

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,35 @@ namespace pfasst
2222
using namespace pfasst::mpi;
2323

2424
template<typename scalar, typename time = time_precision>
25-
class MPIVectorEncapsulation : public VectorEncapsulation<scalar, time>
25+
class MPIVectorEncapsulation
26+
: public VectorEncapsulation<scalar, time>
2627
{
27-
28+
//! @{
2829
MPI_Request recv_request = MPI_REQUEST_NULL;
2930
MPI_Request send_request = MPI_REQUEST_NULL;
31+
//! @}
3032

33+
//! @{
3134
inline MPICommunicator& as_mpi(ICommunicator* comm)
3235
{
33-
auto mpi = dynamic_cast<MPICommunicator*>(comm); assert(mpi);
36+
auto mpi = dynamic_cast<MPICommunicator*>(comm);
37+
assert(mpi);
3438
return *mpi;
3539
}
40+
//! @}
3641

3742
public:
43+
//! @{
44+
MPIVectorEncapsulation(int size)
45+
: VectorEncapsulation<scalar, time>(size)
46+
{}
3847

39-
MPIVectorEncapsulation(int size) : VectorEncapsulation<scalar, time>(size) { }
48+
virtual ~MPIVectorEncapsulation()
49+
{}
50+
//! @}
4051

41-
void post(ICommunicator* comm, int tag)
52+
//! @{
53+
void post(ICommunicator* comm, int tag) override
4254
{
4355
auto& mpi = as_mpi(comm);
4456
if (mpi.size() == 1) { return; }
@@ -51,7 +63,7 @@ namespace pfasst
5163
}
5264
}
5365

54-
virtual void recv(ICommunicator* comm, int tag, bool blocking)
66+
virtual void recv(ICommunicator* comm, int tag, bool blocking) override
5567
{
5668
auto& mpi = as_mpi(comm);
5769
if (mpi.size() == 1) { return; }
@@ -72,7 +84,7 @@ namespace pfasst
7284
}
7385
}
7486

75-
virtual void send(ICommunicator* comm, int tag, bool blocking)
87+
virtual void send(ICommunicator* comm, int tag, bool blocking) override
7688
{
7789
auto& mpi = as_mpi(comm);
7890
if (mpi.size() == 1) { return; }
@@ -98,20 +110,22 @@ namespace pfasst
98110
}
99111
}
100112

101-
virtual void broadcast(ICommunicator* comm)
113+
virtual void broadcast(ICommunicator* comm) override
102114
{
103115
auto& mpi = as_mpi(comm);
104-
int err = MPI_Bcast(this->data(), sizeof(scalar) * this->size(), MPI_CHAR, comm->size()-1, mpi.comm);
116+
int err = MPI_Bcast(this->data(), sizeof(scalar) * this->size(), MPI_CHAR,
117+
comm->size()-1, mpi.comm);
105118

106119
if (err != MPI_SUCCESS) {
107120
throw MPIError();
108121
}
109122
}
110-
123+
//! @}
111124
};
112125

113126
template<typename scalar, typename time = time_precision>
114-
class MPIVectorFactory : public EncapFactory<time>
127+
class MPIVectorFactory
128+
: public EncapFactory<time>
115129
{
116130
int size;
117131
public:
@@ -123,9 +137,7 @@ namespace pfasst
123137
}
124138
};
125139

126-
127-
128-
}
129-
}
140+
} // ::pfasst::encap
141+
} // ::pfasst
130142

131143
#endif

0 commit comments

Comments
 (0)