diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc index 1242952618edff01d63d8fe7d8225d839a088885..96ff6b4330e9a927737272f169ed05f88bdbe74f 100644 --- a/src/one-body-sample.cc +++ b/src/one-body-sample.cc @@ -19,6 +19,7 @@ #include <dune/common/parametertreeparser.hh> #include <dune/common/shared_ptr.hh> #include <dune/common/stdstreams.hh> +#include <dune/common/timer.hh> #include <dune/grid/common/mcmgmapper.hh> #include <dune/grid/yaspgrid.hh> #include <dune/istl/bcrsmatrix.hh> @@ -177,6 +178,8 @@ int main(int argc, char *argv[]) { parset); // FIXME Dune::ParameterTreeParser::readOptions(argc, argv, parset); + Dune::Timer timer; + typedef Dune::FieldVector<double, dim> SmallVector; typedef Dune::FieldMatrix<double, dim, dim> SmallMatrix; typedef Dune::BCRSMatrix<SmallMatrix> OperatorType; @@ -219,8 +222,11 @@ int main(int argc, char *argv[]) { P1Basis::LocalFiniteElement> const localStiffness(E, nu); OperatorType stiffnessMatrix; + timer.reset(); OperatorAssembler<P1Basis, P1Basis>(p1Basis, p1Basis) .assemble(localStiffness, stiffnessMatrix); + std::cout << "Assembled stiffness matrix in " << timer.elapsed() << "s" + << std::endl; EnergyNorm<OperatorType, VectorType> energyNorm(stiffnessMatrix); // Set up the boundary @@ -304,7 +310,9 @@ int main(int argc, char *argv[]) { multigridStep.ignoreNodes_ = &ignoreNodes; // }}} - for (size_t run = 1; run <= parset.get<size_t>("timesteps"); ++run) { + timer.reset(); + auto const timesteps = parset.get<size_t>("timesteps"); + for (size_t run = 1; run <= timesteps; ++run) { if (parset.get<bool>("printProgress")) { std::cout << "."; std::cout.flush(); @@ -407,6 +415,8 @@ int main(int argc, char *argv[]) { u3 += u3_diff; } std::cout << std::endl; + std::cout << "Making " << timesteps << " time steps took " + << timer.elapsed() << "s" << std::endl; // Clean up after the TNNMG solver for (auto &x : transferOperators)