#1292 Fixed CppCheck Issues in ReservoirDataModel

This commit is contained in:
Magne Sjaastad 2017-03-06 11:58:07 +01:00
parent 3a1991d37d
commit 0bccc883ff
22 changed files with 36 additions and 37 deletions

View File

@ -374,7 +374,6 @@ void RigAccWellFlowCalculator::calculateFlowPrPseudoLength(size_t branchIdx, dou
RigSimulationWellCoordsAndMD mdCalculator(branchClPoints);
size_t prevConnIndx = -1;
int clSegIdx = static_cast<int>(branchCells.size()) - 1;
std::vector<double> accFlowPrTracer(m_tracerNames.size(), 0.0);

View File

@ -203,6 +203,14 @@ bool RigActiveCellInfo::isCoarseningActive() const
return m_reservoirCellResultCount != m_reservoirActiveCellCount;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigActiveCellInfo::GridActiveCellCounts::GridActiveCellCounts()
: m_activeCellCount(0)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -61,6 +61,8 @@ private:
class GridActiveCellCounts
{
public:
GridActiveCellCounts();
size_t activeCellCount() const;
void setActiveCellCount(size_t activeCellCount);

View File

@ -42,7 +42,7 @@ class RigStatisticsDataCache;
class RigCaseCellResultsData : public cvf::Object
{
public:
RigCaseCellResultsData(RigMainGrid* ownerGrid);
explicit RigCaseCellResultsData(RigMainGrid* ownerGrid);
void setMainGrid(RigMainGrid* ownerGrid);
void setActiveCellInfo(RigActiveCellInfo* activeCellInfo) { m_activeCellInfo = activeCellInfo;}

View File

@ -120,7 +120,7 @@ void RigCaseToCaseCellMapper::addMapping(int depCaseCellIdx, int masterCaseMatch
m_masterCellIndexSeries.back().push_back(masterCaseMatchingCell);
m_masterCellOrIntervalIndex[depCaseCellIdx] = -newSeriesIdx;
}
else if (mcOrSeriesIdx < 0)
else
{
m_masterCellIndexSeries[-mcOrSeriesIdx].push_back(masterCaseMatchingCell);
}

View File

@ -32,7 +32,7 @@ class RigGridBase;
class RigCombMultResultAccessor : public RigResultAccessor
{
public:
RigCombMultResultAccessor(const RigGridBase* grid);
explicit RigCombMultResultAccessor(const RigGridBase* grid);
void setMultResultAccessors(
RigResultAccessor* multXPosAccessor,

View File

@ -32,7 +32,7 @@ class RigGridBase;
class RigCombTransResultAccessor : public RigResultAccessor
{
public:
RigCombTransResultAccessor(const RigGridBase* grid);
explicit RigCombTransResultAccessor(const RigGridBase* grid);
void setTransResultAccessors(RigResultAccessor* xTransAccessor,
RigResultAccessor* yTransAccessor,

View File

@ -43,7 +43,7 @@ public:
enum { NO_FAULT = -1, UNKNOWN_FAULT = -2 };
public:
RigFaultsPrCellAccumulator(size_t reservoirCellCount)
explicit RigFaultsPrCellAccumulator(size_t reservoirCellCount)
{
const int initVals[6] = { NO_FAULT, NO_FAULT, NO_FAULT, NO_FAULT, NO_FAULT, NO_FAULT};
caf::IntArray6 initVal;

View File

@ -25,7 +25,7 @@
class RigFlowDiagResultFrames: public cvf::Object
{
public:
RigFlowDiagResultFrames(size_t frameCount);
explicit RigFlowDiagResultFrames(size_t frameCount);
virtual ~RigFlowDiagResultFrames();
const

View File

@ -33,7 +33,7 @@ class RimFlowDiagSolution;
class RigFlowDiagTimeStepResult
{
public:
RigFlowDiagTimeStepResult(size_t activeCellCount);
explicit RigFlowDiagTimeStepResult(size_t activeCellCount);
void setTracerTOF (const std::string& tracerName, const std::map<int, double>& cellValues);
void setTracerFraction(const std::string& tracerName, const std::map<int, double>& cellValues);
@ -55,7 +55,7 @@ class RigOpmFldStaticData;
class RigFlowDiagSolverInterface : public cvf::Object
{
public:
RigFlowDiagSolverInterface(RimEclipseResultCase * eclipseCase);
explicit RigFlowDiagSolverInterface(RimEclipseResultCase * eclipseCase);
virtual ~RigFlowDiagSolverInterface();
RigFlowDiagTimeStepResult calculate(size_t timestep,

View File

@ -126,11 +126,8 @@ void RigGridBase::initSubCellsMainGridCellIndex()
size_t cellIdx;
for (cellIdx = 0; cellIdx < grid->cellCount(); ++cellIdx)
{
RigLocalGrid* localGrid = NULL;
RigGridBase* parentGrid = NULL;
localGrid = static_cast<RigLocalGrid*>(grid);
parentGrid = localGrid->parentGrid();
RigLocalGrid* localGrid = static_cast<RigLocalGrid*>(grid);
RigGridBase* parentGrid = localGrid->parentGrid();
RigCell& cell = localGrid->cell(cellIdx);
size_t parentCellIndex = cell.parentCellIndex();

View File

@ -43,7 +43,7 @@ class RigActiveCellInfo;
class RigGridBase : public cvf::StructGridInterface
{
public:
RigGridBase(RigMainGrid* mainGrid);
explicit RigGridBase(RigMainGrid* mainGrid);
virtual ~RigGridBase(void);
void setGridPointDimensions(const cvf::Vec3st& gridDimensions) { m_gridPointDimensions = gridDimensions;}
@ -125,7 +125,7 @@ private:
class RigGridCellFaceVisibilityFilter : public cvf::CellFaceVisibilityFilter
{
public:
RigGridCellFaceVisibilityFilter(const RigGridBase* grid)
explicit RigGridCellFaceVisibilityFilter(const RigGridBase* grid)
: m_grid(grid)
{
}

View File

@ -32,7 +32,7 @@ class SingleLasFileMetaData;
class RigLasFileExporter
{
public:
RigLasFileExporter(const std::vector<RimWellLogCurve*>& curves);
explicit RigLasFileExporter(const std::vector<RimWellLogCurve*>& curves);
void setResamplingInterval(double interval);

View File

@ -22,7 +22,7 @@
class RigLocalGrid : public RigGridBase
{
public:
RigLocalGrid(RigMainGrid* mainGrid);
explicit RigLocalGrid(RigMainGrid* mainGrid);
virtual ~RigLocalGrid();
RigGridBase * parentGrid() const { return m_parentGrid; }

View File

@ -45,11 +45,12 @@ void RigNNCData::processConnections(const RigMainGrid& mainGrid)
// Try to find the shared face
char hasNeighbourInAnyDirection = 0;
bool isPossibleNeighborInDirection[6]= {true, true, true, true, true, true};
if (c1.hostGrid() == c2.hostGrid())
{
char hasNeighbourInAnyDirection = 0;
size_t i1, j1, k1;
c1.hostGrid()->ijkFromCellIndex(c1.gridLocalCellIndex(), &i1, &j1, &k1);
size_t i2, j2, k2;

View File

@ -437,15 +437,14 @@ void RigReservoirBuilderMock::addWellData(RigEclipseCaseData* eclipseCase, RigGr
RigWellResultPoint deadEndData1 = data;
deadEndData1.m_gridCellIndex = data.m_gridCellIndex + 2;
deadEndData.m_isOpen = false;
deadEndData1.m_isOpen = false;
wellSegment.m_branchResultPoints.push_back(deadEndData);
wellSegment.m_branchResultPoints.push_back(deadEndData1);
wellSegment.m_branchResultPoints.push_back(deadEndData1);
deadEndData.m_isOpen = true;
wellSegment.m_branchResultPoints.push_back(deadEndData);
wellSegment.m_branchResultPoints.push_back(deadEndData);
data.m_isOpen = true;
data.m_isOpen = true;
wellSegment.m_branchResultPoints.push_back(data);
}
}

View File

@ -211,9 +211,7 @@ void RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineFromWellF
cvf::Vec3d outOfPrevCell(centerPreviousCell);
int intersectionOk = prevCell.firstIntersectionPoint(rayToThisCell, &outOfPrevCell);
//CVF_ASSERT(intersectionOk);
//CVF_ASSERT(intersectionOk);
prevCell.firstIntersectionPoint(rayToThisCell, &outOfPrevCell);
if ((currentPoint - outOfPrevCell).lengthSquared() > 1e-3)
{
branchCLCoords.push_back(outOfPrevCell);
@ -309,9 +307,7 @@ void RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineFromWellF
cvf::Vec3d outOfPrevCell(centerPreviousCell);
const RigCell& prevCell = eclipseCaseData->cellFromWellResultCell(*prevWellResPoint);
bool intersectionOk = prevCell.firstIntersectionPoint(rayToThisCell, &outOfPrevCell);
//CVF_ASSERT(intersectionOk);
//CVF_ASSERT(intersectionOk);
prevCell.firstIntersectionPoint(rayToThisCell, &outOfPrevCell);
if ((intoThisCell - outOfPrevCell).lengthSquared() > 1e-3)
{
branchCLCoords.push_back(outOfPrevCell);

View File

@ -33,7 +33,7 @@
class RigSimulationWellCoordsAndMD
{
public:
RigSimulationWellCoordsAndMD(const std::vector<cvf::Vec3d>& wellPathPoints);
explicit RigSimulationWellCoordsAndMD(const std::vector<cvf::Vec3d>& wellPathPoints);
const std::vector<cvf::Vec3d>& wellPathPoints() const;
const std::vector<double>& measuredDepths() const;

View File

@ -27,7 +27,7 @@ class RifReaderEclipseSummary;
class RigSummaryCaseData: public cvf::Object
{
public:
RigSummaryCaseData(const QString& summaryHeaderFileName );
explicit RigSummaryCaseData(const QString& summaryHeaderFileName );
~RigSummaryCaseData();

View File

@ -186,14 +186,13 @@ cvf::ref<RigWellLogCurveData> RigWellLogCurveData::calculateResampledCurveData(d
bool isTvDepthsAvailable = false;
std::vector<double> tvDepths;
size_t segmentStartIdx = 0;
if (m_tvDepths.size() > 0) isTvDepthsAvailable = true;
if(m_measuredDepths.size() > 0)
{
double currentMd = m_measuredDepths[0];
size_t segmentStartIdx = 0;
while(segmentStartIdx < m_measuredDepths.size() - 1)
{
double segmentStartMd = m_measuredDepths[segmentStartIdx];

View File

@ -245,14 +245,12 @@ bool GeometryTools::calculateOverlapPolygonOfTwoQuads(std::vector<IndexType> * p
for (cv1Idx = 0 ; cv1Idx < 4 ; ++cv1Idx)
{
bool found = false;
for (cv2Idx = 0; cv2Idx < 4; ++cv2Idx)
{
if (cv1CubeFaceIndices[cv1Idx] == cv2CubeFaceIndices[cv2Idx])
{
cv1VxTouchCv2[cv1Idx] = true;
cv2VxTouchCv1[cv2Idx] = true;
found = true;
++numMatchedNodes;
continue;
}

View File

@ -33,7 +33,7 @@
class RigStatisticsDataCache : public cvf::Object
{
public:
RigStatisticsDataCache(RigStatisticsCalculator* statisticsCalculator);
explicit RigStatisticsDataCache(RigStatisticsCalculator* statisticsCalculator);
void clearAllStatistics();