Commit Graph

11 Commits

Author SHA1 Message Date
Arne Morten Kvarving
e0939b69f1 fixed: gcc8+ filesystem will collapse the multiple slashes 2020-02-14 16:14:15 +01:00
Arne Morten Kvarving
fb75bcd4e2 changed: use std::filesystem instead of boost::filesystem
since we still support g++-7, where filesystem is marked experimental,
we introduce a wrapper header and expose the namespace to use
as Opm::filesystem.

for gcc we unconditionally link with libstdc++fs in the python bindings.
the setup.py stuff links as c code, not c++ code, so it is not
automatically added on any gcc version. this might prove unportable
later.
2020-02-13 12:34:19 +01:00
Torbjørn Skille
c6f8a41c43 updates of ERst api, supports multiple occurrences of array names 2019-11-05 15:01:17 +01:00
Bård Skaflestad
7d11a59197 SMSPEC: Temporarily Restore Unconditional RESTART Vector
Needed to ensure we create the same summary/specification files as
the existing system.  We will revert this change once the new system
is in place and we can afford to update the reference solutions.
2019-10-12 18:38:20 -05:00
Bård Skaflestad
080225d8e5 Add File Manager Stream for Summary Specification
This commit introduces a new OutputStream class for representing the
summary specification file (.SMSPEC).  The stream is constructed
with constant data (output directory, basename, start date &c), and
provides a single write() member function that outputs a summary
specification.

Each call to write rewinds the underlying stream's output position.
Class EclOutput grants friendship to the new output stream class in
order to support easy stream rewinding.

Add a unit test to exercise the new class.
2019-10-03 10:04:10 +02:00
Bård Skaflestad
a281a3c6f4 Add RFT Output Stream
This commit introduces a new output stream, 'RFT', that is intended
as a new backend for writing RFT files.  At present this supports
integer, float, and PaddedOutputString<8> element types since those
are the types needed for basic RFT data.  We will extend the element
support if needed for PLT and/or Segment data.

We support formatted and unformatted output streams and distinguish
between opening a new stream and opening an existing output stream
(essentially between open modes ios_base::out and ios_base::app).

Add unit tests to exercise the possible combinations.
2019-09-18 16:48:53 +02:00
Bård Skaflestad
323e9903b4 File Output: Add Manager for 'INIT' File Based on EclOutput
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.
2019-06-24 09:52:56 +02:00
Bård Skaflestad
82b0a2d82b ECLIPSE I/O: Rename Namespace Opm::ecl -> Opm::EclIO
This reduces the risk of conflicting with the 'ecl' namespace from
LibECL, especially when the latter name is used from within the Opm
namespace.
2019-06-03 14:19:48 +02:00
Bård Skaflestad
a2ec7d7f6d OutputStream::Restart: Pull File Creation Into Constructor
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()).
2019-05-27 21:00:52 +02:00
Bård Skaflestad
df1a011b78 Redo Public Interface of OutputStream::Restart
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
2019-05-27 21:00:52 +02:00
Bård Skaflestad
992d3b0ce5 Restart Output: Add File Management Facility
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.
2019-05-27 21:00:52 +02:00