New private Summary implementation
A rewritten Summary.cpp with some minor header modifications. Synposis of the new implementation: * Uses unordered_map< string, std::function > for dispatch, instead of multiple functions and a switch * Some poor man's function composition support has been added (privately) to avoid a lot of reptition in the post processing. * Functions assume they work over lists of wells instead of single wells being special cased - this means groups of well etc. can share implementation with single wells and field keywords. * Unsupported keywords are not written in the Summary file. Furthermore, some comments on special cases and overall approach and a generally more declarative implementation. This change is invisible to downstream developers. Users will obviously see no more garbage keywords.
This commit is contained in:
@@ -21,16 +21,16 @@
|
||||
#define OPM_OUTPUT_SUMMARY_HPP
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <ert/ecl/ecl_sum.h>
|
||||
#include <ert/util/ert_unique_ptr.hpp>
|
||||
#include <ert/ecl/Smspec.hpp>
|
||||
|
||||
#include <opm/output/Wells.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class EclipseState;
|
||||
class Schedule;
|
||||
class SummaryConfig;
|
||||
|
||||
namespace out {
|
||||
@@ -45,19 +45,13 @@ class Summary {
|
||||
const EclipseState&, const data::Wells& );
|
||||
void write();
|
||||
|
||||
using kwtype = uint32_t;
|
||||
struct sum_node {
|
||||
sum_node( kwtype k, smspec_node_type* n ) :
|
||||
kw( k ), node( n ) {}
|
||||
|
||||
kwtype kw;
|
||||
smspec_node_type* node;
|
||||
};
|
||||
~Summary();
|
||||
|
||||
private:
|
||||
class keyword_handlers;
|
||||
|
||||
ERT::ert_unique_ptr< ecl_sum_type, ecl_sum_free > ecl_sum;
|
||||
std::map< const char*, std::vector< sum_node > > wvar;
|
||||
std::map< const char*, std::vector< sum_node > > gvar;
|
||||
std::unique_ptr< keyword_handlers > handlers;
|
||||
const ecl_sum_tstep_type* prev_tstep = nullptr;
|
||||
double prev_time_elapsed = 0;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user