frabas / DISPLACE_GUI

A Scientific Research Software for Spatial Fisheries and Natural Resource Management
https://displace-project.org/
GNU General Public License v2.0
9 stars 3 forks source link

Make the reading of input in scenario file independent from the order? #75

Open frabas opened 8 years ago

frabas commented 8 years ago

change read_scenario_config_file() so that For example, currently we have:

dyn_alloc_sce

baseline TACs LTMP

dyn_pop_sce

baseline

biolsce

1 etc.

The idea would be to replace by

dyn_alloc_sce

dyn_alloc_sce baseline TACs LTMP

dyn_pop_sce

dyn_pop_sce baseline

biolsce

biolsce 1 with a keyword in first position

then read_scenario_config_file() could detect the keywords line by line and redirected the reading in the right variable. While the comments are just ignored...

then make possible different orders to limit mistakes in input e.g.

biolsce

biolsce 1

dyn_pop_sce

dyn_pop_sce baseline

dyn_alloc_sce

dyn_alloc_sce baseline TACs LTMP

studiofuga commented 8 years ago

I suggest to include some more information on the config files, including the Configuration file version and compatibility string. The general structure may be something like:

# Compatibility xxxx
# File Version yyyy
key = value
key2 = value, value, value etc...
key3 values...

So each line must be in the form KEY [=] VALUES Key is an alfanumeric string, key sensitive (or non key sensitive?), followed by an optional separator "=". Value is a string starting with a nonspace and ending at the end of the line, spaces are stripped at the end of the string, can include spaces and any other character. The main code interface will not perform any type checking, so internally the file will be a dictionary std::map<std::string,std::string> . We'll provide conversion functions to transform Values to numerical types (int, double or float), and list(comma separated). Comment will start with "#" and will be ignored, except for the first few lines that will include the file version (to track changes) and the compatibilty integer or string value, to track the compatibility with the simulator/gui.

What do you think?

frabas commented 8 years ago

This fits exactly what I had in mind, thanks!

studiofuga commented 8 years ago

What is the priority, and on which version should we implement this task?

frabas commented 8 years ago

This is low priority but could be fixed as soon as input files related code is touched upon.