diff --git a/opm/parser/eclipse/IntegrationTests/ParseSGOF.cpp b/opm/parser/eclipse/IntegrationTests/ParseSGOF.cpp
index 2d587bef2..326a62fff 100644
--- a/opm/parser/eclipse/IntegrationTests/ParseSGOF.cpp
+++ b/opm/parser/eclipse/IntegrationTests/ParseSGOF.cpp
@@ -43,14 +43,14 @@ void check_parser(ParserPtr parser) {
BOOST_CHECK_EQUAL(1U , record0->size());
DeckItemConstPtr item0 = record0->getItem(0);
- BOOST_CHECK_EQUAL(10 * 4, item0->size());
+ BOOST_CHECK_EQUAL(10U * 4, item0->size());
}
void check_SgofTable(ParserPtr parser) {
DeckPtr deck = parser->parseString(parserData);
Opm::SgofTable sgofTable(deck->getKeyword("SGOF"));
- BOOST_CHECK_EQUAL(10, sgofTable.getSgColumn().size());
+ BOOST_CHECK_EQUAL(10U, sgofTable.getSgColumn().size());
BOOST_CHECK_EQUAL(0.1, sgofTable.getSgColumn()[0]);
BOOST_CHECK_EQUAL(0.0, sgofTable.getKrgColumn()[0]);
BOOST_CHECK_EQUAL(1.0, sgofTable.getKrogColumn()[0]);
diff --git a/opm/parser/eclipse/IntegrationTests/ParseSWOF.cpp b/opm/parser/eclipse/IntegrationTests/ParseSWOF.cpp
index 7b64e7f07..e7ddbf7dc 100644
--- a/opm/parser/eclipse/IntegrationTests/ParseSWOF.cpp
+++ b/opm/parser/eclipse/IntegrationTests/ParseSWOF.cpp
@@ -43,14 +43,14 @@ void check_parser(ParserPtr parser) {
BOOST_CHECK_EQUAL(1U , record0->size());
DeckItemConstPtr item0 = record0->getItem(0);
- BOOST_CHECK_EQUAL(10 * 4, item0->size());
+ BOOST_CHECK_EQUAL(10U * 4, item0->size());
}
void check_SwofTable(ParserPtr parser) {
DeckPtr deck = parser->parseString(parserData);
Opm::SwofTable swofTable(deck->getKeyword("SWOF"));
- BOOST_CHECK_EQUAL(10, swofTable.getSwColumn().size());
+ BOOST_CHECK_EQUAL(10U, swofTable.getSwColumn().size());
BOOST_CHECK_EQUAL(0.1, swofTable.getSwColumn()[0]);
BOOST_CHECK_EQUAL(0.0, swofTable.getKrwColumn()[0]);
BOOST_CHECK_EQUAL(1.0, swofTable.getKrowColumn()[0]);
diff --git a/opm/parser/eclipse/Utility/SimpleMultiRecordTable.cpp b/opm/parser/eclipse/Utility/SimpleMultiRecordTable.cpp
index ca77f6459..77c1fd435 100644
--- a/opm/parser/eclipse/Utility/SimpleMultiRecordTable.cpp
+++ b/opm/parser/eclipse/Utility/SimpleMultiRecordTable.cpp
@@ -16,20 +16,20 @@
You should have received a copy of the GNU General Public License
along with OPM. If not, see .
*/
-#include "SimpleMultiRecordTable.hpp"
+#include
namespace Opm {
// create table from first few items of multiple records (i.e. getSIDoubleData() throws an exception)
SimpleMultiRecordTable::SimpleMultiRecordTable(Opm::DeckKeywordConstPtr keyword,
const std::vector &columnNames,
- int tableIdx,
- int firstEntityOffset)
+ size_t tableIdx,
+ size_t firstEntityOffset)
{
createColumns_(columnNames);
// first, go to the first record of the specified table. For this,
// we need to skip the right number of empty records...
- int curTableIdx = 0;
+ size_t curTableIdx = 0;
for (m_firstRecordIdx = 0;
curTableIdx < tableIdx;
++ m_firstRecordIdx)
@@ -51,7 +51,7 @@ SimpleMultiRecordTable::SimpleMultiRecordTable(Opm::DeckKeywordConstPtr keyword,
{
}
- for (unsigned rowIdx = m_firstRecordIdx; rowIdx < m_firstRecordIdx + m_numRecords; ++ rowIdx) {
+ for (size_t rowIdx = m_firstRecordIdx; rowIdx < m_firstRecordIdx + m_numRecords; ++ rowIdx) {
// extract the actual data from the records of the keyword of
// the deck
Opm::DeckRecordConstPtr deckRecord =
@@ -61,14 +61,14 @@ SimpleMultiRecordTable::SimpleMultiRecordTable(Opm::DeckKeywordConstPtr keyword,
throw std::runtime_error("Number of columns in the data file is"
"inconsistent with the ones specified");
- for (int colIdx = 0; colIdx < numColumns(); ++colIdx) {
- int deckItemIdx = colIdx + firstEntityOffset;
+ for (size_t colIdx = 0; colIdx < numColumns(); ++colIdx) {
+ size_t deckItemIdx = colIdx + firstEntityOffset;
m_columns[colIdx].push_back(getFlatSiDoubleData_(deckRecord, deckItemIdx));
}
}
}
-int SimpleMultiRecordTable::getNumFlatItems_(Opm::DeckRecordConstPtr deckRecord) const
+size_t SimpleMultiRecordTable::getNumFlatItems_(Opm::DeckRecordConstPtr deckRecord) const
{
int result = 0;
for (unsigned i = 0; i < deckRecord->size(); ++ i) {
diff --git a/opm/parser/eclipse/Utility/SimpleMultiRecordTable.hpp b/opm/parser/eclipse/Utility/SimpleMultiRecordTable.hpp
index ff23a6ef8..0da92818b 100644
--- a/opm/parser/eclipse/Utility/SimpleMultiRecordTable.hpp
+++ b/opm/parser/eclipse/Utility/SimpleMultiRecordTable.hpp
@@ -19,7 +19,7 @@
#ifndef OPM_PARSER_SIMPLE_MULTI_RECORD_TABLE_HPP
#define OPM_PARSER_SIMPLE_MULTI_RECORD_TABLE_HPP
-#include "SimpleTable.hpp"
+#include
#include
@@ -41,29 +41,29 @@ namespace Opm {
*/
SimpleMultiRecordTable(Opm::DeckKeywordConstPtr keyword,
const std::vector &columnNames,
- int tableIndex,
- int firstEntityOffset = 0);
+ size_t tableIndex,
+ size_t firstEntityOffset = 0);
/*!
* \brief Return the index of the first record which applies
* for this table object.
*/
- int firstRecordIndex() const
+ size_t firstRecordIndex() const
{ return m_firstRecordIdx; }
/*!
* \brief Return the number of records which are used by this
* this table object.
*/
- int numRecords() const
+ size_t numRecords() const
{ return m_numRecords; }
private:
- int getNumFlatItems_(Opm::DeckRecordConstPtr deckRecord) const;
+ size_t getNumFlatItems_(Opm::DeckRecordConstPtr deckRecord) const;
double getFlatSiDoubleData_(Opm::DeckRecordConstPtr deckRecord, unsigned flatItemIdx) const;
- int m_firstRecordIdx;
- int m_numRecords;
+ size_t m_firstRecordIdx;
+ size_t m_numRecords;
};
typedef std::shared_ptr SimpleMultiRecordTablePtr;
diff --git a/opm/parser/eclipse/Utility/SimpleTable.cpp b/opm/parser/eclipse/Utility/SimpleTable.cpp
index 2aba1e5ed..fc4c4d283 100644
--- a/opm/parser/eclipse/Utility/SimpleTable.cpp
+++ b/opm/parser/eclipse/Utility/SimpleTable.cpp
@@ -16,14 +16,14 @@
You should have received a copy of the GNU General Public License
along with OPM. If not, see .
*/
-#include "SimpleTable.hpp"
+#include
namespace Opm {
// create table from single record
SimpleTable::SimpleTable(Opm::DeckKeywordConstPtr keyword,
const std::vector &columnNames,
- int recordIdx,
- int firstEntityOffset)
+ size_t recordIdx,
+ size_t firstEntityOffset)
{
createColumns_(columnNames);
@@ -31,17 +31,17 @@ SimpleTable::SimpleTable(Opm::DeckKeywordConstPtr keyword,
Opm::DeckRecordConstPtr deckRecord =
keyword->getRecord(recordIdx);
- int numFlatItems = getNumFlatItems_(deckRecord);
+ size_t numFlatItems = getNumFlatItems_(deckRecord);
if ( (numFlatItems - firstEntityOffset) % numColumns() != 0)
throw std::runtime_error("Number of columns in the data file is"
"inconsistent with the ones specified");
- for (int rowIdx = 0;
+ for (size_t rowIdx = 0;
rowIdx*numColumns() < numFlatItems - firstEntityOffset;
++rowIdx)
{
- for (int colIdx = 0; colIdx < numColumns(); ++colIdx) {
- int deckItemIdx = rowIdx*numColumns() + firstEntityOffset + colIdx;
+ for (size_t colIdx = 0; colIdx < numColumns(); ++colIdx) {
+ size_t deckItemIdx = rowIdx*numColumns() + firstEntityOffset + colIdx;
m_columns[colIdx].push_back(getFlatSiDoubleData_(deckRecord, deckItemIdx));
}
}
@@ -53,26 +53,26 @@ void SimpleTable::createColumns_(const std::vector &columnNames)
// the json description of the keyword.
auto columnNameIt = columnNames.begin();
const auto &columnNameEndIt = columnNames.end();
- int columnIdx = 0;
+ size_t columnIdx = 0;
for (; columnNameIt != columnNameEndIt; ++columnNameIt, ++columnIdx) {
m_columnNames[*columnNameIt] = columnIdx;
}
m_columns.resize(columnIdx);
}
-int SimpleTable::getNumFlatItems_(Opm::DeckRecordConstPtr deckRecord) const
+size_t SimpleTable::getNumFlatItems_(Opm::DeckRecordConstPtr deckRecord) const
{
- int result = 0;
- for (unsigned i = 0; i < deckRecord->size(); ++ i) {
+ size_t result = 0;
+ for (size_t i = 0; i < deckRecord->size(); ++ i) {
result += deckRecord->getItem(i)->size();
}
return result;
}
-double SimpleTable::getFlatSiDoubleData_(Opm::DeckRecordConstPtr deckRecord, unsigned flatItemIdx) const
+double SimpleTable::getFlatSiDoubleData_(Opm::DeckRecordConstPtr deckRecord, size_t flatItemIdx) const
{
- unsigned itemFirstFlatIdx = 0;
+ size_t itemFirstFlatIdx = 0;
for (unsigned i = 0; i < deckRecord->size(); ++ i) {
Opm::DeckItemConstPtr item = deckRecord->getItem(i);
if (itemFirstFlatIdx + item->size() > flatItemIdx)
diff --git a/opm/parser/eclipse/Utility/SimpleTable.hpp b/opm/parser/eclipse/Utility/SimpleTable.hpp
index d85cfcc69..c87d625bb 100644
--- a/opm/parser/eclipse/Utility/SimpleTable.hpp
+++ b/opm/parser/eclipse/Utility/SimpleTable.hpp
@@ -42,22 +42,22 @@ namespace Opm {
*/
SimpleTable(Opm::DeckKeywordConstPtr keyword,
const std::vector &columnNames,
- int recordIdx = 0,
- int firstEntityOffset = 0);
+ size_t recordIdx = 0,
+ size_t firstEntityOffset = 0);
// constructor to make the base class compatible with specialized table implementations
SimpleTable(Opm::DeckKeywordConstPtr keyword,
- int recordIdx = 0,
- int firstEntityOffset = 0)
+ size_t recordIdx = 0,
+ size_t firstEntityOffset = 0)
{
throw std::logic_error("The base class of simple tables can't be "
"instantiated without specifying columns!");
}
- int numColumns() const
+ size_t numColumns() const
{ return m_columns.size(); }
- int numRows() const
+ size_t numRows() const
{ return m_columns[0].size(); }
const std::vector &getColumn(const std::string &name) const
@@ -70,19 +70,19 @@ namespace Opm {
assert(0 <= colIdx && colIdx < static_cast(m_columns.size()));
return m_columns[colIdx];
}
- const std::vector &getColumn(int colIdx) const
+ const std::vector &getColumn(size_t colIdx) const
{
- assert(0 <= colIdx && colIdx < static_cast(m_columns.size()));
+ assert(0 <= colIdx && colIdx < static_cast(m_columns.size()));
return m_columns[colIdx];
}
protected:
void createColumns_(const std::vector &columnNames);
- int getNumFlatItems_(Opm::DeckRecordConstPtr deckRecord) const;
- double getFlatSiDoubleData_(Opm::DeckRecordConstPtr deckRecord, unsigned flatItemIdx) const;
+ size_t getNumFlatItems_(Opm::DeckRecordConstPtr deckRecord) const;
+ double getFlatSiDoubleData_(Opm::DeckRecordConstPtr deckRecord, size_t flatItemIdx) const;
- std::map m_columnNames;
+ std::map m_columnNames;
std::vector > m_columns;
};