From dc71f4202d0e19e1f024c8fe41880c294f9ab73b Mon Sep 17 00:00:00 2001 From: Lisa Julia Nebel <lisa_julia.nebel@tu-dresden.de> Date: Wed, 25 Mar 2020 13:51:07 +0100 Subject: [PATCH] Add timer to print the overall time and the time used for one trustregion step --- dune/elasticity/common/trustregionsolver.cc | 4 ++++ src/finite-strain-elasticity.cc | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/dune/elasticity/common/trustregionsolver.cc b/dune/elasticity/common/trustregionsolver.cc index ff75423..e746757 100644 --- a/dune/elasticity/common/trustregionsolver.cc +++ b/dune/elasticity/common/trustregionsolver.cc @@ -383,6 +383,8 @@ void TrustRegionSolver<BasisType,VectorType>::solve() CorrectionType rhs; MatrixType stiffnessMatrix; + Dune::Timer problemTimer; + for (int i=0; i<maxTrustRegionSteps_; i++) { Dune::Timer totalTimer; @@ -642,5 +644,7 @@ void TrustRegionSolver<BasisType,VectorType>::solve() std::cout << "iteration took " << totalTimer.elapsed() << " sec." << std::endl; } + if (rank==0) + std::cout << "The whole trust-region step took " << problemTimer.elapsed() << " sec." << std::endl; } diff --git a/src/finite-strain-elasticity.cc b/src/finite-strain-elasticity.cc index 8116391..cbc5a51 100644 --- a/src/finite-strain-elasticity.cc +++ b/src/finite-strain-elasticity.cc @@ -223,6 +223,7 @@ int main (int argc, char *argv[]) try vtkWriter.addVertexData(localDisplacementFunction, VTK::FieldInfo("displacement", VTK::FieldInfo::Type::vector, dim)); vtkWriter.write(resultPath + "finite-strain_homotopy_0"); + Dune::Timer homotopyTimer; for (int i=0; i<numHomotopySteps; i++) { double homotopyParameter = (i+1)*(1.0/numHomotopySteps); @@ -354,6 +355,9 @@ int main (int argc, char *argv[]) try vtkWriter.write(resultPath + "finite-strain_homotopy_" + std::to_string(i+1)); } + if (mpiHelper.rank()==0) + std::cout << "Complete duration: " << homotopyTimer.elapsed() << " sec." << std::endl; + } catch (Exception& e) { std::cout << e.what() << std::endl; } -- GitLab