/* 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 . */ #ifndef OPM_PARSER_MULTI_RECORD_TABLE_HPP #define OPM_PARSER_MULTI_RECORD_TABLE_HPP #include #include #include #include #include #include #include namespace Opm { // create table from first few items of multiple records (i.e. getSIDoubleData() throws an exception) class MultiRecordTable : public SingleRecordTable { public: /*! * \brief Returns the number of tables which can be found in a * given keyword. */ static size_t numTables(Opm::DeckKeywordConstPtr keyword); /*! * \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.) */ MultiRecordTable(Opm::DeckKeywordConstPtr keyword, const std::vector &columnNames, size_t tableIndex, size_t firstEntityOffset = 0); /*! * \brief Return the index of the first record which applies * for this table object. */ size_t firstRecordIndex() const { return m_firstRecordIdx; } /*! * \brief Return the number of records which are used by this * this table object. */ size_t numRecords() const { return m_numRecords; } private: static size_t getNumFlatItems_(Opm::DeckRecordConstPtr deckRecord); double getFlatSiDoubleData_(Opm::DeckRecordConstPtr deckRecord, unsigned flatItemIdx) const; size_t m_firstRecordIdx; size_t m_numRecords; }; typedef std::shared_ptr MultiRecordTablePtr; typedef std::shared_ptr MultiRecordTableConstPtr; } #endif // OPM_PARSER_SIMPLE_MULTI_RECORD_TABLE_HPP