More robust parameter file handling#346
Draft
ozmorph wants to merge 35 commits into
Draft
Conversation
Contributor
Author
|
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
| // https://stackoverflow.com/a/217605 | ||
|
|
||
| // trim from start (in place) | ||
| static inline void ltrim(std::string& s) { |
Collaborator
There was a problem hiding this comment.
No need for inline here - its only a hint to the compiler - which will ignore it.
Collaborator
|
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.hpplooks 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::ifstreamandstd::istringstream.Things that are missing from this draft PR right now (I will update as I make more commits):
#1in a param file and using/CLP1value from the CLI)1at index 0 and0in 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!