Modular Megafauna Model 1.1.5
A physiological, dynamic herbivore simulator in C++.
Loading...
Searching...
No Matches
demo_simulator.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2020 W. Traylor <wolfgang.traylor@senckenberg.de>
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
11#ifndef FAUNA_DEMO_SIMULATOR_H
12#define FAUNA_DEMO_SIMULATOR_H
13
14#include <vector>
15#include "simple_habitat.h"
16
17namespace Fauna {
18namespace Demo {
19
21struct missing_parameter : public std::runtime_error {
23
26 missing_parameter(const std::string& key)
27 : runtime_error("Missing mandatory parameter: \"" + key + '"'){};
28};
29
31
35class Framework {
36 public:
39
41
43 static Framework instance;
44 return instance;
45 }
46
48 void print_help();
49
51 void print_usage();
52
54
60 bool run(const std::string insfile_fauna, const std::string insfile_demo);
61
62 private:
64 void read_instruction_file(const std::string filename);
65
67
68 struct {
69 std::string outputdirectory = "./";
70 int nyears = 100;
72 int ngroups = 3;
75
77 std::vector<std::string> mandatory_parameters;
78
80 static const int COORDINATES_PRECISION;
81
83 Framework(Framework const&); // don’t implement, it’s deleted
85 void operator=(Framework const&); // don’t implement, it’s deleted
86};
87} // namespace Demo
88} // namespace Fauna
89
90#endif // FAUNA_DEMO_SIMULATOR_H
Performs demo simulations for the Modular Megafauna Model.
Definition: demo_simulator.h:35
SimpleHabitat::Parameters habitat
Definition: demo_simulator.h:73
Framework(Framework const &)
Deleted copy constructor.
Framework()
Constructor.
Definition: demo_simulator.h:38
static Framework & get_instance()
Get singleton instance of the class.
Definition: demo_simulator.h:42
void print_usage()
Print the short usage text to STDERR.
Definition: demo_simulator.cpp:76
std::vector< std::string > mandatory_parameters
List of mandatory instruction file parameters.
Definition: demo_simulator.h:77
std::string outputdirectory
Definition: demo_simulator.h:69
bool run(const std::string insfile_fauna, const std::string insfile_demo)
Run a simulation.
Definition: demo_simulator.cpp:206
int ngroups
Definition: demo_simulator.h:72
int nhabitats_per_group
Definition: demo_simulator.h:71
int nyears
Definition: demo_simulator.h:70
void operator=(Framework const &)
Deleted assignment constructor.
void read_instruction_file(const std::string filename)
Set params from given TOML instruction file for the demo simulator.
Definition: demo_simulator.cpp:81
static const int COORDINATES_PRECISION
Number of decimal places in output tables.
Definition: demo_simulator.h:80
struct Fauna::Demo::Framework::@0 params
Parameter values from instruction file.
void print_help()
Print the help text to STDOUT.
Definition: demo_simulator.cpp:71
Definition: average.h:16
Minimal habitat implementation for demonstration purpose.
Simulation parameters for a SimpleHabitat object.
Definition: simple_habitat.h:26
Exception that a parameter is missing in the instruction file.
Definition: demo_simulator.h:21