-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More robust parameter file handling #346
base: master
Are you sure you want to change the base?
Conversation
It appears that old ABI of the libstdc++ used in the Docker CentOS 7 container doesn't allow for the C++11 function Either References: |
9fdbebb
to
3922765
Compare
77cc98c
to
1ad9897
Compare
1ad9897
to
df5466d
Compare
a399414
to
d68eebd
Compare
src/ParamFile.cpp
Outdated
// https://stackoverflow.com/a/217605 | ||
|
||
// trim from start (in place) | ||
static inline void ltrim(std::string& s) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for inline
here - its only a hint to the compiler - which will ignore it.
Things I would like to see in this PR:
|
76dba63
to
c8f7142
Compare
…eam reader for parameter files; this class will eventually be used to phase out the GetInputParameter*() functions
…r2() with ParamReader's extract_or_exit() or extract() functions respectively; currently doesn't pass regression tests
…' argument name with 'default_value' to not use reserved keyword
…om an earlier file; this commit resolves the regression checksum mismatch error
…mFile.hpp; changed all simple invocations of GetInputParameter and GetInputParameter2 that were reading in multiple values
…_exit() functions to ParamFile.(h/c)pp; converted several locations in CovidSim.cpp to use these new functions which required changing fields in Model.h to use std::string instead of char arrays
…ser to conditionally extract values from the param files or choose the default value
…tween string sets
…extract() in CovidSim.cpp
… allow its functionality to be shared with ParamFile.cpp; updated build files accordingly
…xit() functions for integers and doubles in Parsers; replaced template code in ParamFile with more explicit function names for extracting types from the param files; updated CovidSim.cpp to use these new functions; updated CLI.cpp to use the new functions
…th an iostream call and return false for functions that aren't supposed to exit
…oke the build in the centos7 containers
…rom CovidSim.cpp to InverseCdf.h; removed GetInverseCdf() from CovidSim.cpp
…ions with other files
…ed so that fields don't need to be individually initialized in ReadParams()
…boolean values from parameter files (leading to the potential of one day specifying "true" or "false" instead of "1" and "0" respectively)
…at act as flags into bool so that the intent is more clear; updated CovidSim.cpp to use the new extract_bool() function
ca92b50
to
4cd99a8
Compare
Part 2 of #74. This pull is related to my other PR #228 which deals with the CLI parameter parsing aspects of #74. You may note that the
raw_extract()
number extraction code fromParamFile.hpp
looks similar to theparse_number()
function in PR #228. Eventually these two implementations could be combined into a separate file, but I think they can exist independently for now.The main goals of this Pull-Request are:
fscanf()
andsprintf()
withstd::ifstream
andstd::istringstream
.Things that are missing from this draft PR right now (I will update as I make more commits):
#1
in a param file and using/CLP1
value from the CLI)1
at index 0 and0
in every other place.output[4]
can havedefault{ 1, 2, 3, 4}
)I will continue to work on this PR, but please let me know if there are any design decisions you would like to discuss or changes you would like to be made!
Cheers!