ForestClaw / forestclaw

Quadtree/octree adaptive PDE solver based based on p4est.
http://www.forestclaw.org
BSD 2-Clause "Simplified" License
58 stars 21 forks source link

Set reasonable default options in all applications; #85

Open donnaaboise opened 9 years ago

donnaaboise commented 9 years ago

Originally reported by: Donna Calhoun (Bitbucket: donnaaboise, GitHub: donnaaboise)


Set up default options for each application that are set at run time and don't require a user configuration file.

It seems that sc_options_add ... can be called more than once for an option. Should I override the call in fclaw_options with a user specific call for those examples that require it? The problem I see is that then, the option shows up multiple times in the option printout.


cburstedde commented 6 years ago

Calling options_add multiple times would not be good. Each options_add takes a default value, which should be set at compile time (i.e. hardcoded in the source). If you want to formalize this, you can try to group these defaults in some application-specific .h file, include "it", and pass these as defaults to options_add. Would this work?

donnaaboise commented 6 years ago

The idea will be to create routine for each application that sets all fields in option structure to reasonable values. if fclaw_options is not present, the code should still run.

cburstedde commented 5 years ago

The original idea was to have compile time defaults in sc_options_add. After this and before parsing the options, we can load files to tune the defaults. Then, we read the command line, which modifies options again. On the command line, we may have -F file arguments that read the named files in place.

This may not be sufficient if different libraries have different defaults for the same variable. Imho most can be fixed by putting files to load before parsing into the code / path and hardcoding a scheme for the file names to load. I'm still behind on writing code that find .ini files in proper paths both running from source and from make install, such they survive the compile, make dist, unpack, compile, install cycle.