mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-11 07:56:08 -06:00
#3645 Temp LGR. Fix LGR name clash
This commit is contained in:
parent
41a82ecdf3
commit
c122a14bb2
@ -95,6 +95,8 @@ void RicfExportLgrForCompletions::execute()
|
|||||||
|
|
||||||
caf::VecIjk lgrCellCounts(m_refinementI, m_refinementJ, m_refinementK);
|
caf::VecIjk lgrCellCounts(m_refinementI, m_refinementJ, m_refinementK);
|
||||||
QStringList wellsWithIntersectingLgrs;
|
QStringList wellsWithIntersectingLgrs;
|
||||||
|
|
||||||
|
feature->resetLgrNaming();
|
||||||
for (const auto wellPath : wellPaths)
|
for (const auto wellPath : wellPaths)
|
||||||
{
|
{
|
||||||
if (wellPath)
|
if (wellPath)
|
||||||
|
@ -107,6 +107,21 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class LgrNameFactory
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
} lgrNameFactory;
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
// Internal function
|
// Internal function
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -364,7 +379,7 @@ std::vector<LgrInfo> RicExportLgrFeature::buildLgrsForWellPath(RimWellPath*
|
|||||||
auto intersectingCells = cellsIntersectingCompletions(eclipseCase, wellPath, timeStep, completionTypes, intersectingOtherLgrs);
|
auto intersectingCells = cellsIntersectingCompletions(eclipseCase, wellPath, timeStep, completionTypes, intersectingOtherLgrs);
|
||||||
|
|
||||||
int lgrId = firstAvailableLgrId(eclipseCase->mainGrid());
|
int lgrId = firstAvailableLgrId(eclipseCase->mainGrid());
|
||||||
auto lgrName = createLgrName("WELL", lgrId);
|
auto lgrName = lgrNameFactory.newName("WELL", lgrId);
|
||||||
lgrs.push_back(buildLgr(lgrId, lgrName, eclipseCase, wellPath, intersectingCells, lgrCellCounts));
|
lgrs.push_back(buildLgr(lgrId, lgrName, eclipseCase, wellPath, intersectingCells, lgrCellCounts));
|
||||||
}
|
}
|
||||||
return lgrs;
|
return lgrs;
|
||||||
@ -383,7 +398,7 @@ std::vector<LgrInfo> RicExportLgrFeature::buildLgrsPerMainCell(RimEclipseCase*
|
|||||||
int lgrId = firstAvailableLgrId(eclipseCase->mainGrid());
|
int lgrId = firstAvailableLgrId(eclipseCase->mainGrid());
|
||||||
for (const auto& intersectionCell : intersectingCells)
|
for (const auto& intersectionCell : intersectingCells)
|
||||||
{
|
{
|
||||||
auto lgrName = createLgrName("", lgrId);
|
auto lgrName = lgrNameFactory.newName("", lgrId);
|
||||||
lgrs.push_back(buildLgr(lgrId++, lgrName, eclipseCase, wellPath, {intersectionCell}, lgrSizes));
|
lgrs.push_back(buildLgr(lgrId++, lgrName, eclipseCase, wellPath, {intersectionCell}, lgrSizes));
|
||||||
}
|
}
|
||||||
return lgrs;
|
return lgrs;
|
||||||
@ -399,17 +414,11 @@ std::vector<LgrInfo> RicExportLgrFeature::buildLgrsPerCompletion(
|
|||||||
const caf::VecIjk& lgrSizesPerMainGridCell)
|
const caf::VecIjk& lgrSizesPerMainGridCell)
|
||||||
{
|
{
|
||||||
std::vector<LgrInfo> lgrs;
|
std::vector<LgrInfo> lgrs;
|
||||||
std::map<RigCompletionData::CompletionType, std::pair<QString, int>> namesAndCounters =
|
|
||||||
{
|
|
||||||
{RigCompletionData::FRACTURE, {"FRAC", 0}}, {RigCompletionData::FISHBONES, {"FB", 0}}, {RigCompletionData::PERFORATION, {"PERF", 0}}
|
|
||||||
};
|
|
||||||
|
|
||||||
int lgrId = firstAvailableLgrId(eclipseCase->mainGrid());
|
int lgrId = firstAvailableLgrId(eclipseCase->mainGrid());
|
||||||
for (auto complInfo : completionInfo)
|
for (auto complInfo : completionInfo)
|
||||||
{
|
{
|
||||||
auto& typeName = namesAndCounters[complInfo.first.type].first;
|
auto lgrName = lgrNameFactory.newName(complInfo.first.type);
|
||||||
auto& typeCounter = namesAndCounters[complInfo.first.type].second;
|
|
||||||
auto lgrName = createLgrName(typeName, typeCounter++);
|
|
||||||
lgrs.push_back(buildLgr(lgrId++, lgrName, eclipseCase, wellPath, complInfo.second, lgrSizesPerMainGridCell));
|
lgrs.push_back(buildLgr(lgrId++, lgrName, eclipseCase, wellPath, complInfo.second, lgrSizesPerMainGridCell));
|
||||||
}
|
}
|
||||||
return lgrs;
|
return lgrs;
|
||||||
@ -798,6 +807,14 @@ std::map<QString /*wellName*/, std::vector<LgrInfo>> RicExportLgrFeature::create
|
|||||||
return lgrInfosPerWell;
|
return lgrInfosPerWell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicExportLgrFeature::resetLgrNaming()
|
||||||
|
{
|
||||||
|
lgrNameFactory.resetNumbering();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -815,11 +832,54 @@ int RicExportLgrFeature::firstAvailableLgrId(const RigMainGrid* mainGrid)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QString RicExportLgrFeature::createLgrName(const QString& baseName, int number)
|
LgrNameFactory::LgrNameFactory()
|
||||||
|
{
|
||||||
|
m_counters = {
|
||||||
|
{RigCompletionData::FRACTURE, {"FRAC", 1}},
|
||||||
|
{RigCompletionData::FISHBONES, {"FB", 1}},
|
||||||
|
{RigCompletionData::PERFORATION, {"PERF", 1}}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString LgrNameFactory::newName(RigCompletionData::CompletionType completionType)
|
||||||
|
{
|
||||||
|
switch (completionType)
|
||||||
|
{
|
||||||
|
case RigCompletionData::FRACTURE:
|
||||||
|
case RigCompletionData::FISHBONES:
|
||||||
|
case RigCompletionData::PERFORATION:
|
||||||
|
{
|
||||||
|
auto& counter = m_counters[completionType];
|
||||||
|
QString name = counter.first + "_" + QString::number(counter.second);
|
||||||
|
counter.second++;
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return "Unknown type";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString LgrNameFactory::newName(const QString& baseName, int number)
|
||||||
{
|
{
|
||||||
QString lgrName;
|
QString lgrName;
|
||||||
if(baseName.isEmpty()) lgrName = "LGR_";
|
if(baseName.isEmpty()) lgrName = "LGR_";
|
||||||
lgrName += baseName + "_" + QString::number(number + 1);
|
lgrName += baseName + "_" + QString::number(number);
|
||||||
return lgrName.replace(" ", "_");
|
return lgrName.replace(" ", "_");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void LgrNameFactory::resetNumbering()
|
||||||
|
{
|
||||||
|
for (auto& counter : m_counters)
|
||||||
|
{
|
||||||
|
counter.second.second = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -36,6 +36,10 @@ class RimWellPath;
|
|||||||
class QFile;
|
class QFile;
|
||||||
class QTextStream;
|
class QTextStream;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
/// Candidate for refactoring
|
||||||
|
//==================================================================================================
|
||||||
|
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
@ -161,6 +165,8 @@ class RicExportLgrFeature : public caf::CmdFeature
|
|||||||
|
|
||||||
static std::map<QString /*wellName*/, std::vector<LgrInfo>> createLgrInfoListForTemporaryLgrs(const RigMainGrid* mainGrid);
|
static std::map<QString /*wellName*/, std::vector<LgrInfo>> createLgrInfoListForTemporaryLgrs(const RigMainGrid* mainGrid);
|
||||||
|
|
||||||
|
static void resetLgrNaming();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool isCommandEnabled() override;
|
bool isCommandEnabled() override;
|
||||||
void onActionTriggered(bool isChecked) override;
|
void onActionTriggered(bool isChecked) override;
|
||||||
@ -198,5 +204,4 @@ private:
|
|||||||
bool* isIntersectingOtherLgrs);
|
bool* isIntersectingOtherLgrs);
|
||||||
|
|
||||||
static int firstAvailableLgrId(const RigMainGrid* mainGrid);
|
static int firstAvailableLgrId(const RigMainGrid* mainGrid);
|
||||||
static QString createLgrName(const QString& baseName, int number);
|
|
||||||
};
|
};
|
||||||
|
@ -174,6 +174,7 @@ void RicCreateTemporaryLgrFeature::onActionTriggered(bool isChecked)
|
|||||||
|
|
||||||
RicDeleteTemporaryLgrsFeature::deleteAllTemporaryLgrs(eclipseCase);
|
RicDeleteTemporaryLgrsFeature::deleteAllTemporaryLgrs(eclipseCase);
|
||||||
|
|
||||||
|
RicExportLgrFeature::resetLgrNaming();
|
||||||
bool intersectingOtherLgrs = false;
|
bool intersectingOtherLgrs = false;
|
||||||
for (const auto& wellPath : wellPaths)
|
for (const auto& wellPath : wellPaths)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user