//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicImportSummaryCasesFeature::createSummaryCasesFromFiles(const QStringList&            fileNames,
                                                               std::vector<RimSummaryCase*>* newCases,
                                                               bool                          ensembleOrGroup)
{
    RiaApplication*               app  = RiaApplication::instance();
    RimProject*                   proj = app->project();
    RimSummaryCaseMainCollection* sumCaseColl =
        proj->activeOilField() ? proj->activeOilField()->summaryCaseMainCollection() : nullptr;

    if (newCases) newCases->clear();
    if (!sumCaseColl) return false;

    RifSummaryCaseRestartSelector fileSelector;
    fileSelector.setEnsembleOrGroupMode(ensembleOrGroup);
    fileSelector.determineFilesToImportFromSummaryFiles(fileNames);

    std::vector<RifSummaryCaseFileResultInfo> importFileInfos = fileSelector.summaryFileInfos();

    if (!importFileInfos.empty())
    {
        std::vector<RimSummaryCase*> sumCases = sumCaseColl->createSummaryCasesFromFileInfos(importFileInfos, true);
        if (newCases) newCases->insert(newCases->end(), sumCases.begin(), sumCases.end());
    }

    if (fileSelector.foundErrors())
    {
        QString errorMessage = fileSelector.createCombinedErrorMessage();
        RiaLogging::error(errorMessage);
        QMessageBox::warning(nullptr, QString("Problem Importing Summary Case File(s)"), errorMessage);
    }

    return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
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 RicSnapshotViewToFileFeature::onActionTriggered(bool isChecked)
{
    RiaApplication* app = RiaApplication::instance();
    RimProject* proj = app->project();

    QString startPath;
    if (!proj->fileName().isEmpty())
    {
        QFileInfo fi(proj->fileName());
        startPath = fi.absolutePath();
    }
    else
    {
        startPath = app->lastUsedDialogDirectory("IMAGE_SNAPSHOT");
    }

    startPath += "/image.png";

    QString fileName = QFileDialog::getSaveFileName(NULL, tr("Save File"), startPath, tr("Image files (*.bmp *.png * *.jpg)"));
    if (fileName.isEmpty())
    {
        return;
    }

    // Remember the directory to next time
    app->setLastUsedDialogDirectory("IMAGE_SNAPSHOT", QFileInfo(fileName).absolutePath());

    RimViewWindow* viewWindow = app->activeViewWindow();
    RicSnapshotViewToFileFeature::saveSnapshotAs(fileName, viewWindow);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo>
    RicCreateMultipleFracturesOptionItemUi::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
                                                                  bool*                      useOptionsOnly)
{
    QList<caf::PdmOptionItemInfo> options;

    RimProject* proj = RiaApplication::instance()->project();
    CVF_ASSERT(proj);

    if (fieldNeedingOptions == &m_fractureTemplate)
    {
        RimOilField* oilField = proj->activeOilField();
        if (oilField && oilField->fractureDefinitionCollection())
        {
            RimFractureTemplateCollection* fracDefColl = oilField->fractureDefinitionCollection();

            for (RimFractureTemplate* fracDef : fracDefColl->fractureTemplates())
            {
                QString displayText = fracDef->nameAndUnit();

                options.push_back(caf::PdmOptionItemInfo(displayText, fracDef));
            }
        }
    }

    return options;
}
Ejemplo n.º 5
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicSetMasterViewFeature::onActionTriggered(bool isChecked)
{
    RimView* activeView = RiaApplication::instance()->activeReservoirView();
    if (!activeView) return;

    RimProject* proj = RiaApplication::instance()->project();
    RimViewLinker* viewLinker = proj->viewLinkerCollection()->viewLinker();

    viewLinker->applyRangeFilterCollectionByUserChoice();

    RimView* previousMasterView = viewLinker->masterView();

    viewLinker->setMasterView(activeView);
    viewLinker->updateDependentViews();

    viewLinker->addDependentView(previousMasterView);

    proj->viewLinkerCollection.uiCapability()->updateConnectedEditors();
    proj->updateConnectedEditors();

    // Set managed view collection to selected and expanded in project tree
    caf::PdmUiTreeView* projTreeView = RiuMainWindow::instance()->projectTreeView();
    projTreeView->selectAsCurrentItem(viewLinker);
    projTreeView->setExpanded(viewLinker, true);
}
Ejemplo n.º 6
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlotSourceStepping::applyNextCase()
{
    RimProject* proj = RiaApplication::instance()->project();

    auto summaryCases = proj->allSummaryCases();
    if (summaryCases.size() < 1) return;

    auto currentCase = std::find(summaryCases.begin(), summaryCases.end(), m_summaryCase());

    if (currentCase != summaryCases.end())
    {
        currentCase++;
        if (currentCase != summaryCases.end())
        {
            m_summaryCase = *currentCase;
        }
    }
    else
    {
        m_summaryCase = summaryCases[0];
    }

    fieldChangedByUi(&m_summaryCase, QVariant(), QVariant());
    m_summaryCase.uiCapability()->updateConnectedEditors();

    RimSummaryCurveCollection* curveCollection = nullptr;
    this->firstAncestorOrThisOfTypeAsserted(curveCollection);

    curveCollection->updateConnectedEditors();
}
Ejemplo n.º 7
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewValveTemplateFeature::selectValveTemplateAndUpdate(RimValveTemplate*           valveTemplate)
{
    valveTemplate->loadDataAndUpdate();

    RimValveTemplateCollection* templateCollection = nullptr;
    valveTemplate->firstAncestorOrThisOfType(templateCollection);
    if (templateCollection)
    {
        templateCollection->updateConnectedEditors();
    }

    RimProject* project = RiaApplication::instance()->project();

    std::vector<Rim3dView*> views;
    project->allVisibleViews(views);

    for (Rim3dView* view : views)
    {
        if (dynamic_cast<RimEclipseView*>(view))
        {
            view->updateConnectedEditors();
        }
    }

    Riu3DMainWindowTools::selectAsCurrentItem(valveTemplate);
}
Ejemplo n.º 8
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicNewSummaryCurveFeature::onActionTriggered(bool isChecked)
{
    RimProject* project = RiaApplication::instance()->project();
    CVF_ASSERT(project);

    RimSummaryPlot* plot = selectedSummaryPlot();
    if (plot)
    {
        RimSummaryCurve* newCurve = new RimSummaryCurve();
        cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(plot->curveCount());
        newCurve->setColor(curveColor);

        plot->addCurveAndUpdate(newCurve);

        RimSummaryCase* defaultCase = nullptr; 
        if (project->activeOilField()->summaryCaseMainCollection()->summaryCaseCount() > 0)
        {
            defaultCase = project->activeOilField()->summaryCaseMainCollection()->summaryCase(0);
            newCurve->setSummaryCaseY(defaultCase);

            newCurve->setSummaryAddressY(RifEclipseSummaryAddress::fieldVarAddress("FOPT"));

            newCurve->loadDataAndUpdate(true);
        }
        
        plot->updateConnectedEditors();

        RiaApplication::instance()->getOrCreateAndShowMainPlotWindow()->selectAsCurrentItem(newCurve);

        RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
        mainPlotWindow->updateSummaryPlotToolBar();
    }
}
Ejemplo n.º 9
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
RimEclipseCase* RimGridSummaryCase::associatedEclipseCase()
{
    if (!m_eclipseCase())
    {
        // Find a possible associated eclipse case

        RimProject* project;
        firstAncestorOrThisOfTypeAsserted(project);
        std::vector<RimCase*> allCases;
        project->allCases(allCases);
        for ( RimCase* someCase: allCases )
        {
            auto eclCase = dynamic_cast<RimEclipseCase*>(someCase);
            if ( eclCase )
            {
                QString sumHeaderFileName = summaryHeaderFilenameFromEclipseCase(eclCase);
                if ( sumHeaderFileName == m_summaryHeaderFilename )
                {
                    m_eclipseCase = eclCase;
                    this->updateAutoShortName();
                    this->updateTreeItemName();

                    break;
                }
            }
        }
    }

    return m_eclipseCase();
}
Ejemplo n.º 10
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
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);
}
Ejemplo n.º 11
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<std::string> RicSummaryCurveCreator::getAllSummaryWellNames()
{
    std::set<std::string> summaryWellNames;
    RimProject*           proj = RiaApplication::instance()->project();

    std::vector<RimSummaryCase*> cases = proj->allSummaryCases();
    for (RimSummaryCase* rimCase : cases)
    {
        RifSummaryReaderInterface* reader = nullptr;
        if (rimCase)
        {
            reader = rimCase->summaryReader();
        }

        if (reader)
        {
            const std::vector<RifEclipseSummaryAddress> allAddresses = reader->allResultAddresses();

            for (size_t i = 0; i < allAddresses.size(); i++)
            {
                if (allAddresses[i].category() == RifEclipseSummaryAddress::SUMMARY_WELL)
                {
                    summaryWellNames.insert(allAddresses[i].wellName());
                }
            }
        }
    }
    return summaryWellNames;
}
Ejemplo n.º 12
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
bool RicNewPltPlotFeature::isCommandEnabled()
{
    if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return false;

    RimSimWellInView* simWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>();
    RimWellPath* selectedWellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>();

    bool enable = true;

    if (selectedWellPath)
    {
        if (selectedWellPath->wellPathGeometry() == nullptr && !RimWellPlotTools::hasFlowData(selectedWellPath))
        {
            return false;
        }
    }

    if (simWell != nullptr)
    {
        RimProject* proj = RiaApplication::instance()->project();
        QString simWellName = simWell->name();

        RimWellPath* wellPath = proj->wellPathFromSimWellName(simWellName);
        enable = wellPath != nullptr;
    }
    return enable;
}
Ejemplo n.º 13
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimWellPath::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
    partMgr()->scheduleGeometryRegen();

    RimProject* proj;
    this->firstAnchestorOrThisOfType(proj);
    if (proj) proj->createDisplayModelAndRedrawAllViews();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCompletionCellIntersectionCalc::calculateCompletionTypeResult(RimEclipseCase*      eclipseCase,
                                                                      std::vector<double>& completionTypeCellResult,
                                                                      size_t               timeStep)
{
    CVF_ASSERT(eclipseCase && eclipseCase->eclipseCaseData());

    RimProject* project = nullptr;
    eclipseCase->firstAncestorOrThisOfTypeAsserted(project);

    if (project->activeOilField()->wellPathCollection->isActive)
    {
        const RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData();

        for (const RimWellPath* wellPath : project->activeOilField()->wellPathCollection->wellPaths)
        {
            if (wellPath->showWellPath() && wellPath->wellPathGeometry())
            {
                auto intersectedCells = RigWellPathIntersectionTools::findIntersectedGlobalCellIndices(
                    eclipseCaseData, wellPath->wellPathGeometry()->m_wellPathPoints);

                for (auto& intersection : intersectedCells)
                {
                    completionTypeCellResult[intersection] = RiaDefines::WELL_PATH;
                }

                auto completions = eclipseCase->computeAndGetVirtualPerforationTransmissibilities();
                if (completions)
                {
                    for (const auto& completionsForWell : completions->multipleCompletionsPerEclipseCell(wellPath, timeStep))
                    {
                        RiaDefines::WellPathComponentType appCompletionType = RiaDefines::WELL_PATH;

                        auto appCompletionTypes = fromCompletionData(completionsForWell.second);

                        if (std::find(appCompletionTypes.begin(), appCompletionTypes.end(), RiaDefines::FRACTURE) !=
                            appCompletionTypes.end())
                        {
                            appCompletionType = RiaDefines::FRACTURE;
                        }
                        else if (std::find(appCompletionTypes.begin(), appCompletionTypes.end(), RiaDefines::FISHBONES) !=
                                 appCompletionTypes.end())
                        {
                            appCompletionType = RiaDefines::FISHBONES;
                        }
                        else if (std::find(appCompletionTypes.begin(),
                                           appCompletionTypes.end(),
                                           RiaDefines::PERFORATION_INTERVAL) != appCompletionTypes.end())
                        {
                            appCompletionType = RiaDefines::PERFORATION_INTERVAL;
                        }

                        completionTypeCellResult[completionsForWell.first] = appCompletionType;
                    }
                }
            }
        }
    }
}
Ejemplo n.º 15
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimSummaryCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
{
    QList<caf::PdmOptionItemInfo> optionList = this->RimPlotCurve::calculateValueOptions(fieldNeedingOptions,useOptionsOnly);
    if (!optionList.isEmpty()) return optionList;


    if (fieldNeedingOptions == &m_summaryCase)
    {
        RimProject* proj = RiaApplication::instance()->project();
        std::vector<RimSummaryCase*> cases;

        proj->allSummaryCases(cases);

        for (size_t i = 0; i < cases.size(); i++)
        {
            RimSummaryCase* rimCase = cases[i];

            optionList.push_back(caf::PdmOptionItemInfo(rimCase->caseName(), QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(rimCase))));
        }

        if (optionList.size() > 0)
        {
            optionList.push_front(caf::PdmOptionItemInfo("None", QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(NULL))));
        }
    }
    else if(fieldNeedingOptions == &m_uiFilterResultSelection)
    {
        if(m_summaryCase)
        {
            RifReaderEclipseSummary* reader = summaryReader();
            int addressCount = 0;
            if(reader)
            {
                const std::vector<RifEclipseSummaryAddress> allAddresses = reader->allResultAddresses();
                addressCount = static_cast<int>(allAddresses.size());
                std::map<RifEclipseSummaryAddress, int> addrToIdxMap;
                for(int i = 0; i <addressCount; i++)
                {
                    if (!m_summaryFilter->isIncludedByFilter(allAddresses[i] )) continue;
                    addrToIdxMap[allAddresses[i]] = i;
                }

                for (const auto& addrIntPair: addrToIdxMap)
                {
                    std::string name = addrIntPair.first.uiText();
                    QString s = QString::fromStdString(name);
                    optionList.push_back(caf::PdmOptionItemInfo(s, addrIntPair.second));
                }
            }

            optionList.push_front(caf::PdmOptionItemInfo(RimDefines::undefinedResultName(), addressCount));

            if(useOptionsOnly) *useOptionsOnly = true;
        }
    }
    return optionList;

}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicSnapshotAllPlotsToFileFeature::saveAllPlots()
{
    RiaApplication* app = RiaApplication::instance();

    RiuMainPlotWindow* mainPlotWindow = app->mainPlotWindow();
    if (!mainPlotWindow) return;

    RimProject* proj = app->project();
    if (!proj) return;

    // Save images in snapshot catalog relative to project directory
    QString snapshotFolderName = app->createAbsolutePathFromProjectRelativePath("snapshots");

    QDir snapshotPath(snapshotFolderName);
    if (!snapshotPath.exists())
    {
        if (!snapshotPath.mkpath(".")) return;
    }

    const QString absSnapshotPath = snapshotPath.absolutePath();

    // Well log plots
    {
        std::vector<RimWellLogPlot*> wellLogPlots;
        proj->descendantsIncludingThisOfType(wellLogPlots);
        for (RimWellLogPlot* wellLogPlot : wellLogPlots)
        {
            if (wellLogPlot && wellLogPlot->viewWidget())
            {
                QString fileName = wellLogPlot->description();
                fileName.replace(" ", "_");

                QString absoluteFileName = caf::Utils::constructFullFileName(absSnapshotPath, fileName, ".png");

                RicSnapshotViewToFileFeature::saveSnapshotAs(absoluteFileName, wellLogPlot);
            }
        }
    }

    // Summary plots
    {
        std::vector<RimSummaryPlot*> summaryPlots;
        proj->descendantsIncludingThisOfType(summaryPlots);
        for (RimSummaryPlot* summaryPlot : summaryPlots)
        {
            if (summaryPlot && summaryPlot->viewWidget())
            {
                QString fileName = summaryPlot->description();
                fileName.replace(" ", "_");

                QString absoluteFileName = caf::Utils::constructFullFileName(absSnapshotPath, fileName, ".png");

                RicSnapshotViewToFileFeature::saveSnapshotAs(absoluteFileName, summaryPlot);
            }
        }
    }
}
Ejemplo n.º 17
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimValveTemplateCollection::setDefaultUnitSystemBasedOnLoadedCases()
{
    RimProject* proj = RiaApplication::instance()->project();

    auto commonUnitSystem = proj->commonUnitSystemForAllCases();
    if (commonUnitSystem != RiaEclipseUnitTools::UNITS_UNKNOWN)
    {
        m_defaultUnitsForValveTemplates = commonUnitSystem;
    }
}
Ejemplo n.º 18
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicImportSummaryCasesFeature::addSummaryCases(const std::vector<RimSummaryCase*> cases)
{
    RiaApplication*               app  = RiaApplication::instance();
    RimProject*                   proj = app->project();
    RimSummaryCaseMainCollection* sumCaseColl =
        proj->activeOilField() ? proj->activeOilField()->summaryCaseMainCollection() : nullptr;
    sumCaseColl->addCases(cases);

    sumCaseColl->updateAllRequiredEditors();
}
Ejemplo n.º 19
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::addWellPaths( QStringList filePaths )
{
    std::vector<RimWellPath*> wellPathArray;

    for (QString filePath : filePaths)
    {
        // Check if this file is already open
        bool alreadyOpen = false;
        for (size_t wpIdx = 0; wpIdx < wellPaths.size(); wpIdx++)
        {
            QFile f1;
            f1.setFileName(filePath);
            QString s1 = f1.fileName();
            QFile f2;
            f2.setFileName(wellPaths[wpIdx]->filepath());
            QString s2 = f2.fileName();
            if (s1 == s2)
            {
                //printf("Attempting to open well path JSON file that is already open:\n  %s\n", (const char*) filePath.toLocal8Bit());
                alreadyOpen = true;
                break;
            }
        }

        if (!alreadyOpen)
        {
            QFileInfo fi(filePath);

            if (fi.suffix().compare("json") == 0)
            {
                RimWellPath* wellPath = new RimWellPath();
                wellPath->filepath = filePath;
                wellPathArray.push_back(wellPath);
            }
            else
            {
                // Create Well path objects for all the paths in the assumed ascii file
                size_t wellPathCount = m_wellPathImporter->wellDataCount(filePath);
                for (size_t i = 0; i < wellPathCount; ++i)
                {
                    RimWellPath* wellPath = new RimWellPath();
                    wellPath->filepath = filePath;
                    wellPath->wellPathIndexInFile = static_cast<int>(i);
                    wellPathArray.push_back(wellPath);
                }
            }
        }
    }

    readAndAddWellPaths(wellPathArray);

    RimProject* proj;
    firstAncestorOrThisOfTypeAsserted(proj);
    proj->reloadCompletionTypeResultsInAllViews();
}
Ejemplo n.º 20
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimSimWellInViewCollection::updateWellAllocationPlots()
{
    RimProject* proj = RiaApplication::instance()->project();

    std::vector<RimWellAllocationPlot*> wellAllocationPlots;
    proj->descendantsIncludingThisOfType(wellAllocationPlots);

    for (auto wap : wellAllocationPlots)
    {
        wap->loadDataAndUpdate();
    }
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
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;
}
Ejemplo n.º 22
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimPerforationInterval::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{

    if (changedField == &m_startOfHistory)
    {
        m_date.uiCapability()->setUiReadOnly(m_startOfHistory());
    }

    RimProject* proj;
    this->firstAncestorOrThisOfTypeAsserted(proj);
    proj->reloadCompletionTypeResultsInAllViews();
}
Ejemplo n.º 23
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicNewStimPlanFractureTemplateFeature::onActionTriggered(bool isChecked)
{
    RiaApplication* app = RiaApplication::instance();
    QString defaultDir = app->lastUsedDialogDirectory("BINARY_GRID");
    QString fileName = QFileDialog::getOpenFileName(nullptr, "Open StimPlan XML File", defaultDir, "StimPlan XML File (*.xml);;All files(*.*)");

    if (fileName.isEmpty()) return;

    RimProject* project = RiaApplication::instance()->project();
    CVF_ASSERT(project);

    RimOilField* oilfield = project->activeOilField();
    if (oilfield == nullptr) return;

    RimFractureTemplateCollection* fracDefColl = oilfield->fractureDefinitionCollection();

    if (fracDefColl)
    {
        RimStimPlanFractureTemplate* fractureDef = new RimStimPlanFractureTemplate();
        fracDefColl->addFractureTemplate(fractureDef);

        QFileInfo stimplanfileFileInfo(fileName);
        QString name = stimplanfileFileInfo.baseName();
        if (name.isEmpty())
        {
            name = "StimPlan Fracture Template";
        }

        fractureDef->setName(name);

        fractureDef->setFileName(fileName);
        fractureDef->loadDataAndUpdate();
        fractureDef->setDefaultsBasedOnXMLfile();
        fractureDef->setDefaultWellDiameterFromUnit();
        fractureDef->updateFractureGrid();

        fracDefColl->updateConnectedEditors();

        std::vector<Rim3dView*> views;
        project->allVisibleViews(views);

        for (Rim3dView* view : views)
        {
            if (dynamic_cast<RimEclipseView*>(view))
            {
                view->updateConnectedEditors();
            }
        }

        Riu3DMainWindowTools::selectAsCurrentItem(fractureDef);
    }
}
Ejemplo n.º 24
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<std::string> RicSummaryCurveCreator::getAllSummaryCaseNames()
{
    std::set<std::string> summaryCaseHashes;
    RimProject*           proj = RiaApplication::instance()->project();

    std::vector<RimSummaryCase*> cases = proj->allSummaryCases();
    for (RimSummaryCase* rimCase : cases)
    {
        summaryCaseHashes.insert(rimCase->summaryHeaderFilename().toUtf8().constData());
    }

    return summaryCaseHashes;
}
Ejemplo n.º 25
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimUiTreeModelPdm::slotRefreshScriptTree(QString path)
{
    RimProject* proj = RIApplication::instance()->project();

    if (!proj || !proj->scriptCollection()) return;

    RimScriptCollection* changedSColl = proj->scriptCollection()->findScriptCollection(path);
    if (changedSColl)
    {
        changedSColl->readContentFromDisc();
        this->rebuildUiSubTree(changedSColl);
    }
}
Ejemplo n.º 26
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void Rim3dWellLogCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
    RimProject* proj;
    this->firstAncestorOrThisOfTypeAsserted(proj);
    if (changedField == &m_showCurve)
    {
        proj->reloadCompletionTypeResultsInAllViews();
    }
    else
    {
        proj->scheduleCreateDisplayModelAndRedrawAllViews();
    }
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewSummaryEnsembleCurveSetFeature::onActionTriggered(bool isChecked)
{
    RimProject* project = RiaApplication::instance()->project();
    CVF_ASSERT(project);

    RimSummaryPlot* plot = selectedSummaryPlot();
    if (plot)
    {
        auto ensemble = project->summaryGroups().back();

        RicNewSummaryEnsembleCurveSetFeature::createPlotForCurveSetAndUpdate(ensemble);
    }
}
Ejemplo n.º 28
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RiuSelectionChangedHandler::scheduleUpdateForAllVisibleViews() const
{
    RimProject* proj = RiaApplication::instance()->project();
    if (proj)
    {
        std::vector<Rim3dView*> visibleViews;
        proj->allVisibleViews(visibleViews);

        for (size_t i = 0; i < visibleViews.size(); i++)
        {
            visibleViews[i]->createHighlightAndGridBoxDisplayModelWithRedraw();
        }
    }
}
Ejemplo n.º 29
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathFracture::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
    RimFracture::defineUiOrdering(uiConfigName, uiOrdering);

    if (m_fractureTemplate())
    {
        uiOrdering.add(nameField(), caf::PdmUiOrdering::LayoutOptions(true, 3, 1));
        uiOrdering.add(&m_fractureTemplate, {true, 2, 1});
        uiOrdering.add(&m_editFractureTemplate, {false, 1, 0});
    }
    else
    {
        uiOrdering.add(nameField());
        {
            RimProject* project = nullptr;
            this->firstAncestorOrThisOfTypeAsserted(project);
            if (project->allFractureTemplates().empty())
            {
                uiOrdering.add(&m_createEllipseFractureTemplate);
                uiOrdering.add(&m_createStimPlanFractureTemplate, false);
            }
            else
            {
                uiOrdering.add(&m_fractureTemplate);
            }
        }
    }

    caf::PdmUiGroup* locationGroup = uiOrdering.addNewGroup("Location / Orientation");
    locationGroup->add(&m_measuredDepth);
    locationGroup->add(&m_azimuth);
    locationGroup->add(&m_uiWellPathAzimuth);
    locationGroup->add(&m_uiWellFractureAzimuthDiff);
    locationGroup->add(&m_wellFractureAzimuthAngleWarning);
    locationGroup->add(&m_dip);
    locationGroup->add(&m_tilt);

    caf::PdmUiGroup* propertyGroup = uiOrdering.addNewGroup("Properties");
    propertyGroup->add(&m_fractureUnit);
    propertyGroup->add(&m_stimPlanTimeIndexToPlot);
    propertyGroup->add(&m_perforationLength);
    propertyGroup->add(&m_perforationEfficiency);
    propertyGroup->add(&m_wellDiameter);

    caf::PdmUiGroup* fractureCenterGroup = uiOrdering.addNewGroup("Fracture Center Info");
    fractureCenterGroup->add(&m_uiAnchorPosition);

    uiOrdering.skipRemainingFields(true);
}
Ejemplo n.º 30
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
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();
        }
    }
}