Stride Reference Manual  - generated for commit 9643b11
stride::ControlHelper Class Reference

Controls a simulation run initiated with the command line interface (cli). More...

#include <ControlHelper.h>

Inheritance diagram for stride::ControlHelper:
Inheritance graph
Collaboration diagram for stride::ControlHelper:
Collaboration graph

Public Member Functions

 ControlHelper (const boost::property_tree::ptree &config, std::string name)
 Straight initialization. More...
 
 ~ControlHelper ()
 Simple destructor. More...
 

Protected Member Functions

 ControlHelper ()
 Empty controller: used as target for delegation. More...
 
void CheckEnv ()
 Check install environment. More...
 
void CheckOutputPrefix ()
 
void InstallLogger ()
 Make the appropriate logger for cli environment and register as stride_logger. More...
 
void LogStartup ()
 Logs info on setup for cli environment to stride_logger. More...
 
void RegisterViewers (std::shared_ptr< SimRunner > runner)
 Register the viewers of the SimRunner. More...
 
void Shutdown ()
 Logs info on setup for cli environment to stride_logger. More...
 

Protected Attributes

boost::property_tree::ptree m_config
 Main configuration for run and sim. More...
 
std::string m_name
 Contoller's name. More...
 
std::string m_output_prefix
 Prefix to output (name prefix or prefix dir) More...
 
util::Stopwatch m_run_clock
 Stopwatch for timing the computation. More...
 
std::shared_ptr< spdlog::logger > m_stride_logger
 General logger. More...
 
bool m_use_install_dirs
 Working dir or install dir mode. More...
 

Detailed Description

Controls a simulation run initiated with the command line interface (cli).

ControlHelper functions effected on behalf of the controllers include:

  • checks the OpenMP environment
  • checks the file system environment
  • interprets and executes the ouput prefix
  • install a stride logger
  • a utility method to register the appropriate viewers

Definition at line 45 of file ControlHelper.h.

Constructor & Destructor Documentation

stride::ControlHelper::ControlHelper ( const boost::property_tree::ptree &  config,
std::string  name 
)
explicit

Straight initialization.

stride::ControlHelper::~ControlHelper ( )

Simple destructor.

Definition at line 50 of file ControlHelper.cpp.

References ControlHelper(), m_config, m_name, m_output_prefix, m_run_clock, m_use_install_dirs, Shutdown(), and stride::util::Stopwatch< T >::Start().

Here is the call graph for this function:

stride::ControlHelper::ControlHelper ( )
explicitprotected

Empty controller: used as target for delegation.

Definition at line 44 of file ControlHelper.cpp.

Referenced by ~ControlHelper().

Here is the caller graph for this function:

Member Function Documentation

void stride::ControlHelper::CheckEnv ( )
protected

Check install environment.

Definition at line 64 of file ControlHelper.cpp.

References stride::util::FileSys::CheckInstallEnv(), and m_use_install_dirs.

Referenced by stride::GenPopController::Control(), stride::SimController::Control(), and stride::StanController::Control().

Here is the call graph for this function:

Here is the caller graph for this function:

void stride::ControlHelper::CheckOutputPrefix ( )
protected

Definition at line 74 of file ControlHelper.cpp.

References stride::util::FileSys::CreateDirectory(), stride::util::FileSys::IsDirectoryString(), and m_output_prefix.

Referenced by stride::GenPopController::Control(), stride::SimController::Control(), and stride::StanController::Control().

Here is the call graph for this function:

Here is the caller graph for this function:

void stride::ControlHelper::InstallLogger ( )
protected

Make the appropriate logger for cli environment and register as stride_logger.

Definition at line 81 of file ControlHelper.cpp.

References stride::util::FileSys::BuildPath(), stride::util::LogUtils::CreateCliLogger(), stride::util::LogUtils::CreateFileLogger(), m_config, m_name, m_output_prefix, and m_stride_logger.

Referenced by stride::GenPopController::Control(), stride::SimController::Control(), and stride::StanController::Control().

Here is the call graph for this function:

Here is the caller graph for this function:

void stride::ControlHelper::RegisterViewers ( std::shared_ptr< SimRunner runner)
protected

Register the viewers of the SimRunner.

Definition at line 139 of file ControlHelper.cpp.

References m_config, m_output_prefix, m_stride_logger, stride::viewers::SummaryFileViewer::Update(), stride::viewers::CliViewer::Update(), stride::viewers::PersonsFileViewer::Update(), and stride::viewers::InfectedFileViewer::Update().

Referenced by stride::SimController::Control().

Here is the call graph for this function:

Here is the caller graph for this function:

void stride::ControlHelper::Shutdown ( )
protected

Logs info on setup for cli environment to stride_logger.

Definition at line 102 of file ControlHelper.cpp.

References m_name, m_run_clock, m_stride_logger, stride::util::Stopwatch< T >::Stop(), and stride::util::Stopwatch< T >::ToString().

Referenced by ~ControlHelper().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

boost::property_tree::ptree stride::ControlHelper::m_config
protected
std::string stride::ControlHelper::m_name
protected

Contoller's name.

Definition at line 79 of file ControlHelper.h.

Referenced by InstallLogger(), LogStartup(), Shutdown(), and ~ControlHelper().

std::string stride::ControlHelper::m_output_prefix
protected

Prefix to output (name prefix or prefix dir)

Definition at line 80 of file ControlHelper.h.

Referenced by CheckOutputPrefix(), InstallLogger(), LogStartup(), RegisterViewers(), and ~ControlHelper().

util::Stopwatch stride::ControlHelper::m_run_clock
protected

Stopwatch for timing the computation.

Definition at line 81 of file ControlHelper.h.

Referenced by Shutdown(), and ~ControlHelper().

std::shared_ptr<spdlog::logger> stride::ControlHelper::m_stride_logger
protected
bool stride::ControlHelper::m_use_install_dirs
protected

Working dir or install dir mode.

Definition at line 83 of file ControlHelper.h.

Referenced by CheckEnv(), LogStartup(), and ~ControlHelper().


The documentation for this class was generated from the following files: