mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-10 23:46:00 -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);
|
||||
QStringList wellsWithIntersectingLgrs;
|
||||
|
||||
feature->resetLgrNaming();
|
||||
for (const auto wellPath : wellPaths)
|
||||
{
|
||||
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
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -364,7 +379,7 @@ std::vector<LgrInfo> RicExportLgrFeature::buildLgrsForWellPath(RimWellPath*
|
||||
auto intersectingCells = cellsIntersectingCompletions(eclipseCase, wellPath, timeStep, completionTypes, intersectingOtherLgrs);
|
||||
|
||||
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));
|
||||
}
|
||||
return lgrs;
|
||||
@ -383,7 +398,7 @@ std::vector<LgrInfo> RicExportLgrFeature::buildLgrsPerMainCell(RimEclipseCase*
|
||||
int lgrId = firstAvailableLgrId(eclipseCase->mainGrid());
|
||||
for (const auto& intersectionCell : intersectingCells)
|
||||
{
|
||||
auto lgrName = createLgrName("", lgrId);
|
||||
auto lgrName = lgrNameFactory.newName("", lgrId);
|
||||
lgrs.push_back(buildLgr(lgrId++, lgrName, eclipseCase, wellPath, {intersectionCell}, lgrSizes));
|
||||
}
|
||||
return lgrs;
|
||||
@ -399,17 +414,11 @@ std::vector<LgrInfo> RicExportLgrFeature::buildLgrsPerCompletion(
|
||||
const caf::VecIjk& lgrSizesPerMainGridCell)
|
||||
{
|
||||
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());
|
||||
for (auto complInfo : completionInfo)
|
||||
{
|
||||
auto& typeName = namesAndCounters[complInfo.first.type].first;
|
||||
auto& typeCounter = namesAndCounters[complInfo.first.type].second;
|
||||
auto lgrName = createLgrName(typeName, typeCounter++);
|
||||
auto lgrName = lgrNameFactory.newName(complInfo.first.type);
|
||||
lgrs.push_back(buildLgr(lgrId++, lgrName, eclipseCase, wellPath, complInfo.second, lgrSizesPerMainGridCell));
|
||||
}
|
||||
return lgrs;
|
||||
@ -798,6 +807,14 @@ std::map<QString /*wellName*/, std::vector<LgrInfo>> RicExportLgrFeature::create
|
||||
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;
|
||||
if(baseName.isEmpty()) lgrName = "LGR_";
|
||||
lgrName += baseName + "_" + QString::number(number + 1);
|
||||
lgrName += baseName + "_" + QString::number(number);
|
||||
return lgrName.replace(" ", "_");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void LgrNameFactory::resetNumbering()
|
||||
{
|
||||
for (auto& counter : m_counters)
|
||||
{
|
||||
counter.second.second = 1;
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,10 @@ class RimWellPath;
|
||||
class QFile;
|
||||
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 void resetLgrNaming();
|
||||
|
||||
protected:
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered(bool isChecked) override;
|
||||
@ -198,5 +204,4 @@ private:
|
||||
bool* isIntersectingOtherLgrs);
|
||||
|
||||
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);
|
||||
|
||||
RicExportLgrFeature::resetLgrNaming();
|
||||
bool intersectingOtherLgrs = false;
|
||||
for (const auto& wellPath : wellPaths)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user