From 95aaa3538353c1246fcfbeb5db6a3b4b58484c3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Jensen?= Date: Wed, 7 Nov 2018 09:48:42 +0100 Subject: [PATCH] #3608 Temp LGR. Use short name in export due to Eclipse limitations --- .../ExportCommands/RicExportLgrFeature.cpp | 32 +++++++++++++++---- .../ExportCommands/RicExportLgrFeature.h | 8 +++-- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/ApplicationCode/Commands/ExportCommands/RicExportLgrFeature.cpp b/ApplicationCode/Commands/ExportCommands/RicExportLgrFeature.cpp index 0d1c2c76f4..b341d70ee2 100644 --- a/ApplicationCode/Commands/ExportCommands/RicExportLgrFeature.cpp +++ b/ApplicationCode/Commands/ExportCommands/RicExportLgrFeature.cpp @@ -257,6 +257,7 @@ void RicExportLgrFeature::exportLgrs(QTextStream& stream, const std::vector RicExportLgrFeature::buildLgrsForWellPath(RimWellPath* int lgrId = firstAvailableLgrId(eclipseCase->mainGrid()); auto lgrName = createLgrName("", lgrId); - lgrs.push_back(buildLgr(lgrId, lgrName, eclipseCase, intersectingCells, lgrCellCounts)); + lgrs.push_back(buildLgr(lgrId, lgrName, lgrName, eclipseCase, intersectingCells, lgrCellCounts)); } return lgrs; } @@ -374,7 +375,7 @@ std::vector RicExportLgrFeature::buildLgrsPerMainCell(RimEclipseCase* for (auto intersectionCell : intersectingCells) { auto lgrName = createLgrName("", lgrId); - lgrs.push_back(buildLgr(lgrId++, lgrName, eclipseCase, {intersectionCell}, lgrSizes)); + lgrs.push_back(buildLgr(lgrId++, lgrName, lgrName, eclipseCase, {intersectionCell}, lgrSizes)); } return lgrs; } @@ -388,12 +389,19 @@ std::vector RicExportLgrFeature::buildLgrsPerCompletion( const caf::VecIjk& lgrSizesPerMainGridCell) { std::vector lgrs; + std::map> namesAndCounters = + { + {RigCompletionData::FRACTURE, {"FRAC", 0}}, {RigCompletionData::FISHBONES, {"FB", 0}}, {RigCompletionData::PERFORATION, {"PERF", 0}} + }; int lgrId = firstAvailableLgrId(eclipseCase->mainGrid()); for (auto complInfo : completionInfo) { auto lgrName = createLgrName(complInfo.first.name, complInfo.first.number); - lgrs.push_back(buildLgr(lgrId++, lgrName, eclipseCase, complInfo.second, lgrSizesPerMainGridCell)); + auto& typeName = namesAndCounters[complInfo.first.type].first; + auto& typeCounter = namesAndCounters[complInfo.first.type].second; + auto lgrShortName = createShortLgrName(typeName, typeCounter++); + lgrs.push_back(buildLgr(lgrId++, lgrName, lgrShortName, eclipseCase, complInfo.second, lgrSizesPerMainGridCell)); } return lgrs; } @@ -403,6 +411,7 @@ std::vector RicExportLgrFeature::buildLgrsPerCompletion( //-------------------------------------------------------------------------------------------------- LgrInfo RicExportLgrFeature::buildLgr(int lgrId, const QString& lgrName, + const QString& shortLgrName, RimEclipseCase* eclipseCase, const std::vector& intersectingCells, const caf::VecIjk& lgrSizesPerMainGridCell) @@ -430,7 +439,7 @@ LgrInfo RicExportLgrFeature::buildLgr(int caf::VecIjk mainGridStartCell(iRange.first, jRange.first, kRange.first); caf::VecIjk mainGridEndCell(iRange.second, jRange.second, kRange.second); - return LgrInfo(lgrId, lgrName, lgrSizes, mainGridStartCell, mainGridEndCell); + return LgrInfo(lgrId, lgrName, shortLgrName, lgrSizes, mainGridStartCell, mainGridEndCell); } //-------------------------------------------------------------------------------------------------- @@ -737,7 +746,7 @@ int RicExportLgrFeature::firstAvailableLgrId(const RigMainGrid* mainGrid) //-------------------------------------------------------------------------------------------------- QString RicExportLgrFeature::createLgrName(const QString& baseName, int number) { - QString lgrName = "LGR"; + QString lgrName; if (!baseName.isEmpty()) { @@ -750,3 +759,12 @@ QString RicExportLgrFeature::createLgrName(const QString& baseName, int number) return lgrName.replace(" ", "_"); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RicExportLgrFeature::createShortLgrName(const QString& baseName, int number) +{ + QString lgrName = baseName + "_" + QString::number(number + 1); + return lgrName.replace(" ", "_"); +} + diff --git a/ApplicationCode/Commands/ExportCommands/RicExportLgrFeature.h b/ApplicationCode/Commands/ExportCommands/RicExportLgrFeature.h index ebb6c7a432..c32e4540f3 100644 --- a/ApplicationCode/Commands/ExportCommands/RicExportLgrFeature.h +++ b/ApplicationCode/Commands/ExportCommands/RicExportLgrFeature.h @@ -43,11 +43,12 @@ class LgrInfo { public: LgrInfo(int id, - const QString&name, + const QString& name, + const QString& shortName, const caf::VecIjk& sizes, const caf::VecIjk& mainGridStartCell, const caf::VecIjk& mainGridEndCell) - : id(id), name(name), sizes(sizes), mainGridStartCell(mainGridStartCell), mainGridEndCell(mainGridEndCell) + : id(id), name(name), shortName(shortName), sizes(sizes), mainGridStartCell(mainGridStartCell), mainGridEndCell(mainGridEndCell) { } @@ -65,6 +66,7 @@ public: int id; QString name; + QString shortName; caf::VecIjk sizes; caf::VecIjk mainGridStartCell; @@ -168,6 +170,7 @@ private: const caf::VecIjk& lgrSizesPerMainGridCell); static LgrInfo buildLgr(int lgrId, const QString& lgrName, + const QString& shortLgrName, RimEclipseCase* eclipseCase, const std::vector& intersectingCells, const caf::VecIjk& lgrSizesPerMainGridCell); @@ -186,4 +189,5 @@ private: static int firstAvailableLgrId(const RigMainGrid* mainGrid); static QString createLgrName(const QString& baseName, int number = 0); + static QString createShortLgrName(const QString& baseName, int number); };