Commit 6b88bd07 authored by Lukas Riedel's avatar Lukas Riedel

Update usage of timers, and docstrings in AdaptivityHandler

parent b388821e
......@@ -112,14 +112,16 @@ public:
}
}
/// Adapt the grid according to the estimated flux error and the strategy applied
/**
* \param grid Grid to adapt
* \param gv Leaf grid view of the grid
/// Mark grid cells for adaptation.
/** Marking is based on the estimated flux error and the strategy applied.
* \param grid Grid to mark (and later adapt)
* \param gv Current grid view
* \param gfs Solution GridFunctionSpace
* \param param Parameter handler
* \param param Parameter interface
* \param boundary Boundary condition interface
* \param time The time for which boundary conditions are queried inside
* the error estimator operator.
* \param u Solution vector
* \return Boolean if grid operators have to be set up again (true if grid changed)
*/
void mark_grid (
Grid& grid,
......@@ -130,22 +132,17 @@ public:
const RF time,
U& u) override
{
Dune::Timer timer2;
double maxeta(0.0);
int multiRefinementCounter = 0;
Dune::Timer timer_total;
Dune::Timer timer_seq;
float t_setup, t_sqrt, t_est, t_strtgy, t_mark;
if(verbose>1){
std::cout << "GRID ADAPTION [" << strategy << "]:" << std::endl;
}
Dune::Timer timer3;
float t_setup, t_sqrt, t_est, t_strtgy, t_mark;
if(verbose>1)
std::cout << " Refinement Step " << multiRefinementCounter << ": ";
double eta_alpha(0.0);
double eta_beta(0.0);
double maxeta(0.0);
// set up helper GFS
AGFS p0gfs = AGFSHelper::create(gv);
......@@ -155,14 +152,14 @@ public:
ESTGO estgo(gfs,p0gfs,estlop,mbe);
U0 eta(p0gfs,0.0);
t_setup = timer3.elapsed();
timer3.reset();
t_setup = timer_seq.elapsed();
timer_seq.reset();
// Compute error estimate eta
estgo.residual(u,eta);
t_est = timer3.elapsed();
timer3.reset();
t_est = timer_seq.elapsed();
timer_seq.reset();
// unsquare errors
using Dune::PDELab::Backend::native;
......@@ -176,8 +173,8 @@ public:
if (verbose>1)
std::cout << "Largest Local Error: " << maxeta << " " << std::endl;
t_sqrt = timer3.elapsed();
timer3.reset();
t_sqrt = timer_seq.elapsed();
timer_seq.reset();
// Apply marking strategy
if (strategy == "elementFraction")
......@@ -188,8 +185,8 @@ public:
eta_alpha = alpha;
eta_beta = beta; }
t_strtgy = timer3.elapsed();
timer3.reset();
t_strtgy = timer_seq.elapsed();
timer_seq.reset();
// Skip refinement if threshold is met, but still allow coarsening
if (maxeta < adaptivityThreshold) {
......@@ -200,8 +197,8 @@ public:
Dune::PDELab::mark_grid(grid, eta, eta_alpha, eta_beta, minLevel, maxLevel, verbose-1);
t_mark = timer3.elapsed();
timer3.reset();
t_mark = timer_seq.elapsed();
timer_seq.reset();
if(this->verbose>3){
ios_base_all_saver restore(std::cout);
......@@ -213,9 +210,18 @@ public:
std::cout << "::: grid marking time" << std::setw(12) << t_mark << std::endl;
}
total_time += timer2.elapsed();
total_time += timer_total.elapsed();
}
/// Adapt the grid, and update grid function space and solution.
/** This assumes that the grid has been marked for refinement. Otherwise,
* calling this function has no effect.
* After adapting the grid, the grid function space is updated and the
* solution vector is interpolated onto the new grid.
* \param grid The (marked) grid to adapt
* \param gfs The solution grid function space
* \param u The solution vector to be interpolated
*/
void adapt_grid (
Grid& grid,
GFS& gfs,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment