//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicReloadWellPathFormationNamesFeature::onActionTriggered(bool isChecked) { std::vector<RimWellPath*> wellPaths; caf::SelectionManager::instance()->objectsByType(&wellPaths); std::vector<RimWellPathCollection*> wellPathCollections; caf::SelectionManager::instance()->objectsByType(&wellPathCollections); if (wellPaths.size() > 0) { RimWellPathCollection* wellPathCollection; wellPaths[0]->firstAncestorOrThisOfTypeAsserted(wellPathCollection); wellPathCollection->reloadAllWellPathFormations(); } else if (wellPathCollections.size() > 0) { wellPathCollections[0]->reloadAllWellPathFormations(); } RimProject* project = RiaApplication::instance()->project(); if (project) { if (project->mainPlotCollection()) { project->mainPlotCollection->updatePlotsWithFormations(); } } }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicNewSummaryPlotFeature::onActionTriggered(bool isChecked) { RimProject* project = RiaApplication::instance()->project(); CVF_ASSERT(project); RimMainPlotCollection* mainPlotColl = project->mainPlotCollection(); CVF_ASSERT(mainPlotColl); RimSummaryPlotCollection* summaryPlotColl = mainPlotColl->summaryPlotCollection(); CVF_ASSERT(summaryPlotColl); RimSummaryCase* summaryCase = nullptr; std::vector<RimSummaryCase*> selection; caf::SelectionManager::instance()->objectsByType(&selection); if (selection.size() == 1) { summaryCase = selection[0]; } else { std::vector<RimSummaryCase*> cases; project->allSummaryCases(cases); if (cases.size() > 0) { summaryCase = cases[0]; } } createNewSummaryPlot(summaryPlotColl, summaryCase); }
//-------------------------------------------------------------------------------------------------- /// Clean up existing generated well paths //-------------------------------------------------------------------------------------------------- void RimWellLogExtractionCurve::clearGeneratedSimWellPaths() { RimWellLogPlotCollection* wellLogCollection = nullptr; // Need to use this approach, and not firstAnchestor because the curve might not be inside the hierarchy when deleted. RimProject * proj = RiaApplication::instance()->project(); if (proj && proj->mainPlotCollection() ) wellLogCollection = proj->mainPlotCollection()->wellLogPlotCollection(); if (!wellLogCollection) return; for (auto wellPath : m_wellPathsWithExtractors) { wellLogCollection->removeExtractors(wellPath); } m_wellPathsWithExtractors.clear(); }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- std::vector<RimSaturationPressurePlot*> RicCreateSaturationPressurePlotsFeature::createPlots(RimEclipseResultCase* eclipseResultCase) { std::vector<RimSaturationPressurePlot*> plots; if (!eclipseResultCase) { RiaLogging::error( "RicCreateSaturationPressurePlotsFeature:: No case specified for creation of saturation pressure plots"); return plots; } RimProject* project = RiaApplication::instance()->project(); RimSaturationPressurePlotCollection* collection = project->mainPlotCollection()->saturationPressurePlotCollection(); if (eclipseResultCase && eclipseResultCase->ensureReservoirCaseIsOpen()) { eclipseResultCase->ensureDeckIsParsedForEquilData(); RigEclipseCaseData* eclipseCaseData = eclipseResultCase->eclipseCaseData(); bool requiredInputDataPresent = false; if (!eclipseCaseData->equilData().empty()) { if (eclipseCaseData && eclipseCaseData->results(RiaDefines::MATRIX_MODEL)) { RigCaseCellResultsData* resultData = eclipseCaseData->results(RiaDefines::MATRIX_MODEL); if (resultData->hasResultEntry(RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, "PRESSURE")) && resultData->hasResultEntry(RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, "PDEW")) && resultData->hasResultEntry(RigEclipseResultAddress(RiaDefines::DYNAMIC_NATIVE, "PBUB"))) { requiredInputDataPresent = true; } } } if (requiredInputDataPresent) { plots = collection->createSaturationPressurePlots(eclipseResultCase); for (auto plot : plots) { plot->loadDataAndUpdate(); plot->zoomAll(); plot->updateConnectedEditors(); } } } return plots; }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RimWellPath::~RimWellPath() { if (m_wellLogFile()) { delete m_wellLogFile; } RimProject* project; firstAnchestorOrThisOfType(project); if (project) { if (project->mainPlotCollection()) { RimWellLogPlotCollection* plotCollection = project->mainPlotCollection()->wellLogPlotCollection(); if (plotCollection) { plotCollection->removeExtractors(m_wellPath.p()); } } } }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RimGeoMechCase::~RimGeoMechCase(void) { geoMechViews.deleteAllChildObjects(); RimProject* project = RiaApplication::instance()->project(); if (project) { if (project->mainPlotCollection()) { RimWellLogPlotCollection* plotCollection = project->mainPlotCollection()->wellLogPlotCollection(); if (plotCollection) { plotCollection->removeExtractors(this->geoMechData()); } } } if (this->geoMechData()) { // At this point, we assume that memory should be released CVF_ASSERT(this->geoMechData()->refCount() == 1); } }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicSummaryCurveCreator::createNewPlot() { RimProject* proj = RiaApplication::instance()->project(); RimSummaryPlotCollection* summaryPlotColl = proj->mainPlotCollection()->summaryPlotCollection(); if (summaryPlotColl) { RimSummaryPlot* newSummaryPlot = nullptr; if (m_useAutoPlotTitleProxy()) { newSummaryPlot = summaryPlotColl->createSummaryPlotWithAutoTitle(); } else { QString candidatePlotName; if (m_previewPlot) { candidatePlotName = m_previewPlot->generatedPlotTitleFromAllCurves(); } { bool ok = false; candidatePlotName = QInputDialog::getText(nullptr, "New Summary Plot Name", "New Summary Plot Name", QLineEdit::Normal, candidatePlotName, &ok, RiuTools::defaultDialogFlags()); if (!ok) { return; } newSummaryPlot = summaryPlotColl->createNamedSummaryPlot(candidatePlotName); } } if (newSummaryPlot) { newSummaryPlot->loadDataAndUpdate(); summaryPlotColl->updateConnectedEditors(); m_targetPlot = newSummaryPlot; updateTargetPlot(); } } }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicNewPltPlotFeature::onActionTriggered(bool isChecked) { RimProject* proj = RiaApplication::instance()->project(); RimPltPlotCollection* pltPlotColl = proj->mainPlotCollection()->pltPlotCollection(); if (pltPlotColl) { QString wellPathName; RimWellPath* wellPath = nullptr; RimSimWellInView* eclipseWell = nullptr; if ((wellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>()) != nullptr) { wellPathName = wellPath->name(); } else if ((eclipseWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>()) != nullptr) { RimWellPath* wellPath = proj->wellPathFromSimWellName(eclipseWell->name()); if (!wellPath ) return; wellPathName = wellPath->name(); } QString plotName = QString(RimWellPltPlot::plotNameFormatString()).arg(wellPathName); RimWellPltPlot* pltPlot = new RimWellPltPlot(); pltPlot->setCurrentWellName(wellPathName); RimWellLogTrack* plotTrack = new RimWellLogTrack(); pltPlot->wellLogPlot()->addTrack(plotTrack); plotTrack->setDescription(QString("Track %1").arg(pltPlot->wellLogPlot()->trackCount())); pltPlotColl->addPlot(pltPlot); pltPlot->setDescription(plotName); //pltPlot->applyInitialSelections(); pltPlot->loadDataAndUpdate(); pltPlotColl->updateConnectedEditors(); RiuPlotMainWindowTools::showPlotMainWindow(); RiuPlotMainWindowTools::setExpanded(plotTrack); RiuPlotMainWindowTools::selectAsCurrentItem(pltPlot); } }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimSummaryCase::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) { if (changedField == &m_useAutoShortName) { this->updateAutoShortName(); } else if (changedField == &m_shortName) { updateTreeItemName(); } RimProject* proj = NULL; this->firstAncestorOrThisOfType(proj); RimMainPlotCollection* mainPlotColl = proj->mainPlotCollection(); RimSummaryPlotCollection* summaryPlotColl = mainPlotColl->summaryPlotCollection(); summaryPlotColl->updateSummaryNameHasChanged(); updateOptionSensitivity(); }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- QList<caf::PdmOptionItemInfo> RicSummaryCurveCreator::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) { QList<caf::PdmOptionItemInfo> options; if (fieldNeedingOptions == &m_targetPlot) { RimProject* proj = RiaApplication::instance()->project(); RimSummaryPlotCollection* summaryPlotColl = proj->mainPlotCollection()->summaryPlotCollection(); // Create New Plot item QString displayName = "( New Plot )"; options.push_back(caf::PdmOptionItemInfo(displayName, nullptr)); if (summaryPlotColl) { summaryPlotColl->summaryPlotItemInfos(&options); } } return options; }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicCreateSaturationPressurePlotsFeature::onActionTriggered(bool isChecked) { RimProject* project = RiaApplication::instance()->project(); RimSaturationPressurePlotCollection* collection = project->mainPlotCollection()->saturationPressurePlotCollection(); std::vector<RimEclipseResultCase*> eclipseCases; { RiaApplication* app = RiaApplication::instance(); std::vector<RimCase*> cases; app->project()->allCases(cases); for (auto* rimCase : cases) { auto erc = dynamic_cast<RimEclipseResultCase*>(rimCase); if (erc) { eclipseCases.push_back(erc); } } } RimEclipseResultCase* eclipseResultCase = nullptr; if (!eclipseCases.empty()) { if (eclipseCases.size() == 1) { eclipseResultCase = eclipseCases[0]; } else { RicSaturationPressureUi saturationPressureUi; saturationPressureUi.setSelectedCase(eclipseCases[0]); RiuPlotMainWindow* plotwindow = RiaApplication::instance()->mainPlotWindow(); caf::PdmUiPropertyViewDialog propertyDialog( plotwindow, &saturationPressureUi, "Select Case to create Pressure Saturation plots", ""); if (propertyDialog.exec() == QDialog::Accepted) { eclipseResultCase = dynamic_cast<RimEclipseResultCase*>(saturationPressureUi.selectedCase()); } } } caf::PdmObject* objectToSelect = nullptr; std::vector<RimSaturationPressurePlot*> plots = createPlots(eclipseResultCase); if (plots.empty()) { QString text = "No plots generated.\n\n"; text += "Data required to generate saturation/pressure plots:\n"; text += " - EQLNUM property defining at least one region\n"; text += " - Dynamic properties PRESSURE, PBUB and PDEW\n\n"; text += "Make sure to add 'PBPD' to the RPTRST keyword in the SOLUTION selection. "; text += "If this is a two phase run (Oil/water or Gas/Water) or if both VAPOIL "; text += "and DISGAS are disabled, saturation pressure are not valid."; QMessageBox::warning(nullptr, "Saturation Pressure Plots", text); RiaLogging::warning(text); } else { objectToSelect = plots.front(); } collection->updateAllRequiredEditors(); RiaApplication::instance()->getOrCreateAndShowMainPlotWindow(); if (objectToSelect) { RiuPlotMainWindowTools::selectAsCurrentItem(objectToSelect); } }