19 #include <boost/log/core.hpp> 20 #include <boost/log/utility/setup/common_attributes.hpp> 21 #include <boost/log/utility/setup/console.hpp> 22 #include <boost/log/utility/setup/file.hpp> 23 #include <boost/timer/timer.hpp> 24 #include <boost/date_time/posix_time/posix_time_types.hpp> 26 namespace logging = boost::log;
27 namespace sinks = boost::log::sinks;
28 namespace keywords = boost::log::keywords;
30 typedef sinks::synchronous_sink< sinks::text_file_backend >
sink_t;
31 typedef sinks::synchronous_sink< sinks::text_ostream_backend >
sink_os_t;
38 logging::core::get()->set_filter
40 logging::trivial::severity >= logging::trivial::trace
44 boost::log::add_common_attributes();
45 boost::log::register_simple_formatter_factory< boost::log::trivial::severity_level, char >(
"Severity");
48 boost::shared_ptr< sink_os_t > g_file_sink = logging::add_console_log(
std::cout);
49 g_file_sink->set_filter(logging::trivial::severity >= logging::trivial::info);
56 g_file_sink(logging::add_file_log(
57 keywords::file_name = filename,
58 keywords::time_based_rotation = sinks::file::rotation_at_time_interval(boost::posix_time::hours(1)),
59 keywords::format =
"[%TimeStamp%] <%Severity%>: %Message%" 62 g_file_sink->set_filter(logging::trivial::severity >= logging::trivial::debug);
67 logging::core::get()->remove_sink(g_file_sink);
81 void stop(
bool print =
true){
82 if (!_t.is_stopped()){
84 if (print) BOOST_LOG_TRIVIAL(info) <<
"Time elapsed:" << _t.format();
88 boost::timer::cpu_timer
_t;
99 APP.update_cosmo(sim.
cosmo);
102 Logger l(APP.get_out_dir() +
"log/log" +
"_%N.log");
105 APP.run_simulation();
137 if(sim.
comp_app.
ZA) init_and_run_app<App_Var_ZA>(sim);
140 if(sim.
comp_app.
TZA) init_and_run_app<App_Var_TZA>(sim);
143 if(sim.
comp_app.
FF) init_and_run_app<App_Var_FF>(sim);
146 if(sim.
comp_app.
FP) init_and_run_app<App_Var_FP>(sim);
149 if(sim.
comp_app.
PM) init_and_run_app<App_Var_PM>(sim);
152 if(sim.
comp_app.
AA) init_and_run_app<App_Var_AA>(sim);
155 if(sim.
comp_app.
FP_pp) init_and_run_app<App_Var_FP_mod>(sim);
158 if(sim.
comp_app.
chi) init_and_run_app<App_Var_Chi>(sim);
164 BOOST_LOG_TRIVIAL(info) <<
"All simulations completed.";
sinks::synchronous_sink< sinks::text_ostream_backend > sink_os_t
sinks::synchronous_sink< sinks::text_file_backend > sink_t
: class storing simulation parameters
modified frozen-potential approximation interface
ahesion approximation interface
boost::shared_ptr< sink_t > g_file_sink
Frozen-potential approximation interface.
system include files and for project-specific include files that are used frequently but are changed ...
void stop(bool print=true)
frozen-flow approximation interface
various simulation parameters
void init_and_run_app(Sim_Param &sim)
Logger(const std::string &filename)
Zel`dovich approximation interface.
void print_info(std::string out, std::string app) const
int main(int argc, char *argv[])
< end of anonymous namespace
boost::timer::cpu_timer _t
chameleon model of gravity interface