Skip to content

Commit 0444e4d

Browse files
committed
log: better logging for MLSDC
1 parent 31ea461 commit 0444e4d

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

examples/advection_diffusion/serial_mlsdc.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ namespace pfasst
2828
{
2929
MLSDC<> mlsdc;
3030

31-
const size_t nsteps = 4;
32-
const double dt = 0.01;
33-
const size_t niters = 8;
31+
const size_t nsteps = config::get_value<size_t>("num_steps", 4);
32+
const double dt = config::get_value<double>("delta_step", 0.01);
33+
const size_t niters = config::get_value<size_t>("num_iter", 8);
3434
const int xrat = 2;
3535
const int trat = 2;
3636

37-
size_t nnodes = 5;
38-
size_t ndofs = 128;
37+
size_t nnodes = config::get_value<size_t>("num_nodes", 5);
38+
size_t ndofs = config::get_value<size_t>("spatial_dofs", 128);
3939

4040
/*
4141
* build space/time discretisation levels and add them to mlsdc
@@ -93,8 +93,12 @@ namespace pfasst
9393
} // ::pfasst
9494

9595
#ifndef PFASST_UNIT_TESTING
96-
int main(int /*argc*/, char** /*argv*/)
96+
int main(int argc, char** argv)
9797
{
98+
pfasst::examples::advection_diffusion::AdvectionDiffusionSweeper<>::enable_config_options();
99+
pfasst::init(argc, argv);
100+
pfasst::log::add_custom_logger("Advec");
101+
98102
pfasst::examples::advection_diffusion::run_serial_mlsdc(3);
99103
}
100104
#endif

include/pfasst/mlsdc.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <vector>
1111

1212
#include "controller.hpp"
13+
#include "logging.hpp"
1314

1415
using namespace std;
1516

@@ -35,6 +36,7 @@ namespace pfasst
3536
void perform_sweeps(size_t level)
3637
{
3738
auto sweeper = this->get_level(level);
39+
CLOG(INFO, "Controller") << "on level " << level + 1 << "/" << this->nlevels();
3840
for (size_t s = 0; s < this->nsweeps[level]; s++) {
3941
if (predict) {
4042
sweeper->predict(initial & predict);
@@ -97,6 +99,7 @@ namespace pfasst
9799
return l;
98100
}
99101

102+
CVLOG(1, "Controller") << "Cycle down onto level " << l.level << "/" << this->nlevels();
100103
trns->restrict(crse, fine, initial);
101104
trns->fas(this->get_time_step(), crse, fine);
102105
crse->save();
@@ -117,6 +120,7 @@ namespace pfasst
117120
auto crse = l.coarse();
118121
auto trns = l.transfer();
119122

123+
CVLOG(1, "Controller") << "Cycle up onto level " << l.level + 1 << "/" << this->nlevels();
120124
trns->interpolate(fine, crse);
121125

122126
if (l < this->finest()) {

0 commit comments

Comments
 (0)