diff --git a/ApplicationCode/CommandFileInterface/RicfExportLgrForCompletions.cpp b/ApplicationCode/CommandFileInterface/RicfExportLgrForCompletions.cpp index af263d44bb..075237d077 100644 --- a/ApplicationCode/CommandFileInterface/RicfExportLgrForCompletions.cpp +++ b/ApplicationCode/CommandFileInterface/RicfExportLgrForCompletions.cpp @@ -36,6 +36,7 @@ #include "RiaLogging.h" #include "RiaWellNameComparer.h" +#include #include "cafCmdFeatureManager.h" @@ -91,7 +92,7 @@ void RicfExportLgrForCompletions::execute() } caf::VecIjk lgrCellCounts(m_refinementI, m_refinementJ, m_refinementK); - bool intersectingOtherLgrs = false; + QStringList wellsWithIntersectingLgrs; for (const auto wellPath : wellPaths) { if (wellPath) @@ -100,13 +101,14 @@ void RicfExportLgrForCompletions::execute() feature->exportLgrsForWellPath(exportFolder, wellPath, eclipseCase, m_timeStep, lgrCellCounts, m_splitType(), {RigCompletionData::PERFORATION, RigCompletionData::FRACTURE, RigCompletionData::FISHBONES}, &intersectingLgrs); - if (intersectingLgrs) intersectingOtherLgrs = true; + if (intersectingLgrs) wellsWithIntersectingLgrs.push_back(wellPath->name()); } } - if (intersectingOtherLgrs) + if (!wellsWithIntersectingLgrs.empty()) { - RiaLogging::error("exportLgrForCompletions: At least one completion intersects with an LGR. No output for those completions produced"); + auto wellsList = wellsWithIntersectingLgrs.join(", "); + RiaLogging::error("exportLgrForCompletions: No export for some wells due to existing intersecting LGR(s).Affected wells : " + wellsList); } } } diff --git a/ApplicationCode/Commands/ExportCommands/RicExportLgrFeature.cpp b/ApplicationCode/Commands/ExportCommands/RicExportLgrFeature.cpp index 66139ae9bb..4c0fef5575 100644 --- a/ApplicationCode/Commands/ExportCommands/RicExportLgrFeature.cpp +++ b/ApplicationCode/Commands/ExportCommands/RicExportLgrFeature.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -270,15 +271,18 @@ void RicExportLgrFeature::exportLgrsForWellPath(const QString& export completionTypes, intersectingOtherLgrs); - // Export - QFile file; - QString fileName = caf::Utils::makeValidFileBasename(QString("LGR_%1").arg(wellPath->name())) + ".dat"; - openFileForExport(exportFolder, fileName, &file); - QTextStream stream(&file); - stream.setRealNumberNotation(QTextStream::FixedNotation); - stream.setRealNumberPrecision(2); - exportLgrs(stream, lgrs); - file.close(); + if (!*intersectingOtherLgrs) + { + // Export + QFile file; + QString fileName = caf::Utils::makeValidFileBasename(QString("LGR_%1").arg(wellPath->name())) + ".dat"; + openFileForExport(exportFolder, fileName, &file); + QTextStream stream(&file); + stream.setRealNumberNotation(QTextStream::FixedNotation); + stream.setRealNumberPrecision(2); + exportLgrs(stream, lgrs); + file.close(); + } } //-------------------------------------------------------------------------------------------------- @@ -509,7 +513,7 @@ void RicExportLgrFeature::onActionTriggered(bool isChecked) auto lgrCellCounts = dialogData->lgrCellCount(); size_t timeStep = dialogData->timeStep(); - bool intersectingOtherLgrs = false; + QStringList wellsWithIntersectingLgrs; for (const auto& wellPath : wellPaths) { bool intersectingLgrs = false; @@ -522,14 +526,15 @@ void RicExportLgrFeature::onActionTriggered(bool isChecked) dialogData->completionTypes(), &intersectingLgrs); - if (intersectingLgrs) intersectingOtherLgrs = true; + if (intersectingLgrs) wellsWithIntersectingLgrs.push_back(wellPath->name()); } - if (intersectingOtherLgrs) + if (!wellsWithIntersectingLgrs.empty()) { + auto wellsList = wellsWithIntersectingLgrs.join(", "); QMessageBox::warning(nullptr, "LGR cells intersected", - "At least one completion intersects with an LGR. No output for those completions produced"); + "No export for some wells due to existing intersecting LGR(s). Affected wells: " + wellsList); } } }