Example #1
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();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSetSourceSteppingSummaryCurveFeature::onActionTriggered(bool isChecked)
{
    std::vector<RimSummaryCurve*> summaryCurves;
    caf::SelectionManager::instance()->objectsByType(&summaryCurves);

    if (summaryCurves.size() == 1)
    {
        auto c = summaryCurves[0];

        RimSummaryPlot* summaryPlot = nullptr;
        c->firstAncestorOrThisOfType(summaryPlot);
        if (summaryPlot)
        {
            RicClearSourceSteppingEnsembleCurveSetFeature::clearAllSourceSteppingInSummaryPlot(summaryPlot);
        }

        RimSummaryCurveCollection* coll = nullptr;
        c->firstAncestorOrThisOfTypeAsserted(coll);
        if (coll)
        {
            coll->setCurveForSourceStepping(c);
            c->updateConnectedEditors();

            RiuPlotMainWindowTools::refreshToolbars();
        }
    }
}
Example #3
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();
}
Example #4
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
bool RimCellRangeFilter::isRangeFilterControlled() const
{
    Rim3dView* rimView = nullptr;
    firstAncestorOrThisOfTypeAsserted(rimView);

    bool isRangeFilterControlled = false;
    if (rimView && rimView->viewController() && rimView->viewController()->isRangeFiltersControlled())
    {
        isRangeFilterControlled = true;
    }

    return isRangeFilterControlled;
}
Example #5
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
double RimSimWellInView::pipeRadius()
{
    RimEclipseView* reservoirView;
    firstAncestorOrThisOfTypeAsserted(reservoirView);

    RigEclipseCaseData* rigReservoir = reservoirView->eclipseCase()->eclipseCaseData();
    
    double characteristicCellSize = rigReservoir->mainGrid()->characteristicIJCellSize();

    double pipeRadius = reservoirView->wellCollection()->pipeScaleFactor() * this->pipeScaleFactor() * characteristicCellSize;

    return pipeRadius;
}
Example #6
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
double RimPerforationInterval::diameter(RiaEclipseUnitTools::UnitSystem unitSystem) const
{
    RimWellPath* wellPath;
    firstAncestorOrThisOfTypeAsserted(wellPath);
    if (unitSystem == RiaEclipseUnitTools::UNITS_METRIC && wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_FIELD)
    {
        return RiaEclipseUnitTools::feetToMeter(m_diameter());
    }
    else if (unitSystem == RiaEclipseUnitTools::UNITS_FIELD && wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_METRIC)
    {
        return RiaEclipseUnitTools::meterToFeet(m_diameter());
    }
    return m_diameter();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleCurveSetCollection::loadDataAndUpdate(bool updateParentPlot)
{
    for (RimEnsembleCurveSet* curveSet : m_curveSets)
    {
        curveSet->loadDataAndUpdate(false);
    }

    if (updateParentPlot)
    {
        RimSummaryPlot* parentPlot;
        firstAncestorOrThisOfTypeAsserted(parentPlot);
        parentPlot->updateAll();
    }
}
Example #8
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimFishboneWellPathCollection::appendCompletion(RimFishboneWellPath* completion)
{
    m_wellPaths.push_back(completion);

    updateConnectedEditors();
    Riu3DMainWindowTools::selectAsCurrentItem(completion);

    uiCapability()->setUiHidden(!m_wellPaths.empty());

    RimProject* project = nullptr;
    firstAncestorOrThisOfTypeAsserted(project);
    if (project)
    {
        project->reloadCompletionTypeResultsInAllViews();
    }
}
Example #9
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimSimWellInViewCollection::assignDefaultWellColors()
{


    RimEclipseCase* ownerCase; 
    firstAncestorOrThisOfTypeAsserted(ownerCase);
    
    for (size_t wIdx = 0; wIdx < wells.size(); ++wIdx)
    {
        RimSimWellInView* well = wells[wIdx];
        if (well && well->simWellData() )
        {
            well->wellPipeColor = ownerCase->defaultWellColor(well->simWellData()->m_wellName);
        }
    }

    RimSimWellInViewCollection::updateWellAllocationPlots();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicSetSourceSteppingSummaryCurveFeature::isCommandEnabled()
{
    std::vector<RimSummaryCurve*> summaryCurves;
    caf::SelectionManager::instance()->objectsByType(&summaryCurves);

    if (summaryCurves.size() == 1)
    {
        auto c = summaryCurves[0];

        RimSummaryCurveCollection* coll = nullptr;
        c->firstAncestorOrThisOfTypeAsserted(coll);
        if (coll)
        {
            if (coll->curveForSourceStepping() != c)
            {
                return true;
            }
        }
    }

    return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicClearSourceSteppingSummaryCurveFeature::isCommandEnabled()
{
    std::vector<caf::PdmObject*> objects;
    caf::SelectionManager::instance()->objectsByType(&objects);

    if (objects.size() == 1)
    {
        auto c = objects[0];

        RimSummaryPlot* summaryPlot = nullptr;
        c->firstAncestorOrThisOfTypeAsserted(summaryPlot);
        if (summaryPlot)
        {
            if (summaryPlot->ensembleCurveSetCollection()->curveSetForSourceStepping()
                || summaryPlot->summaryCurveCollection()->curveForSourceStepping())
            {
                return true;
            }
        }
    }

    return false;
}
Example #12
0
//--------------------------------------------------------------------------------------------------
/// frameIndex = -1 will use the static well frame
//--------------------------------------------------------------------------------------------------
void RimSimWellInView::wellHeadTopBottomPosition(int frameIndex, cvf::Vec3d* top, cvf::Vec3d* bottom)
{

    RimEclipseView* m_rimReservoirView;
    firstAncestorOrThisOfTypeAsserted(m_rimReservoirView);
    
    RigEclipseCaseData* rigReservoir = m_rimReservoirView->eclipseCase()->eclipseCaseData();

    const RigWellResultFrame* wellResultFramePtr = nullptr;
    const RigCell* whCellPtr = nullptr;

    if (frameIndex >= 0)
    {
        if ( !this->simWellData()->hasAnyValidCells(frameIndex) ) return;

        wellResultFramePtr = &(this->simWellData()->wellResultFrame(frameIndex));
        whCellPtr = &(rigReservoir->cellFromWellResultCell(wellResultFramePtr->wellHeadOrStartCell()));
    }
    else
    {
        wellResultFramePtr = &(this->simWellData()->staticWellCells());
        whCellPtr = &(rigReservoir->cellFromWellResultCell(wellResultFramePtr->wellHeadOrStartCell()));
    }

    const RigWellResultFrame& wellResultFrame = *wellResultFramePtr;
    const RigCell& whCell = *whCellPtr;

    // Match this position with pipe start position in RivWellPipesPartMgr::calculateWellPipeCenterline()

    (*bottom) = whCell.faceCenter(cvf::StructGridInterface::NEG_K);

    // Compute well head based on the z position of the top of the K column the well head is part of
    (*top) = (*bottom);
    if ( m_rimReservoirView->wellCollection()->wellHeadPosition() == RimSimWellInViewCollection::WELLHEAD_POS_TOP_COLUMN )
    {
        // Position well head at top active cell of IJ-column

        size_t i, j, k;
        rigReservoir->mainGrid()->ijkFromCellIndex(whCell.mainGridCellIndex(), &i, &j, &k);

        size_t kIndexWellHeadCell = k;
        k = 0;

        size_t topActiveCellIndex = rigReservoir->mainGrid()->cellIndexFromIJK(i, j, k);
        while ( k < kIndexWellHeadCell && !m_rimReservoirView->currentActiveCellInfo()->isActive(topActiveCellIndex) )
        {
            k++;
            topActiveCellIndex = rigReservoir->mainGrid()->cellIndexFromIJK(i, j, k);
        }

        const RigCell& topActiveCell = rigReservoir->mainGrid()->cell(topActiveCellIndex);
        cvf::Vec3d topCellPos = topActiveCell.faceCenter(cvf::StructGridInterface::NEG_K);

        // Modify position if top active cell is closer to sea than well head
        if ( kIndexWellHeadCell > k )
        {
            top->z() = topCellPos.z();
        }
    }
    else
    {
        // Position well head at top of active cells bounding box

        cvf::Vec3d activeCellsBoundingBoxMax = m_rimReservoirView->currentActiveCellInfo()->geometryBoundingBox().max();

        top->z() = activeCellsBoundingBoxMax.z();
    }
}