Projects unit type into columns.
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
||||
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -80,7 +81,7 @@ namespace {
|
||||
return s;
|
||||
}
|
||||
|
||||
template<typename T, std::size_t header_height>
|
||||
template<typename T, std::size_t header_height, Opm::UnitSystem::UnitType unit_type>
|
||||
struct column {
|
||||
using fetch_function = std::function<std::string(const T&, const context&, std::size_t, std::size_t)>;
|
||||
using format_function = std::function<void(std::string&, std::size_t, std::size_t)>;
|
||||
@@ -109,9 +110,9 @@ namespace {
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T, std::size_t header_height>
|
||||
struct table: std::vector<column<T, header_height>> {
|
||||
using std::vector<column<T, header_height>>::vector;
|
||||
template<typename T, std::size_t header_height, Opm::UnitSystem::UnitType unit_type = Opm::UnitSystem::UnitType::UNIT_TYPE_METRIC>
|
||||
struct table: std::vector<column<T, header_height, unit_type>> {
|
||||
using std::vector<column<T, header_height, unit_type>>::vector;
|
||||
|
||||
std::size_t total_width() const {
|
||||
std::size_t r { 1 + this->size() } ;
|
||||
@@ -158,15 +159,15 @@ namespace {
|
||||
};
|
||||
|
||||
|
||||
template<typename InputType, typename OutputType, std::size_t header_height>
|
||||
template<typename InputType, typename OutputType, std::size_t header_height, Opm::UnitSystem::UnitType unit_type = Opm::UnitSystem::UnitType::UNIT_TYPE_METRIC>
|
||||
struct report {
|
||||
|
||||
std::string title;
|
||||
std::string decor;
|
||||
table<OutputType, header_height> column_definition;
|
||||
table<OutputType, header_height, unit_type> column_definition;
|
||||
const context ctx;
|
||||
|
||||
report(const std::string& _title, const table<OutputType, header_height>& _coldef, const context& _ctx)
|
||||
report(const std::string& _title, const table<OutputType, header_height, unit_type>& _coldef, const context& _ctx)
|
||||
: title { _title }
|
||||
, decor { underline(title) }
|
||||
, column_definition { _coldef }
|
||||
|
||||
Reference in New Issue
Block a user