Skip to content

Commit d9257db

Browse files
author
Daniel Ruprecht
committed
improved docu for scalar example; added ** at several points
1 parent a997b3e commit d9257db

File tree

2 files changed

+29
-40
lines changed

2 files changed

+29
-40
lines changed

examples/scalar/scalar_sdc.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/**
22
* Scalar test equation example using an encapsulated IMEX sweeper.
33
*
44
* Solves Dahlquist's test equation with single level SDC
@@ -30,6 +30,7 @@ double run_scalar_sdc(const size_t nsteps, const double dt, const size_t nnodes,
3030
const complex<double> y0 = complex<double>(1.0, 0.0);
3131

3232
auto nodes = pfasst::compute_nodes(nnodes, nodetype);
33+
3334
/*
3435
* This is a scalar example, so we use the encap::VectorFactory with fixed
3536
* length of 1 and complex type.
@@ -41,9 +42,8 @@ double run_scalar_sdc(const size_t nsteps, const double dt, const size_t nnodes,
4142
sweeper->set_factory(factory);
4243

4344
sdc.add_level(sweeper);
44-
/*
45-
* Final time Tend = dt*nsteps
46-
*/
45+
46+
// Final time Tend = dt*nsteps
4747
sdc.set_duration(0.0, dt*nsteps, dt, niters);
4848
sdc.setup();
4949

@@ -56,7 +56,7 @@ double run_scalar_sdc(const size_t nsteps, const double dt, const size_t nnodes,
5656
}
5757

5858
#ifndef PFASST_UNIT_TESTING
59-
/*
59+
/**
6060
* Main routine running the scalar example with a preset parameters
6161
*/
6262
int main(int /*argc*/, char** /*argv*/)

examples/scalar/scalar_sweeper.hpp

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
/*
2-
* Sweeper for scalar test equation
3-
*
4-
* u' = lambda*u, u(0) = u0
5-
*
6-
* with complex lambda using an IMEX scheme. Derived from the generic imex_sweeper
7-
*
8-
*/
9-
101
#ifndef _EXAMPLES__SCALAR__SCALAR_SWEEPER_HPP_
112
#define _EXAMPLES__SCALAR__SCALAR_SWEEPER_HPP_
123

@@ -20,7 +11,13 @@ using namespace std;
2011

2112
template<typename time = pfasst::time_precision>
2213

23-
/*
14+
/**
15+
* Sweeper for scalar test equation
16+
*
17+
* u' = lambda*u, u(0) = u0
18+
*
19+
* with complex lambda using an IMEX scheme. Derived from the generic imex_sweeper
20+
*
2421
* ScalarSweeper is derived from the generic IMEXSweeper
2522
*/
2623
class ScalarSweeper
@@ -30,35 +27,27 @@ class ScalarSweeper
3027
private:
3128
typedef pfasst::encap::Encapsulation<time> encap_type;
3229

33-
/*
34-
* Define a type for a complex PFASST vector encapsulation.
35-
*/
30+
//! Define a type for a complex PFASST vector encapsulation.
3631
typedef pfasst::encap::VectorEncapsulation<complex<double>> complex_vector_type;
3732

38-
/*
39-
* Parameter lambda and initial value u0
40-
*/
33+
//! Parameter lambda and initial value u0
4134
complex<double> lambda, u0;
4235

43-
/*
44-
* The complex unit i = sqrt(-1)
45-
*/
36+
//! The complex unit i = sqrt(-1)
4637
const complex<double> i_complex = complex<double>(0, 1);
4738

48-
/*
49-
* Error at the final time. For the scalar example, an analytical solution is known.
50-
*/
39+
//! Error at the final time. For the scalar example, an analytical solution is known.
5140
double error;
5241

53-
/*
54-
* Counters for how often f_expl_eval, f_impl_eval and impl_solve are called.
55-
*/
42+
//! Counters for how often f_expl_eval, f_impl_eval and impl_solve are called.
5643
size_t n_f_expl_eval, n_f_impl_eval, n_impl_solve;
5744

5845
public:
5946

60-
/*
47+
/**
6148
* Generic constructor; initialize all function call counters with zero.
49+
* lambda = coefficient in test equation
50+
* u0 = initial value at t=0
6251
*/
6352
ScalarSweeper(complex<double> lambda, complex<double> u0)
6453
: lambda(lambda)
@@ -69,7 +58,7 @@ class ScalarSweeper
6958
, error(0.0)
7059
{}
7160

72-
/*
61+
/**
7362
* Upon destruction, report final error and number of function calls
7463
*/
7564
virtual ~ScalarSweeper()
@@ -80,7 +69,7 @@ class ScalarSweeper
8069
cout << "Number of implicit solves: " << this->n_impl_solve << endl;
8170
}
8271

83-
/*
72+
/**
8473
* Compute error and print it to cout
8574
*/
8675
void echo_error(time t)
@@ -95,15 +84,15 @@ class ScalarSweeper
9584
this->error = max_err;
9685
}
9786

98-
/*
87+
/**
9988
* Returns error, but does not update it!
10089
*/
10190
double get_errors()
10291
{
10392
return this->error;
10493
}
10594

106-
/*
95+
/**
10796
* Prediction step and update of error. Uses predictor as provided by IMEXSweeper.
10897
*/
10998
void predict(bool initial) override
@@ -114,7 +103,7 @@ class ScalarSweeper
114103
this->echo_error(t + dt);
115104
}
116105

117-
/*
106+
/**
118107
* Perform a sweep and update error. Uses sweep as provided by IMEXSweeper.
119108
*/
120109
void sweep() override
@@ -125,7 +114,7 @@ class ScalarSweeper
125114
this->echo_error(t + dt);
126115
}
127116

128-
/*
117+
/**
129118
* Computes the exact solution u0*exp(lambda*t) at a given time t.
130119
*/
131120
void exact(complex_vector_type& q, time t)
@@ -139,7 +128,7 @@ class ScalarSweeper
139128
this->exact(q, t);
140129
}
141130

142-
/*
131+
/**
143132
* Evaluate the explicit part of the right hand side: Multiply with imag(lambda)
144133
*/
145134
void f_expl_eval(shared_ptr<encap_type> f_encap,
@@ -155,7 +144,7 @@ class ScalarSweeper
155144
this->n_f_expl_eval++;
156145
}
157146

158-
/*
147+
/**
159148
* Evaluate the implicit part of the right hand side: Multiply with real(lambda)
160149
*/
161150
void f_impl_eval(shared_ptr<encap_type> f_encap,
@@ -171,7 +160,7 @@ class ScalarSweeper
171160
this->n_f_impl_eval++;
172161
}
173162

174-
/*
163+
/**
175164
* For given b, solve (Id - dt*real(lambda))*u = b for u
176165
*/
177166
void impl_solve(shared_ptr<encap_type> f_encap,

0 commit comments

Comments
 (0)