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.
63 lines
1.7 KiB
C++
63 lines
1.7 KiB
C++
/*
|
|
Copyright 2016 Statoil ASA.
|
|
|
|
This file is part of the Open Porous Media project (OPM).
|
|
|
|
OPM is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
OPM is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef OPM_OUTPUT_SUMMARY_HPP
|
|
#define OPM_OUTPUT_SUMMARY_HPP
|
|
|
|
#include <string>
|
|
|
|
#include <ert/ecl/ecl_sum.h>
|
|
#include <ert/ecl/Smspec.hpp>
|
|
|
|
#include <opm/output/Wells.hpp>
|
|
|
|
namespace Opm {
|
|
|
|
class EclipseState;
|
|
class Schedule;
|
|
class SummaryConfig;
|
|
|
|
namespace out {
|
|
|
|
class Summary {
|
|
public:
|
|
Summary( const EclipseState&, const SummaryConfig& );
|
|
Summary( const EclipseState&, const SummaryConfig&, const std::string& );
|
|
Summary( const EclipseState&, const SummaryConfig&, const char* basename );
|
|
|
|
void add_timestep( int report_step, double secs_elapsed,
|
|
const EclipseState&, const data::Wells& );
|
|
void write();
|
|
|
|
~Summary();
|
|
|
|
private:
|
|
class keyword_handlers;
|
|
|
|
ERT::ert_unique_ptr< ecl_sum_type, ecl_sum_free > ecl_sum;
|
|
std::unique_ptr< keyword_handlers > handlers;
|
|
const ecl_sum_tstep_type* prev_tstep = nullptr;
|
|
double prev_time_elapsed = 0;
|
|
};
|
|
|
|
}
|
|
}
|
|
|
|
#endif //OPM_OUTPUT_SUMMARY_HPP
|