Merge pull request #4350 from OPM/cpp-check-cleanup

Cpp check cleanup
This commit is contained in:
Magne Sjaastad
2019-04-24 09:09:18 +02:00
committed by GitHub
71 changed files with 132 additions and 769 deletions

View File

@@ -116,7 +116,6 @@ public:
LgrNameFactory();
QString newName(RigCompletionData::CompletionType completionType);
QString newName(const QString& baseName, int number);
void resetNumbering();
private:
std::map<RigCompletionData::CompletionType, std::pair<QString, int>> m_counters;
@@ -678,189 +677,6 @@ RicExportLgrFeature::cellsIntersectingCompletions(RimEclipseCase* eclipseCase,
return cells;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RigCompletionDataGridCell> cellsIntersectingCompletion(const std::map<RigCompletionDataGridCell, std::vector<RigCompletionData>>& allCells,
caf::PdmObject* sourcePdmObject)
{
std::vector<RigCompletionDataGridCell> cells;
for (const auto& intInfo : allCells)
{
for (const auto& completion : intInfo.second)
{
if (completion.sourcePdmObject() == sourcePdmObject) cells.push_back(intInfo.first);
}
}
return cells;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::pair<RigCompletionDataGridCell, std::vector<RigCompletionData>>>
createOrderedIntersectionList(const std::vector<WellPathCellIntersectionInfo>& allWellPathCells,
const std::map<RigCompletionDataGridCell, std::vector<RigCompletionData>>& completionCells)
{
// All cell indices intersecting a completion and lookup into map
std::set<size_t> complCellIndices;
std::map<size_t, RigCompletionDataGridCell> complCellLookup;
std::set<CellInfo> cellsOnWellPath;
std::vector<std::pair<bool, CellInfo>> cellsNotOnWellPath;
{
for (const auto& complCell : completionCells)
{
complCellIndices.insert(complCell.first.globalCellIndex());
complCellLookup.insert({complCell.first.globalCellIndex(), complCell.first});
bool cellFoundOnWellPath = false;
for (const auto& wellPathCell : allWellPathCells)
{
if (complCell.first.globalCellIndex() == wellPathCell.globCellIndex)
{
cellsOnWellPath.insert(CellInfo(complCell.first.globalCellIndex(), wellPathCell.startMD, wellPathCell.endMD));
cellFoundOnWellPath = true;
break;
}
}
if (!cellFoundOnWellPath)
{
cellsNotOnWellPath.emplace_back( true, CellInfo(complCell.first.globalCellIndex()) );
}
}
}
std::set<size_t> cellsTaken;
std::vector<std::pair<RigCompletionDataGridCell, std::vector<RigCompletionData>>> result;
// Walk along well path
for (const auto& cellOnWellPath : cellsOnWellPath)
{
// Add cell on well path first
auto complDataGridCell = complCellLookup.at(cellOnWellPath.globCellIndex);
auto complDataList = completionCells.at(complDataGridCell);
result.emplace_back(complDataGridCell, complDataList);
// Check intersected completions in current cell
RigCompletionData::CompletionType complTypes[] = { RigCompletionData::FRACTURE, RigCompletionData::FISHBONES, RigCompletionData::PERFORATION };
for (auto complType : complTypes)
{
const caf::PdmObject* completion = nullptr;
for (const auto& complData : complDataList)
{
if (complData.completionType() == complType)
{
completion = complData.sourcePdmObject();
break;
}
}
if (completion)
{
// Add all cells intersecting this completion
for (auto& cellNotOnWellPath : cellsNotOnWellPath)
{
if (!cellNotOnWellPath.first) continue;
auto complDataList2 = completionCells.at(complCellLookup.at(cellNotOnWellPath.second.globCellIndex));
auto itr = std::find_if(complDataList2.begin(), complDataList2.end(),
[&completion](const RigCompletionData& cd) { return cd.sourcePdmObject() == completion; });
if (itr != complDataList2.end())
{
result.emplace_back( complCellLookup.at(cellNotOnWellPath.second.globCellIndex), complDataList2);
cellNotOnWellPath.first = false;
}
}
}
}
}
return result;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
//std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>>
// RicExportLgrFeature::cellsIntersectingCompletions_PerCompletion_old(RimEclipseCase* eclipseCase,
// const RimWellPath* wellPath,
// size_t timeStep,
// const std::set<RigCompletionData::CompletionType>& completionTypes,
// bool* isIntersectingOtherLgrs)
//{
// std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>> completionToCells;
//
// *isIntersectingOtherLgrs = false;
//
// auto wellPathGeometry = wellPath->wellPathGeometry();
// auto completions = eclipseCase->computeAndGetVirtualPerforationTransmissibilities();
// if (wellPathGeometry && completions)
// {
// const auto& intCells = completions->multipleCompletionsPerEclipseCell(wellPath, timeStep);
// CompletionInfo lastCompletionInfo;
//
// auto wpIntCells = RigWellPathIntersectionTools::findCellIntersectionInfosAlongPath(eclipseCase->eclipseCaseData(),
// wellPathGeometry->wellPathPoints(),
// wellPathGeometry->measureDepths());
//
// auto wpComplCells = createOrderedIntersectionList(wpIntCells, intCells);
//
// // This loop assumes that cells are ordered downwards along well path
// for (auto intCell : wpComplCells)
// {
// if (!intCell.first.isMainGridCell())
// {
// *isIntersectingOtherLgrs = true;
// continue;
// }
//
// auto filteredCompletions = filterCompletionsOnType(intCell.second, completionTypes);
// if (filteredCompletions.empty()) continue;
//
// auto completion = findCompletionByPriority(filteredCompletions);
//
// QString name = completionName(completion.sourcePdmObject());
// CompletionInfo completionInfo(completion.completionType(), name, 0);
//
// if (!lastCompletionInfo.isValid()) lastCompletionInfo = completionInfo;
//
// if (completionInfo != lastCompletionInfo && completionToCells.count(completionInfo) > 0)
// {
// completionInfo.number++;
// }
// completionToCells[completionInfo].push_back(intCell.first);
// lastCompletionInfo = completionInfo;
// }
// }
// return completionToCells;
//}
template<typename T>
void appendVector(std::vector<T>& dest, const std::vector<T>& append)
{
dest.insert(dest.end(), append.begin(), append.end());
}
void appendIntersectedCells(std::map<RigCompletionDataGridCell, std::vector<RigCompletionData>>& dest,
const std::map<RigCompletionDataGridCell, std::vector<RigCompletionData>>& append)
{
for (auto& intCell : append)
{
if (dest.count(intCell.first) == 0)
{
dest.insert(intCell);
}
else
{
appendVector(dest[intCell.first], intCell.second);
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1123,13 +939,3 @@ QString LgrNameFactory::newName(const QString& baseName, int number)
return lgrName.replace(" ", "_");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void LgrNameFactory::resetNumbering()
{
for (auto& counter : m_counters)
{
counter.second.second = 1;
}
}

View File

@@ -213,12 +213,6 @@ private:
size_t timeStep,
const std::set<RigCompletionData::CompletionType>& completionTypes,
bool* isIntersectingOtherLgrs);
//static std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>>
// cellsIntersectingCompletions_PerCompletion_old(RimEclipseCase* eclipseCase,
// const RimWellPath* wellPath,
// size_t timeStep,
// const std::set<RigCompletionData::CompletionType>& completionTypes,
// bool* isIntersectingOtherLgrs);
static std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>>
cellsIntersectingCompletions_PerCompletion(RimEclipseCase* eclipseCase,

View File

@@ -109,7 +109,7 @@ void RicCreateMultipleFracturesOptionItemUi::fieldChangedByUi(const caf::PdmFiel
{
if (m_topKOneBased > m_baseKOneBased) m_baseKOneBased = m_topKOneBased;
}
else if (changedField = &m_baseKOneBased)
else if (changedField == &m_baseKOneBased)
{
if (m_baseKOneBased < m_topKOneBased) m_topKOneBased = m_baseKOneBased;
}

View File

@@ -22,7 +22,6 @@
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "RiaQIconTools.h"
#include "RimGridView.h"

View File

@@ -20,8 +20,6 @@
#include "RicHoloLensSessionManager.h"
#include "RiaQIconTools.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicHoloLensCreateDummyFiledBackedSessionFeature, "RicHoloLensCreateDummyFiledBackedSessionFeature");

View File

@@ -18,8 +18,6 @@
#include "RicHoloLensCreateSessionFeature.h"
#include "RiaQIconTools.h"
#include "RicHoloLensCreateSessionUi.h"
#include "RicHoloLensServerSettings.h"
#include "RicHoloLensSessionManager.h"

View File

@@ -21,7 +21,6 @@
#include "RicHoloLensSession.h"
#include "RiaApplication.h"
#include "RiaQIconTools.h"
#include "RiaLogging.h"
#include "RimGridView.h"

View File

@@ -22,7 +22,6 @@
#include "RicHoloLensSessionManager.h"
#include "RiaLogging.h"
#include "RiaQIconTools.h"
#include "cafCmdFeatureManager.h"

View File

@@ -344,12 +344,3 @@ void RicCreateTemporaryLgrFeature::computeCachedData(RimEclipseCase* eclipseCase
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicCreateTemporaryLgrFeature::containsAnyNonMainGridCells(const std::vector<RigCompletionDataGridCell>& cells)
{
return std::find_if(cells.begin(), cells.end(), [](const RigCompletionDataGridCell& cell) {
return !cell.isMainGridCell();
}) != cells.end();
}

View File

@@ -65,5 +65,4 @@ private:
void createLgr(const LgrInfo& lgrInfo, RigMainGrid* mainGrid);
void computeCachedData(RimEclipseCase* eclipseCase);
void deleteAllCachedData(RimEclipseCase* eclipseCase);
bool containsAnyNonMainGridCells(const std::vector<RigCompletionDataGridCell>& cells);
};