mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1292 Fixed CppCheck Issues in FileInterface
This commit is contained in:
@@ -362,13 +362,12 @@ void RifEclipseInputFileTools::parseAndReadPathAliasKeyword(const QString &fileN
|
|||||||
data.open(QFile::ReadOnly);
|
data.open(QFile::ReadOnly);
|
||||||
|
|
||||||
QString line;
|
QString line;
|
||||||
qint64 lineLength = -1;
|
|
||||||
|
|
||||||
bool foundPathsKeyword = false;
|
bool foundPathsKeyword = false;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
lineLength = data.readLine(buf, sizeof(buf));
|
qint64 lineLength = data.readLine(buf, sizeof(buf));
|
||||||
if (lineLength > 0)
|
if (lineLength > 0)
|
||||||
{
|
{
|
||||||
line = QString::fromAscii(buf);
|
line = QString::fromAscii(buf);
|
||||||
|
|||||||
@@ -958,8 +958,8 @@ RigWellResultPoint RifReaderEclipseOutput::createWellResultPoint(const RigGridBa
|
|||||||
// Introduced based on discussion with H<>kon H<>gst<73>l 08.09.2016
|
// Introduced based on discussion with H<>kon H<>gst<73>l 08.09.2016
|
||||||
if (cellK >= static_cast<int>(grid->cellCountK()))
|
if (cellK >= static_cast<int>(grid->cellCountK()))
|
||||||
{
|
{
|
||||||
int maxCellKIndex = static_cast<int>(grid->cellCountK() - 1);
|
int maxCellK = static_cast<int>(grid->cellCountK());
|
||||||
cvf::Trace::show("Well Connection for grid " + cvf::String(grid->gridName()) + "\n - Ignored connection with invalid K value (K=" + cvf::String(cellK) + ") for well : " + cvf::String(wellName));
|
cvf::Trace::show("Well Connection for grid " + cvf::String(grid->gridName()) + "\n - Ignored connection with invalid K value (K=" + cvf::String(cellK) + ", max K = " + cvf::String(maxCellK) + ") for well : " + cvf::String(wellName));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1022,14 +1022,13 @@ cvf::Vec3d interpolate3DPosition(const std::vector<SegmentPositionContribution>&
|
|||||||
|
|
||||||
double denominator = 0.0;
|
double denominator = 0.0;
|
||||||
cvf::Vec3d interpolatedValue = cvf::Vec3d::ZERO;
|
cvf::Vec3d interpolatedValue = cvf::Vec3d::ZERO;
|
||||||
double distance;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < filteredPositions.size(); i++)
|
for (size_t i = 0; i < filteredPositions.size(); i++)
|
||||||
{
|
{
|
||||||
#if 0 // Pure average test
|
#if 0 // Pure average test
|
||||||
nominators[i] = 1.0;
|
nominators[i] = 1.0;
|
||||||
#else
|
#else
|
||||||
distance = filteredPositions[i].m_lengthFromConnection;
|
double distance = filteredPositions[i].m_lengthFromConnection;
|
||||||
|
|
||||||
if (distance < 1e-6)
|
if (distance < 1e-6)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -443,41 +443,6 @@ size_t RifReaderOpmParserPropertyReader::findOrCreateResult(const QString& newRe
|
|||||||
return resultIndex;
|
return resultIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RifReaderOpmParserPropertyReader::readAllProperties(std::shared_ptr< Opm::Deck > deck, RigEclipseCaseData* caseData, std::map<QString, QString>* newResults)
|
|
||||||
{
|
|
||||||
std::set<std::string> uniqueKeywords;
|
|
||||||
for (auto it = deck->begin(); it != deck->end(); it++)
|
|
||||||
{
|
|
||||||
uniqueKeywords.insert(it->name());
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto keyword : uniqueKeywords)
|
|
||||||
{
|
|
||||||
bool isItemCountEqual = RifReaderOpmParserPropertyReader::isDataItemCountIdenticalToMainGridCellCount(deck, keyword, caseData);
|
|
||||||
|
|
||||||
if (isItemCountEqual)
|
|
||||||
{
|
|
||||||
std::vector<double> allValues;
|
|
||||||
|
|
||||||
RifReaderOpmParserPropertyReader::getAllValuesForKeyword(deck, keyword, allValues);
|
|
||||||
|
|
||||||
QString keywordName = QString::fromStdString(keyword);
|
|
||||||
QString newResultName = caseData->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(keywordName);
|
|
||||||
size_t resultIndex = findOrCreateResult(newResultName, caseData);
|
|
||||||
if (resultIndex != cvf::UNDEFINED_SIZE_T)
|
|
||||||
{
|
|
||||||
std::vector< std::vector<double> >& newPropertyData = caseData->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex);
|
|
||||||
newPropertyData.push_back(allValues);
|
|
||||||
}
|
|
||||||
|
|
||||||
newResults->insert(std::make_pair(newResultName, keywordName));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -70,8 +70,8 @@ private:
|
|||||||
class RifReaderOpmParserPropertyReader
|
class RifReaderOpmParserPropertyReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RifReaderOpmParserPropertyReader(std::shared_ptr< Opm::Deck > deck);
|
explicit RifReaderOpmParserPropertyReader(std::shared_ptr< Opm::Deck > deck);
|
||||||
RifReaderOpmParserPropertyReader(const QString& fileName);
|
explicit RifReaderOpmParserPropertyReader(const QString& fileName);
|
||||||
|
|
||||||
std::set<std::string> keywords() const;
|
std::set<std::string> keywords() const;
|
||||||
|
|
||||||
@@ -80,7 +80,6 @@ public:
|
|||||||
static size_t findOrCreateResult(const QString& newResultName, RigEclipseCaseData* reservoir);
|
static size_t findOrCreateResult(const QString& newResultName, RigEclipseCaseData* reservoir);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void readAllProperties(std::shared_ptr< Opm::Deck > deck, RigEclipseCaseData* caseData, std::map<QString, QString>* newResults);
|
|
||||||
static void getAllValuesForKeyword(std::shared_ptr< Opm::Deck > deck, const std::string& keyword, std::vector<double>& allValues);
|
static void getAllValuesForKeyword(std::shared_ptr< Opm::Deck > deck, const std::string& keyword, std::vector<double>& allValues);
|
||||||
static bool isDataItemCountIdenticalToMainGridCellCount(std::shared_ptr< Opm::Deck > deck, const std::string& keyword, RigEclipseCaseData* caseData);
|
static bool isDataItemCountIdenticalToMainGridCellCount(std::shared_ptr< Opm::Deck > deck, const std::string& keyword, RigEclipseCaseData* caseData);
|
||||||
bool open(const QString& fileName);
|
bool open(const QString& fileName);
|
||||||
|
|||||||
Reference in New Issue
Block a user