HArD::Core2D
Hybrid Arbitrary Degree::Core 2D - Library to implement 2D schemes with edge and cell polynomials as unknowns
display_timer.hpp
Go to the documentation of this file.
1 // Function to store and display wall/proc times obtained by boost::timer::cpu_timer
2 
3 /*
4  *
5  * This library was developed around HHO methods, although some parts of it have a more
6  * general purpose. If you use this code or part of it in a scientific publication,
7  * please mention the following book as a reference for the underlying principles
8  * of HHO schemes:
9  *
10  * The Hybrid High-Order Method for Polytopal Meshes: Design, Analysis, and Applications.
11  * D. A. Di Pietro and J. Droniou. Modeling, Simulation and Applications, vol. 19.
12  * Springer International Publishing, 2020, xxxi + 525p. doi: 10.1007/978-3-030-37203-3.
13  * url: https://hal.archives-ouvertes.fr/hal-02151813.
14  *
15  */
16 
17 #ifndef DISPLAY_TIMER_HPP
18 #define DISPLAY_TIMER_HPP
19 
20 #include <boost/timer/timer.hpp>
21 
22 namespace HArDCore2D
23 {
24 
31 
32  inline std::pair<double,double> store_times(
33  boost::timer::cpu_timer & timer,
34  std::string message = ""
35  )
36  {
37  double twall = double(timer.elapsed().wall) * pow(10, -9);
38  double tproc = double(timer.elapsed().user + timer.elapsed().system) * pow(10, -9);
39 
40  if (message != ""){
41  std::cout << message << twall << "/" << tproc << std::endl;
42  }
43 
44  return std::make_pair(twall, tproc);
45  };
46 
48 
49 } // end of namespace HArDCore2D
50 
51 #endif
std::pair< double, double > store_times(boost::timer::cpu_timer &timer, std::string message="")
Function to store and display wall/proc timers from boost::timer::cpu_timer.
Definition: display_timer.hpp:32
Definition: ddr-klplate.hpp:27