Class: URBANopt::Scenario::ScenarioBase
- Inherits:
-
Object
- Object
- URBANopt::Scenario::ScenarioBase
- Defined in:
- lib/urbanopt/scenario/scenario_base.rb
Overview
ScenarioBase is a simulation method agnostic description of a Scenario.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#feature_file ⇒ Object
readonly
An instance of
URBANopt::Core::FeatureFileassociated with this Scenario. -
#name ⇒ Object
readonly
Name of the Scenario.
-
#root_dir ⇒ Object
readonly
Root directory containing Gemfile.
-
#run_dir ⇒ Object
readonly
Directory to run this Scenario.
Instance Method Summary collapse
-
#clear ⇒ Object
Removes all simulation input and output files by removing this Scenario’s
run_dir. -
#initialize(name, root_dir, run_dir, feature_file) ⇒ ScenarioBase
constructor
Initialize ScenarioBase attributes:
name, root directory , run directory andfeature_file. -
#simulation_dirs ⇒ Object
An array of SimulationDirBase objects.
Constructor Details
#initialize(name, root_dir, run_dir, feature_file) ⇒ ScenarioBase
Initialize ScenarioBase attributes: name , root directory , run directory and feature_file
- parameters:
-
name- String - Human readable scenario name.root_dir- String - Root directory for the scenario, contains Gemfile describing dependencies.run_dir- String - Directory for simulation of this scenario, deleting run directory clears the scenario.feature_file- FeatureFile - An instance ofURBANopt::Core::FeatureFilecontaining features for simulation.
43 44 45 46 47 48 |
# File 'lib/urbanopt/scenario/scenario_base.rb', line 43 def initialize(name, root_dir, run_dir, feature_file) @name = name @root_dir = root_dir @run_dir = run_dir @feature_file = feature_file end |
Instance Attribute Details
#feature_file ⇒ Object (readonly)
An instance of URBANopt::Core::FeatureFile associated with this Scenario.
64 65 66 |
# File 'lib/urbanopt/scenario/scenario_base.rb', line 64 def feature_file @feature_file end |
#name ⇒ Object (readonly)
Name of the Scenario.
52 53 54 |
# File 'lib/urbanopt/scenario/scenario_base.rb', line 52 def name @name end |
#root_dir ⇒ Object (readonly)
Root directory containing Gemfile.
56 57 58 |
# File 'lib/urbanopt/scenario/scenario_base.rb', line 56 def root_dir @root_dir end |
#run_dir ⇒ Object (readonly)
Directory to run this Scenario.
60 61 62 |
# File 'lib/urbanopt/scenario/scenario_base.rb', line 60 def run_dir @run_dir end |
Instance Method Details
#clear ⇒ Object
Removes all simulation input and output files by removing this Scenario’s run_dir .
72 73 74 75 76 |
# File 'lib/urbanopt/scenario/scenario_base.rb', line 72 def clear Dir.glob(File.join(@run_dir, '/*')).each do |f| FileUtils.rm_rf(f) end end |
#simulation_dirs ⇒ Object
An array of SimulationDirBase objects.
67 68 69 |
# File 'lib/urbanopt/scenario/scenario_base.rb', line 67 def simulation_dirs raise 'simulation_dirs not implemented for ScenarioBase, override in your class' end |