Output Stream: Add File Creation for Summary Files
This commit adds a single function, createSummaryFile, that opens an EclOutput object on a file named as an ECLIPSE summary file (formatted vs. unformatted, unified vs. separate) and returns a unique_ptr to this. This is a step towards enabling new summary writer functionality.
This commit is contained in:
@@ -428,6 +428,12 @@ namespace Opm { namespace EclIO { namespace OutputStream {
|
||||
EclOutput& stream();
|
||||
};
|
||||
|
||||
std::unique_ptr<EclOutput>
|
||||
createSummaryFile(const ResultSet& rset,
|
||||
const int seqnum,
|
||||
const Formatted& fmt,
|
||||
const Unified& unif);
|
||||
|
||||
/// Derive filename corresponding to output stream of particular result
|
||||
/// set, with user-specified file extension.
|
||||
///
|
||||
|
||||
@@ -85,6 +85,17 @@ namespace {
|
||||
{
|
||||
return formatted ? "FSMSPEC" : "SMSPEC";
|
||||
}
|
||||
|
||||
std::string summary(const int rptStep,
|
||||
const bool formatted,
|
||||
const bool unified)
|
||||
{
|
||||
if (unified) {
|
||||
return formatted ? "FUNSMRY" : "UNSMRY";
|
||||
}
|
||||
|
||||
return separate(rptStep, formatted, "ABC", "STU");
|
||||
}
|
||||
} // namespace FileExtension
|
||||
|
||||
namespace Open
|
||||
@@ -765,6 +776,24 @@ Opm::EclIO::OutputStream::SummarySpecification::stream()
|
||||
|
||||
// =====================================================================
|
||||
|
||||
std::unique_ptr<Opm::EclIO::EclOutput>
|
||||
Opm::EclIO::OutputStream::createSummaryFile(const ResultSet& rset,
|
||||
const int seqnum,
|
||||
const Formatted& fmt,
|
||||
const Unified& unif)
|
||||
{
|
||||
const auto ext = FileExtension::summary(seqnum, fmt.set, unif.set);
|
||||
|
||||
return std::unique_ptr<Opm::EclIO::EclOutput> {
|
||||
new Opm::EclIO::EclOutput {
|
||||
outputFileName(rset, ext),
|
||||
fmt.set, std::ios_base::out
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// =====================================================================
|
||||
|
||||
std::string
|
||||
Opm::EclIO::OutputStream::outputFileName(const ResultSet& rsetDescriptor,
|
||||
const std::string& ext)
|
||||
|
||||
Reference in New Issue
Block a user