Loading...
Searching...
No Matches
SimpleTable.hpp
/*
Copyright (C) 2013 by Andreas Lauser
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_PARSER_SIMPLE_TABLE_HPP
#define OPM_PARSER_SIMPLE_TABLE_HPP
#include <opm/input/eclipse/EclipseState/Tables/TableColumn.hpp>
#include <opm/input/eclipse/EclipseState/Tables/TableSchema.hpp>
#include <opm/input/eclipse/EclipseState/Util/OrderedMap.hpp>
#include <map>
#include <memory>
#include <string>
#include <vector>
namespace Opm {
class DeckItem;
class SimpleTable {
public:
SimpleTable() = default;
SimpleTable(TableSchema, const std::string& tableName, const DeckItem& deckItem, const int tableID);
explicit SimpleTable( TableSchema );
virtual ~SimpleTable() = default;
static SimpleTable serializationTestObject();
void addColumns();
void init( const std::string& tableName,
const DeckItem& deckItem,
const int tableID,
double scaling_factor = 0.0);
size_t numColumns() const;
size_t numRows() const;
void addRow( const std::vector<double>& row, const std::string& tableName);
const TableColumn& getColumn(const std::string &name) const;
const TableColumn& getColumn(size_t colIdx) const;
bool hasColumn(const std::string& name) const;
TableColumn& getColumn(const std::string &name);
TableColumn& getColumn(size_t colIdx);
double get(const std::string& column , size_t row) const;
double get(size_t column , size_t row) const;
double evaluate(const std::string& columnName, double xPos) const;
void assertJFuncPressure(const bool jf) const;
bool operator==(const SimpleTable& data) const;
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(m_schema);
serializer(m_columns);
serializer(m_jfunc);
}
protected:
TableSchema m_schema;
OrderedMap<TableColumn> m_columns;
bool m_jfunc = false;
};
}
#endif
Opm::DeckItem
Definition DeckItem.hpp:35
Opm::OrderedMap
A map with iteration in the order of insertion.
Definition OrderedMap.hpp:119
Opm::Serializer
Class for (de-)serializing.
Definition Serializer.hpp:94
Opm::SimpleTable::assertJFuncPressure
void assertJFuncPressure(const bool jf) const
throws std::invalid_argument if jf != m_jfunc
Definition SimpleTable.cpp:208
Opm::SimpleTable::init
void init(const std::string &tableName, const DeckItem &deckItem, const int tableID, double scaling_factor=0.0)
Initialize deck item.
Definition SimpleTable.cpp:103
Opm::SimpleTable::evaluate
double evaluate(const std::string &columnName, double xPos) const
Evaluate a column of the table at a given position.
Definition SimpleTable.cpp:201
Opm::TableColumn
Definition TableColumn.hpp:32
Opm::TableSchema
Definition TableSchema.hpp:32
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30