From 923fc9815a9da4eb1362872f1b89771bf823f88c Mon Sep 17 00:00:00 2001 From: Gaute Lindkvist Date: Wed, 9 May 2018 08:42:11 +0200 Subject: [PATCH] #2713 Implement viewName parameter for RicfExportSimWellFractureCompletions. * View names are not unique! * This change will export fracture completions for *all* views that matches the view name. --- .../RicfExportSimWellFractureCompletions.cpp | 43 +++++++++++-------- .../RicfExportSimWellFractureCompletions.h | 2 +- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/ApplicationCode/CommandFileInterface/RicfExportSimWellFractureCompletions.cpp b/ApplicationCode/CommandFileInterface/RicfExportSimWellFractureCompletions.cpp index e841fb196f..1fa44efdda 100644 --- a/ApplicationCode/CommandFileInterface/RicfExportSimWellFractureCompletions.cpp +++ b/ApplicationCode/CommandFileInterface/RicfExportSimWellFractureCompletions.cpp @@ -44,7 +44,8 @@ CAF_PDM_SOURCE_INIT(RicfExportSimWellFractureCompletions, "exportSimWellFracture //-------------------------------------------------------------------------------------------------- RicfExportSimWellFractureCompletions::RicfExportSimWellFractureCompletions() { - RICF_InitField(&m_caseId, "case", -1, "Case ID", "", "", ""); + RICF_InitField(&m_caseId, "caseId", -1, "Case ID", "", "", ""); + RICF_InitField(&m_viewName, "viewName", QString(""), "View Name", "", "", ""); RICF_InitField(&m_timeStep, "timeStep", -1, "Time Step Index", "", "", ""); RICF_InitField(&m_simWellNames, "simulationWellNames", std::vector(), "Simulation Well Names", "", "", ""); RICF_InitField(&m_fileSplit, "fileSplit", RicExportCompletionDataSettingsUi::ExportSplitType(), "File Split", "", "", ""); @@ -88,38 +89,46 @@ void RicfExportSimWellFractureCompletions::execute() } exportSettings->folder = exportFolder; - // FIXME : Select correct view? - RimEclipseView* view; + std::vector views; for (Rim3dView* v : exportSettings->caseToApply->views()) { - view = dynamic_cast(v); - if (view) break; + RimEclipseView* eclipseView = dynamic_cast(v); + if (eclipseView && eclipseView->name() == m_viewName()) + { + views.push_back(eclipseView); + } } - if (!view) + if (views.empty()) { - RiaLogging::error(QString("exportSimWellCompletions: Could not find a view for case with ID %1").arg(m_caseId())); + RiaLogging::error(QString("exportSimWellCompletions: Could not find any views named \"%1\" in the case with ID %2").arg(m_viewName).arg(m_caseId())); return; } std::vector simWells; if (m_simWellNames().empty()) { - std::copy(view->wellCollection()->wells.begin(), - view->wellCollection()->wells.end(), - std::back_inserter(simWells)); + for (RimEclipseView* view : views) + { + std::copy(view->wellCollection()->wells.begin(), + view->wellCollection()->wells.end(), + std::back_inserter(simWells)); + } } else { for (const QString& wellPathName : m_simWellNames()) { - RimSimWellInView* simWell = view->wellCollection()->findWell(wellPathName); - if (simWell) + for (RimEclipseView* view : views) { - simWells.push_back(simWell); - } - else - { - RiaLogging::warning(QString("exportSimWellCompletions: Could not find well with name %1 on case with ID %2").arg(wellPathName).arg(m_caseId())); + RimSimWellInView* simWell = view->wellCollection()->findWell(wellPathName); + if (simWell) + { + simWells.push_back(simWell); + } + else + { + RiaLogging::warning(QString("exportSimWellCompletions: Could not find well with name %1 in view \"%2\" on case with ID %2").arg(wellPathName).arg(m_viewName).arg(m_caseId())); + } } } } diff --git a/ApplicationCode/CommandFileInterface/RicfExportSimWellFractureCompletions.h b/ApplicationCode/CommandFileInterface/RicfExportSimWellFractureCompletions.h index fff7f75bae..98bfb9fb0d 100644 --- a/ApplicationCode/CommandFileInterface/RicfExportSimWellFractureCompletions.h +++ b/ApplicationCode/CommandFileInterface/RicfExportSimWellFractureCompletions.h @@ -41,8 +41,8 @@ public: private: caf::PdmField m_caseId; + caf::PdmField m_viewName; caf::PdmField m_timeStep; - caf::PdmField< std::vector > m_simWellNames; caf::PdmField m_fileSplit;