Skip to content

Commit dcfe21f

Browse files
committed
docu: examples: improve examples
1 parent 55a804d commit dcfe21f

30 files changed

+431
-182
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Doxygen generated documentation can be found [on the PinT server][documentation]
3333
Currently, it features the following content:
3434

3535
* \subpage #page_building_installing
36-
* \subpage #page_examples
36+
* \ref Examples
3737
* \subpage #page_contributing
3838
* \subpage #page_style_guide
3939
* \subpage #page_troubleshooting

doc/source/examples.md

Lines changed: 0 additions & 25 deletions
This file was deleted.

doc/source/installing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ latest release from [GitHub][github_releases].
138138
## Building with vanilla make
139139

140140
A sample `Makefile` is included in the `advection_diffusion` example. This may be of particular
141-
interested to advanced users wishing to incorporate \rm PFASST++ into their existing code bases.
141+
interested to advanced users wishing to incorporate \em PFASST++ into their existing code bases.
142142

143143

144144
[Boost]: https://boost.org/

doc/source/style_guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ using double quotes.
6161

6262
### Define Guards
6363

64-
Use `#define` guards in header files to prevent multiple inclusion.
64+
Use `#%define` guards in header files to prevent multiple inclusion.
6565
The variable defined should be derived from the header file name
6666
itself. For example, a header file `my_header.hpp` in the folder
6767
`PFASST/include/subfolder` should have the following define guard:

examples/advection_diffusion/README.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

examples/advection_diffusion/advection_diffusion_sweeper.hpp

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
/*
2-
* Advection/diffusion sweeper.
1+
/**
2+
* @defgroup AdvectionDiffusionFiles Files
3+
* @ingroup AdvectionDiffusion
4+
*
5+
* @file examples/advection_diffusion/advection_diffusion_sweeper.hpp
6+
* @since v0.1.0
37
*/
4-
5-
#ifndef _ADVECTION_DIFFUSION_SWEEPER_HPP_
6-
#define _ADVECTION_DIFFUSION_SWEEPER_HPP_
8+
#ifndef _EXAMPLES__ADVEC_DIFF__ADVECTION_DIFFUSION_SWEEPER_HPP_
9+
#define _EXAMPLES__ADVEC_DIFF__ADVECTION_DIFFUSION_SWEEPER_HPP_
710

811
#include <cassert>
912
#include <complex>
@@ -32,17 +35,45 @@ namespace pfasst
3235
{
3336
namespace examples
3437
{
38+
/**
39+
* Advection-Diffusion example
40+
*
41+
* @defgroup AdvectionDiffusion Advection Diffusion
42+
* @ingroup Examples
43+
*
44+
* This directory contains several implementations of an advection/diffusion solver using the
45+
* PFASST framework.
46+
*
47+
* All of the solvers use the SDC sweeper defined in `advection_diffusion_sweeper.hpp`, and the FFT
48+
* routines in `fft.hpp`.
49+
*
50+
* The implementations are, in order of complexity:
51+
*
52+
* - `vanilla_sdc.cpp` - basic example that uses an encapsulated IMEX sweeper.
53+
*
54+
* - `serial_mlsdc.cpp` - basic multi-level version that uses polynomial interpolation in time and
55+
* spectral interpolation in space, as defined in `specrtal_transfer_1d.hpp`.
56+
*
57+
* - `serial_mlsdc_autobuild.cpp` - same as above, but uses the "auto build" feature to shorten
58+
* `main`.
59+
*/
3560
namespace advection_diffusion
3661
{
3762
/**
38-
* Containers for errors/residuals etc.
63+
* @name Containers for errors/residuals etc.
64+
* @{
3965
*/
4066
typedef map<tuple<size_t, size_t>, double> error_map; // step, iteration -> error
4167
typedef map<size_t, error_map> residual_map; // level, (step, iteration) -> residual
68+
//! @}
4269

4370
typedef error_map::value_type vtype;
4471
typedef error_map::key_type ktype;
4572

73+
/**
74+
* advection-diffusion sweeper with semi-implicit time-integration.
75+
* @ingroup AdvectionDiffusion
76+
*/
4677
template<typename time = pfasst::time_precision>
4778
class AdvectionDiffusionSweeper
4879
: public encap::IMEXSweeper<time>
@@ -271,4 +302,4 @@ namespace pfasst
271302
} // ::pfasst::examples
272303
} // ::pfasst
273304

274-
#endif
305+
#endif // _EXAMPLES__ADVEC_DIFF__ADVECTION_DIFFUSION_SWEEPER_HPP_

examples/advection_diffusion/fft.hpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
/*
2-
* FFT helper class.
3-
*
4-
* Please note: side affects galore! This is not my best work...
1+
/**
2+
* @ingroup AdvectionDiffusionFiles
3+
* @file examples/advection_diffusion/fft.hpp
4+
* @since v0.1.0
55
*/
6-
7-
#ifndef _FFT_HPP_
8-
#define _FFT_HPP_
6+
#ifndef _EXAMPLES__ADVEC_DIFF__FFT_HPP_
7+
#define _EXAMPLES__ADVEC_DIFF__FFT_HPP_
98

109
#include <map>
1110
#include <memory>
@@ -23,6 +22,13 @@ namespace pfasst
2322
{
2423
namespace advection_diffusion
2524
{
25+
/**
26+
* FFT helper class.
27+
*
28+
* @warning Side affects galore! This is not my best work ...
29+
*
30+
* @ingroup AdvectionDiffusion
31+
*/
2632
class FFT
2733
{
2834
struct workspace {
@@ -83,4 +89,4 @@ namespace pfasst
8389
} // ::pfasst::examples
8490
} // ::pfasst
8591

86-
#endif
92+
#endif // _EXAMPLES__ADVEC_DIFF__FFT_HPP_

examples/advection_diffusion/mpi_pfasst.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
/*
2-
* Advection/diffusion example using an encapsulated IMEX sweeper.
1+
/**
2+
* Advection-Diffusion with MPI-enabled PFASST.
33
*
4-
* This example uses MPI PFASST.
4+
* @ingroup AdvectionDiffusionFiles
5+
* @file examples/advection_diffusion/mpi_pfasst.cpp
6+
* @since v0.2.0
57
*/
68

79
#include <cassert>
@@ -31,6 +33,13 @@ namespace pfasst
3133
{
3234
namespace advection_diffusion
3335
{
36+
/**
37+
* Advection/diffusion example using an encapsulated IMEX sweeper.
38+
*
39+
* This example uses MPI PFASST.
40+
*
41+
* @ingroup AdvectionDiffusion
42+
*/
3443
error_map run_mpi_pfasst(double abs_residual_tol, size_t niters=4)
3544
{
3645
const size_t nsteps = 4;

examples/advection_diffusion/serial_mlsdc.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
/*
2-
* Advection/diffusion example using an encapsulated IMEX sweeper.
1+
/**
2+
* Advection-Diffusion with serial MLSDC.
33
*
4-
* This example uses a (serial) multi-level SDC sweeper.
4+
* @ingroup AdvectionDiffusionFiles
5+
* @file examples/advection_diffusion/serial_mlsdc.cpp
6+
* @since v0.1.0
57
*/
6-
78
#include <memory>
89
using namespace std;
910

@@ -26,6 +27,13 @@ namespace pfasst
2627
{
2728
namespace advection_diffusion
2829
{
30+
/**
31+
* Advection/diffusion example using an encapsulated IMEX sweeper.
32+
*
33+
* This example uses a (serial) multi-level SDC sweeper.
34+
*
35+
* @ingroup AdvectionDiffusion
36+
*/
2937
tuple<error_map, residual_map> run_serial_mlsdc(size_t nlevs)
3038
{
3139
MLSDC<> mlsdc;

examples/advection_diffusion/serial_mlsdc_autobuild.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
/*
2-
* Advection/diffusion example using an encapsulated IMEX sweeper.
1+
/**
2+
* Advection-Diffusion MLSDC with _auto builder_.
33
*
4-
* This example uses a (serial) multi-level SDC sweeper. It is
5-
* functionally exactly the same as ex2.cpp, but uses the 'auto
6-
* builder' to shorten the build and setup stages of the MLSDC
7-
* controller.
4+
* @ingroup AdvectionDiffusionFiles
5+
* @file examples/advection_diffusion/serial_mlsdc_autobuild.cpp
6+
* @since v0.1.0
87
*/
9-
108
#include <cassert>
119
#include <cstdlib>
1210
#include <memory>
@@ -37,6 +35,15 @@ namespace pfasst
3735
{
3836
namespace advection_diffusion
3937
{
38+
/**
39+
* Advection/diffusion example using an encapsulated IMEX sweeper.
40+
*
41+
* This example uses a (serial) multi-level SDC sweeper.
42+
* It is functionally exactly the same as serial_mlsdc.cpp, but uses the _auto builder_ to
43+
* shorten the build and setup stages of the MLSDC controller.
44+
*
45+
* @ingroup AdvectionDiffusion
46+
*/
4047
tuple<error_map, residual_map> run_serial_mlsdc_autobuild()
4148
{
4249
MLSDC<> mlsdc;

0 commit comments

Comments
 (0)