QHGMain¶
This page describes the module QHGMain
QHGMain
is the executable which runs a QHG4 simulation.
QHGMain.cpp
consists mainly of the main()
function, in which the logfile is initialized, a Simulator object is created and the simulation loop is started.
- Code:
Calling QHGMain¶
QHGMain has a large number of command line parameters
- -h
show this help
- –help
show detailed help for topic (use name of option or “all”)
- –log-file
set name of log file (default:”SimTest.log”)
- –grid
set grid file
- –num-iters
set number of iterations
- –geo
set geography file
- –climate
set climate file
- –veg
set vegetation file
- –nav
set navigation file
- –pops
set population files
- –output-prefix
set prefix for output files (default: “output_”)
- –output-dir
set output directory (default: “./”)
- –data-dirs
set data directories (default: “./”)
- –read-config
read options from config file
- –write-config
write config to file <conf>
- –events
set event list
- –start-time
set ‘real’ time for simulation step 0 (default: 0)
- –dyn-pops
use populations from so directory
- –so-dirs
search directories for population so-files (default: “./”)
- –interpol-step
set step size for interpolation (default: 1)
- –interpolation
set interpolation params
- –layer-size
set layer size (default: 65536)
- –shuffle
shift random generator’s sequence (default: 0)
- –seed
set seed for random number generators
- –pop-params
set special population parameters
- –zip-output
use gzip to zip all output qdf files
- –info-string
set information to be written to root group of output files
- –resume
resume from previously dumped env and pop files
- –no-merge-pops
don’t merge compatible populations (same IDs, same actions, same agent types)
- –dump-on-interrupt
set interrupt handler for Ctrl-C (SIG_INT): dump and exit
Parameter description¶
-h¶
Show this help
–help=<topic>¶
Show detailed help for specified topic (use name of option or “all”)
–log-file=<filename>¶
Set name of log file.
–grid=<grid-file>¶
(required) Specify name of initial grid-file to use.
grid-file must be a QDF file containing a grid group, but may also contain other groups.
–num-iters=<iters>¶
(required) Set number of iterations.
iters must be a positive number.
–geo=<geo-file>¶
Set the initial geography file.
geo-file must be a QDF-file containing a geography group, but may also contain other groups.
It must contain data for the same number of cells as the grid file
–climate=<climate-file>¶
Set the initial climate file.
climate-file must be a QDF-file containing a climate group, but may also contain other groups.
It must contain data for the same number of cells as the grid file
–veg=<veg-file>¶
Set the vegetation file.
veg-file must be a QDF file containing a vegetation group, but may also contain othr groups.
It must contain data for the same number of cells as the grid file
–pops=<pop-list>¶
Set population files with QDF file.
pop-list is a comma-separated list of population definition files.
–output-prefix=<name>¶
Set prefix for output files (default: “output_”).
This prefix is prepended to all output files
name ia an arbitrary string without special characters)
–output-dir=<dirname>¶
Set output directory (default: “./”)
If the output directory does not exist, it is created.
dirname is the path to the output
–data-dirs=<dirnames>¶
Set search-data directories for input files (default: “./”)
dir-names is a comma-separated list of directories.
The order of the directoris in the list defines the search order.
–read-config=<conf>¶
Read config from a configuration file.
- A configuration file must consist of lines each of which is a option setting of the form
–<option-name>=value
Options passed as parameters to the application supercede the settings in the config file.
–write-config=<conf>¶
Write config to file <conf>
The configuration file created with this call can be used with the option “–read-config”
–events=<event-list>¶
Set event list.
event-list ::= "'" <event> ["," <event>]*"'"
For detailed information see Events.
–start-time=<time>¶
Set ‘real’ time for simulation step 0 (default: 0). If your simulation starts at 70’000 years before the present, you have to set start-time to -70000.
–dyn-pops¶
Use population plugins from so directory
–so-dirs=<dirlist>¶
search directories for population so-files (default: “./”)
dirlist mujst be a comma-separated list of directories in which to look for population plugins
–interpol-step=<step>¶
Set step size for interpolation (default: 1)
This option only has any efffect if you have some interpolation events
–interpolation=<params>¶
This option prepares the interpolation of the specified arrays params
params ::= <arrays>":"<evtfile>":"<inter-step>
arrays ::= <arrname> ["+"<arrname>]*
arrname ::= "alt" | "npp"
–layer-size=<size>¶
(technical)
Set the layer size of the resizable arrays (default: 65536)
–shuffle=<num>¶
(techical)
Shift random generator’s sequence (default: 0).
–seed=<seedtype>¶
Set seed for random number generators.
seedtype ::= "random" | "seq:"<sequence> | "file:"<seed-file> | "phrase:"<arbitrary>
sequence ::= (<hexnumber> ",")*
arbitrary : arbitrary string (enclose in quotes if it contains spaces)
seed-file : name of a seed file
If seedType is “random”, the seeds are filled with random numbers based on the current time
A sequence must be consist of 16 comma-separated 8-digit hexnumbers.
If sequence is given, it is passed directly to the random nuber generators.
If an arbitrary string is provided, it is turned into a seed sequence using a hash function (SHA-512)
If a seed file is specified it must conform to the following format.
seed-file ::= <seed-def>*
seed-def ::= <header> <seed-line>* <footer>
header ::= "SEED"[:<dest>]
seed-line ::= (<hexnumber> ",")*
dest : A string describing which RNG the sequence should be passed to (NOT IMPLEMENTED YET)
footer ::= "SEED_END"
In total, 16 8-digit hex numbers must be given between header and footer
–pop-params=<paramstring>¶
Set special population parameters.
param-strings ::= <param-string> ["," <param-string>]*
param-string ::= <popname> ":" <pop-param>
The pop-param strings are passed to the specified populations; the format of pop-param is specific for the particular population.
Data provided this way will be passed to the parameter of the population’s setParam(const char *pParam)
method.
–zip-output¶
Use gzip to zip all output qdf files.
–info-string=<infostring>¶
Add <infostring> as the value of the attribute “info” of the root group of every output qdf.
–resume¶
Resume simulation from previously dumped env and pop files (created by a “dump” event).
–no-merge-pops¶
Don’t merge compatible populations.
- Two populations are compatible if they have the same class name, the same species name, the same actions , and the same agent structure.
ATTENTION: currently, the population read in more recently replacess the older one
–dump-on-interrupt¶
Set interrupt handler for Ctrl-C (SIG_INT): write dump and exit gracefully.