JSON/TOML arguments for all Series constructor arguments
- Dominant language
- C++
- Stars
- 161
- Forks
- 59
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 7
Description
**Is your feature request related to a problem? If so, please describe.**
#1584 introduced wildcards for filenames. This comes in handy, since it allows writing the main code independent from the backend which is then specified via JSON/TOML:
```cpp
// main.cpp
int main()
{
// ...
Series output("simData.%E", Access::CREATE, "@config.toml");
// ...
}
```
```toml
# config.toml
backend = "adios2"
iteration_encoding = "variable_based"
# --> a file named simData.bp5 will be written
```
Or alternatively:
```toml
# config.toml
backend = "hdf5"
iteration_encoding = "group_based"
```
This makes it very easy to write openPMD-based output routines that can be configured at runtime by the user, without needing to write a parser for command line arguments or similar.
**Problem:** This falls short when trying to use file-based iteration encoding since JSON/TOML exposes no way to specify the `%T` expansion pattern. The logical consequence imo is to allow specifying everything in JSON/TOML that could be specified in the constructor.
**Describe the solution you'd like**
```cpp
Series(
std::string const& filepath, // default, can be overridden from JSON/TOML
Access at, // default, can be overridden from JSON/TOML
std::string const &json_toml);
```
```toml
file_base_name = "simData"
file_infix = "%T"
# --> will be put together as "simData_%T.%E"
# "infix" is optional, will default as %06T in file-based encoding, as empty otherwise
```
```toml
file_base_name = "simData"
file_extension = "bp"
iteration_encoding = "file_based"
# --> will be put together as "simData_%06T.bp"
```
Contributor guide
Assessment
This issue has not been assessed yet.