2014-01-09 18:44:23 +01:00
|
|
|
/*
|
|
|
|
|
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/>.
|
|
|
|
|
*/
|
2014-04-28 18:29:44 +02:00
|
|
|
#ifndef OPM_PARSER_MULTI_RECORD_TABLE_HPP
|
|
|
|
|
#define OPM_PARSER_MULTI_RECORD_TABLE_HPP
|
2014-01-09 18:44:23 +01:00
|
|
|
|
2014-09-18 16:28:36 +02:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Tables/SingleRecordTable.hpp>
|
2014-01-09 18:44:23 +01:00
|
|
|
|
|
|
|
|
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
|
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <cassert>
|
|
|
|
|
|
|
|
|
|
namespace Opm {
|
2014-09-17 14:41:37 +02:00
|
|
|
// forward declaration
|
|
|
|
|
class EclipseState;
|
|
|
|
|
|
2014-01-09 18:44:23 +01:00
|
|
|
// create table from first few items of multiple records (i.e. getSIDoubleData() throws an exception)
|
2014-04-28 18:29:44 +02:00
|
|
|
class MultiRecordTable : public SingleRecordTable {
|
2014-09-17 14:41:37 +02:00
|
|
|
protected:
|
2014-01-09 18:44:23 +01:00
|
|
|
/*!
|
|
|
|
|
* \brief Read simple tables from multi-item keywords like PVTW
|
|
|
|
|
*
|
|
|
|
|
* This creates a table out of the first N items of each of
|
|
|
|
|
* the keyword's records. (N is the number of columns.)
|
|
|
|
|
*/
|
2014-09-16 13:58:13 +02:00
|
|
|
void init(Opm::DeckKeywordConstPtr keyword,
|
|
|
|
|
const std::vector<std::string> &columnNames,
|
|
|
|
|
size_t tableIndex,
|
|
|
|
|
size_t firstEntityOffset);
|
2014-01-09 18:44:23 +01:00
|
|
|
|
2014-09-17 14:41:37 +02:00
|
|
|
public:
|
|
|
|
|
MultiRecordTable() = default;
|
|
|
|
|
|
|
|
|
|
#ifdef BOOST_TEST_MODULE
|
|
|
|
|
// DO NOT TRY TO CALL THIS METHOD! it is only for the unit tests!
|
|
|
|
|
void initFORUNITTESTONLY(Opm::DeckKeywordConstPtr keyword,
|
|
|
|
|
const std::vector<std::string> &columnNames,
|
|
|
|
|
size_t tableIndex,
|
|
|
|
|
size_t firstEntityOffset)
|
|
|
|
|
{ init(keyword, columnNames, tableIndex, firstEntityOffset); }
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Returns the number of tables which can be found in a
|
|
|
|
|
* given keyword.
|
|
|
|
|
*/
|
|
|
|
|
static size_t numTables(Opm::DeckKeywordConstPtr keyword);
|
|
|
|
|
|
2014-01-16 13:10:09 +01:00
|
|
|
/*!
|
|
|
|
|
* \brief Return the index of the first record which applies
|
|
|
|
|
* for this table object.
|
|
|
|
|
*/
|
2014-09-16 13:58:13 +02:00
|
|
|
size_t firstRecordIndex() const;
|
2014-01-16 13:10:09 +01:00
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Return the number of records which are used by this
|
|
|
|
|
* this table object.
|
|
|
|
|
*/
|
2014-09-16 13:58:13 +02:00
|
|
|
size_t numRecords() const;
|
2014-01-16 13:10:09 +01:00
|
|
|
|
2014-01-09 18:44:23 +01:00
|
|
|
private:
|
2014-09-17 22:56:25 +02:00
|
|
|
static size_t getNumFlatItems(Opm::DeckRecordConstPtr deckRecord);
|
|
|
|
|
double getFlatSiDoubleData(Opm::DeckRecordConstPtr deckRecord, unsigned flatItemIdx) const;
|
2014-01-16 13:10:09 +01:00
|
|
|
|
2014-01-17 08:13:08 +01:00
|
|
|
size_t m_firstRecordIdx;
|
|
|
|
|
size_t m_numRecords;
|
2014-01-09 18:44:23 +01:00
|
|
|
};
|
|
|
|
|
|
2014-04-28 18:29:44 +02:00
|
|
|
typedef std::shared_ptr<MultiRecordTable> MultiRecordTablePtr;
|
|
|
|
|
typedef std::shared_ptr<const MultiRecordTable> MultiRecordTableConstPtr;
|
2014-01-09 18:44:23 +01:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-16 13:58:13 +02:00
|
|
|
#endif
|
2014-01-09 18:44:23 +01:00
|
|
|
|