VTXWriter: support file modes#4177
Conversation
c274af4 to
1f68407
Compare
e75536c to
e350ed9
Compare
e350ed9 to
1911667
Compare
| Args: | ||
| comm: The MPI communicator | ||
| filename: The output filename | ||
| mode: The filemode to open the file in, one of 'a' (append) |
There was a problem hiding this comment.
Remove "one of", automatic when using "or".
| if (mode == "a") | ||
| return adios2::Mode::Append; | ||
|
|
||
| if (mode == "w") |
| _engine->Close(); | ||
| } | ||
| //----------------------------------------------------------------------------- | ||
| adios2::Mode impl_adios2::mode(const std::string& mode) |
There was a problem hiding this comment.
Did you consider just wrapping adios2::Mode directly as an enum?
| _engine->Close(); | ||
| } | ||
| //----------------------------------------------------------------------------- | ||
| adios2::Mode impl_adios2::mode(const std::string& mode) |
| } | ||
|
|
||
| /// Convert string to corresponding adios2 mode. | ||
| /// @param[in] mode Mode in string representation, either "w" or "a". |
There was a problem hiding this comment.
Leaving aside Enum vs no Enum, it's generally most transparent to map modes directly e.g. "Read" -> "adios2::Mode::Read". Then I have a clear idea what "Read" means in the context of the underlying library.
|
I'm a bit sceptical about adding an "append" mode, as the VTXScheme shouldn't (or at least couldn't previously) be modified at runtime with ADIOS2, which is why the initializer takes in the functions/meshes to store at each time-step, instead of following the XDMF file version where we write when we can. adding an append-mode needs us to revise the internal logic to ensure for consistent input at multiple steps. |
Adds support to
ADIOS2WriterandVTXWriterto open files in append mode (following interface ofVTKFile). Enabling usage such asDemonstrates the new feature, with simplified I/o logic in the naiver stokes demo.