This commit introduces a new file manager,
Opm::EclIO::OutputStream::Init
that's intended to replace the low-level operations of Flow's INIT
file writer. The implementation uses the 'EclOutput' class and is
very similar to that of the 'Restart' stream introduced in commit
992d3b0c. The commonality between the two file managers might
possibly be extracted to a base class at a later time.
As of right now, the Init class supports outputting vectors of
'int', 'bool', 'float', and 'double'. Additional types will be
supported when needed.
The number of records is unrelated to AQUDIMS Item 5 (NANAQU). That
item sets the maximum aquifer ID permissible as Item 1 of AQUFETP.
Update unit test accordingly.
This commit makes class 'Opm::EclIO::ERst' able to open separate
restart files (*.X000n, *.F000n). Specifically, we refactor the
existing class constructor body into a new helper function
'initUnified'. We add a new helper function 'initSeparate' that
builds the requisite indices in the case of a single report step,
and make the constructor body call 'initUnified' or 'initSeparate'
depending on whether or not the SEQNUM keyword exists in the restart
stream.
Add two new unit tests to exercise the new ability.
This commit switches the file handling operations of the gateway
function RestartIO::save() to using the OutputStream::Restart
component. Briefly, this means replacing write_kw() function calls
with calls to Restart::write(), especially since the latter natively
handles PaddedString<8> data.
Space-padded vectors of N (usually 8) characters is the typical
representation of character data in ECLIPSE output files. Support
this type natively in the ECLIPSE IO library.
Then we don't have to store copies of the 'formatted' and 'unified'
flags, and are also able to remove the 'prepareStep()' function. We
will reintroduce these features if we decide to add support for
keeping the output stream open between separate restart output
requests (i.e., between calls to EclipseIO::writeTimeStep()).
In particular, make the stream() function into a private detail of
the implementation and add an overload set for outputting keyword
data and messages to the underlying output stream. Update unit test
accordingly.
Suggested by: Atgeirr F. Rasmussen
This commit introduces a new class,
Opm::ecl::OutputStream::Restart
that handles the details of opening restart output streams (all
combinations of formatted/unformatted and unified/separate), as well
as correctly positioning the stream 'put' indicator if we're opening
an existing unified restart file. In most cases, this will be a
simple append operation (std::ios_base::app), but there are some
subtleties that require more precise control. The new class is
befriended by EclOutput and ERst in order to access private member
functions and data members of these classes. That is needed in
order to handle file resize operations since some of the requisite
information is only available in those two classes.
We use Boost.Filesystem to implement file resize, as if by POSIX
function ::truncate(), and also to simplify filename generation.
These calls can be switched to std::filesystem once the project
requires C++17.
Intended use of the Restart class is
Restart rst(resultSet, formatted, unified);
rst.prepareStep(17); // Report step/SEQNUM 17.
rst.write("INTEHEAD", ihead);
// ...
The 'prepareStep' operation opens the file stream (if needed) and
also outputs a SEQNUM record in the case of a unified output stream.
Moreover, the 'resultSet' is a pair of output directory and case's
base name (e.g., "./mpi.np4/2019.05.14.01" and "NORNE_ATW2013") and
the formatted/unified flags are bools wrapped in structures.
The Restart class is intended to take over the role of the
'filename' string parameter of RestartIO::save().
Add a set of unit tests to demontrate usage and abilities of class
Restart.