//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimSummaryCurveAutoName::appendLgrName(std::string& text, const RifEclipseSummaryAddress& summaryAddress) const
{
    if (m_lgrName)
    {
        if (text.size() > 0) text += ":";
        text += ":" + summaryAddress.lgrName();
    }
}
Beispiel #2
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlotSourceStepping::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue,
                                                    const QVariant& newValue)
{
    RimSummaryCurveCollection* curveCollection = nullptr;
    this->firstAncestorOrThisOfTypeAsserted(curveCollection);

    bool triggerLoadDataAndUpdate = false;

    if (changedField == &m_summaryCase)
    {
        if (m_summaryCase())
        {
            for (auto curve : curveCollection->curves())
            {
                if (isYAxisStepping())
                {
                    curve->setSummaryCaseY(m_summaryCase);
                }

                if (isXAxisStepping())
                {
                    curve->setSummaryCaseX(m_summaryCase);
                }
            }

            triggerLoadDataAndUpdate = true;
        }

        m_wellName.uiCapability()->updateConnectedEditors();
        m_wellGroupName.uiCapability()->updateConnectedEditors();
        m_region.uiCapability()->updateConnectedEditors();
        m_quantity.uiCapability()->updateConnectedEditors();
    }
    else if (changedField == &m_wellName)
    {
        for (auto curve : curveCollection->curves())
        {
            if (isYAxisStepping())
            {
                RifEclipseSummaryAddress adr = curve->summaryAddressY();
                if (adr.category() == RifEclipseSummaryAddress::SUMMARY_WELL)
                {
                    adr.setWellName(m_wellName().toStdString());

                    curve->setSummaryAddressY(adr);
                }
            }

            if (isXAxisStepping())
            {
                RifEclipseSummaryAddress adr = curve->summaryAddressX();
                if (adr.category() == RifEclipseSummaryAddress::SUMMARY_WELL)
                {
                    adr.setWellName(m_wellName().toStdString());

                    curve->setSummaryAddressX(adr);
                }
            }
        }

        triggerLoadDataAndUpdate = true;
    }
    else if (changedField == &m_region)
    {
        for (auto curve : curveCollection->curves())
        {
            if (isYAxisStepping())
            {
                RifEclipseSummaryAddress adr = curve->summaryAddressY();
                if (adr.category() == RifEclipseSummaryAddress::SUMMARY_REGION)
                {
                    adr.setRegion(m_region());

                    curve->setSummaryAddressY(adr);
                }
            }

            if (isXAxisStepping())
            {
                RifEclipseSummaryAddress adr = curve->summaryAddressX();
                if (adr.category() == RifEclipseSummaryAddress::SUMMARY_REGION)
                {
                    adr.setRegion(m_region());

                    curve->setSummaryAddressX(adr);
                }
            }
        }

        triggerLoadDataAndUpdate = true;
    }
    else if (changedField == &m_quantity)
    {
        for (auto curve : curveCollection->curves())
        {
            if (isYAxisStepping())
            {
                RifEclipseSummaryAddress adr = curve->summaryAddressY();
                adr.setQuantityName(m_quantity().toStdString());

                curve->setSummaryAddressY(adr);
            }

            if (isXAxisStepping())
            {
                RifEclipseSummaryAddress adr = curve->summaryAddressX();
                adr.setQuantityName(m_quantity().toStdString());

                curve->setSummaryAddressX(adr);
            }
        }

        triggerLoadDataAndUpdate = true;
    }
    else if (changedField == &m_wellGroupName)
    {
        for (auto curve : curveCollection->curves())
        {
            if (isYAxisStepping())
            {
                RifEclipseSummaryAddress adr = curve->summaryAddressY();
                if (adr.category() == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP)
                {
                    adr.setWellGroupName(m_wellGroupName().toStdString());

                    curve->setSummaryAddressY(adr);
                }
            }

            if (isXAxisStepping())
            {
                RifEclipseSummaryAddress adr = curve->summaryAddressX();
                if (adr.category() == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP)
                {
                    adr.setWellGroupName(m_wellGroupName().toStdString());

                    curve->setSummaryAddressX(adr);
                }
            }
        }

        triggerLoadDataAndUpdate = true;
    }

    if (triggerLoadDataAndUpdate)
    {
        RimSummaryPlot* summaryPlot = nullptr;
        this->firstAncestorOrThisOfTypeAsserted(summaryPlot);

        summaryPlot->updatePlotTitle();
        summaryPlot->loadDataAndUpdate();

        RimSummaryCrossPlot* summaryCrossPlot = dynamic_cast<RimSummaryCrossPlot*>(summaryPlot);
        if (summaryCrossPlot)
        {
            // Trigger update of curve collection (and summary toolbar in main window), as the visibility of combo boxes might
            // have been changed due to the updates in this function
            curveCollection->updateConnectedEditors();

            RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
            mainPlotWindow->updateSummaryPlotToolBar();
        }
    }
}
Beispiel #3
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimSummaryAddress::setAddress(const RifEclipseSummaryAddress& addr)
{
    m_category                      = addr.category();
    m_quantityName                  = addr.quantityName().c_str();
    m_regionNumber                  = addr.regionNumber();
    m_regionNumber2                 = addr.regionNumber2();
    m_wellGroupName                 = addr.wellGroupName().c_str();
    m_wellName                      = addr.wellName().c_str();
    m_wellSegmentNumber             = addr.wellSegmentNumber();
    m_lgrName                       = addr.lgrName().c_str();

    m_cellI = addr.cellI(); m_cellJ = addr.cellJ(); m_cellK = addr.cellK();
}
Beispiel #4
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimSummaryFilter::updateFromAddress(const RifEclipseSummaryAddress& address)
{
    RifEclipseSummaryAddress::SummaryVarCategory category = address.category();

    m_filterQuantityName = QString::fromStdString(address.quantityName());

    switch (category)
    {
    case RifEclipseSummaryAddress::SUMMARY_INVALID:
        m_filterType = SUM_FILTER_VAR_STRING;
        break;
    
    case RifEclipseSummaryAddress::SUMMARY_FIELD:
        m_filterType = SUM_FILTER_FIELD;
        break;
    
    case RifEclipseSummaryAddress::SUMMARY_AQUIFER:
        m_filterType = SUM_FILTER_AQUIFER;
        break;
    
    case RifEclipseSummaryAddress::SUMMARY_NETWORK:
        m_filterType = SUM_FILTER_NETWORK;
        break;
    
    case RifEclipseSummaryAddress::SUMMARY_MISC:
        m_filterType = SUM_FILTER_MISC;
        break;
    
    case RifEclipseSummaryAddress::SUMMARY_REGION:
        m_filterType        = SUM_FILTER_REGION;
        m_regionNumberFilter= QString("%1").arg(address.regionNumber());
        break;
    
    case RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION:
        m_filterType          = SUM_FILTER_REGION_2_REGION;
        m_regionNumberFilter  = QString("%1").arg(address.regionNumber());
        m_regionNumber2Filter = QString("%1").arg(address.regionNumber2());
        break;
    
    case RifEclipseSummaryAddress::SUMMARY_WELL_GROUP:
        m_filterType          = SUM_FILTER_WELL_GROUP;
        m_wellGroupNameFilter = QString::fromStdString(address.wellGroupName());
        break;
    
    case RifEclipseSummaryAddress::SUMMARY_WELL:
        m_filterType     = SUM_FILTER_WELL;
        m_wellNameFilter = QString::fromStdString(address.wellName());
        break;
    
    case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION:
        m_filterType     = SUM_FILTER_WELL_COMPLETION;
        m_wellNameFilter = QString::fromStdString(address.wellName());
        m_cellIJKFilter  = cellIJKString(address.cellI(), address.cellJ(), address.cellK());
        break;
    
    case RifEclipseSummaryAddress::SUMMARY_WELL_LGR:
        m_filterType    = SUM_FILTER_WELL_LGR;
        m_wellNameFilter= QString::fromStdString(address.wellName());
        m_lgrNameFilter = QString::fromStdString(address.lgrName());
        break;
    
    case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR:
        m_filterType     = SUM_FILTER_WELL_COMPLETION_LGR;
        m_wellNameFilter = QString::fromStdString(address.wellName());
        m_lgrNameFilter  = QString::fromStdString(address.lgrName());
        m_cellIJKFilter  = cellIJKString(address.cellI(), address.cellJ(), address.cellK());
        break;
    
    case RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT:
        m_filterType              = SUM_FILTER_WELL_SEGMENT;
        m_wellNameFilter          = QString::fromStdString(address.wellName());
        m_wellSegmentNumberFilter = QString("%1").arg(address.wellSegmentNumber());
        break;
    
    case RifEclipseSummaryAddress::SUMMARY_BLOCK:
        m_filterType    = SUM_FILTER_BLOCK;
        m_cellIJKFilter = cellIJKString(address.cellI(), address.cellJ(), address.cellK());
        break;
    
    case RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR:
        m_filterType    = SUM_FILTER_BLOCK_LGR;
        m_lgrNameFilter = QString::fromStdString(address.lgrName());
        m_cellIJKFilter = cellIJKString(address.cellI(), address.cellJ(), address.cellK());
        break;

    default:
        break;
    }
}
Beispiel #5
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
bool RimSummaryFilter::isIncludedByFilter(const RifEclipseSummaryAddress& addr) const
{
    if(!isSumVarTypeMatchingFilterType(m_filterType(), addr.category())) return false;

    if(m_filterType() == SUM_FILTER_VAR_STRING)
    {
        return isStringMatch(m_completeVarStringFilter(), addr.uiText());
    }

    if(!isStringMatch(m_filterQuantityName(), addr.quantityName())) return false;

    if(m_filterType() == SUM_FILTER_ANY)
    {
        return (isNumberMatch(m_regionNumberFilter(), addr.regionNumber())
                &&  isNumberMatch(m_regionNumber2Filter(), addr.regionNumber2())
                &&  isStringMatch(m_wellGroupNameFilter(), addr.wellGroupName())
                &&  isStringMatch(m_wellNameFilter(), addr.wellName())
                &&  isStringMatch(m_lgrNameFilter(), addr.lgrName())
                &&  isNumberMatch(m_wellSegmentNumberFilter(), addr.wellSegmentNumber())
                &&  isIJKMatch(m_cellIJKFilter(), addr.cellI(), addr.cellJ(), addr.cellK()));
    }

    switch(addr.category())
    {
        case RifEclipseSummaryAddress::SUMMARY_REGION:
        {
            return isNumberMatch(m_regionNumberFilter(), addr.regionNumber());
        }
        break;
        case RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION:
        {
            return  isNumberMatch(m_regionNumberFilter(), addr.regionNumber())
                && isNumberMatch(m_regionNumber2Filter(), addr.regionNumber2());
        }
        break;
        case RifEclipseSummaryAddress::SUMMARY_WELL_GROUP:
        {
            return  isStringMatch(m_wellGroupNameFilter(), addr.wellGroupName());
        }
        break;
        case RifEclipseSummaryAddress::SUMMARY_WELL:
        {
            return  isStringMatch(m_wellNameFilter(), addr.wellName());
        }
        break;
        case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION:
        {
            return  isStringMatch(m_wellNameFilter(), addr.wellName())
                && isIJKMatch(m_cellIJKFilter(), addr.cellI(), addr.cellJ(), addr.cellK());
        }
        break;
        case RifEclipseSummaryAddress::SUMMARY_WELL_LGR:
        {
            return  isStringMatch(m_wellNameFilter(), addr.wellName())
                && isStringMatch(m_lgrNameFilter(), addr.lgrName());
        }
        break;

        case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR:
        {
            return  isStringMatch(m_wellNameFilter(), addr.wellName())
                && isStringMatch(m_lgrNameFilter(), addr.lgrName())
                && isIJKMatch(m_cellIJKFilter(), addr.cellI(), addr.cellJ(), addr.cellK());
        }
        break;
        case RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT:
        {
            return  isStringMatch(m_wellNameFilter(), addr.wellName())
                && isNumberMatch(m_wellSegmentNumberFilter(), addr.wellSegmentNumber());
        }
        break;
        case RifEclipseSummaryAddress::SUMMARY_BLOCK:
        {
            return  isIJKMatch(m_cellIJKFilter(), addr.cellI(), addr.cellJ(), addr.cellK());
        }
        break;
        case RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR:
        {
            return  isStringMatch(m_lgrNameFilter(), addr.lgrName())
                && isIJKMatch(m_cellIJKFilter(), addr.cellI(), addr.cellJ(), addr.cellK());
        }
        break;
    }

    return true;
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
QString RimSummaryCurveAutoName::curveName(const RifEclipseSummaryAddress& summaryAddress) const
{
    std::string text;

    RimSummaryCurve* summaryCurve = nullptr;
    this->firstAncestorOrThisOfType(summaryCurve);

    if (m_vectorName)
    {
        text += summaryAddress.quantityName();

        if (m_unit && summaryCurve)
        {
            text += "[" + summaryCurve->unitName() + "]";
        }
    }

    switch (summaryAddress.category())
    {
        case RifEclipseSummaryAddress::SUMMARY_REGION:
        {
            if (m_regionNumber)
            {
                if (text.size() > 0) text +=":";
                text += std::to_string(summaryAddress.regionNumber());
            }
        }
        break;
        case RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION:
        {
            if (m_regionNumber)
            {
                if (text.size() > 0) text += ":";
                text += std::to_string(summaryAddress.regionNumber());
                text += "-" + std::to_string(summaryAddress.regionNumber2());
            }
        }
        break;
        case RifEclipseSummaryAddress::SUMMARY_WELL_GROUP:
        {
            if (m_wellGroupName)
            {
                if (text.size() > 0) text += ":";
                text += summaryAddress.wellGroupName();
            }
        }
        break;
        case RifEclipseSummaryAddress::SUMMARY_WELL:
        {
            appendWellName(text, summaryAddress);
        }
        break;
        case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION:
        {
            appendWellName(text, summaryAddress);

            if (m_completion)
            {
                if (text.size() > 0) text += ":";
                text += std::to_string(summaryAddress.cellI()) + ", "
                    + std::to_string(summaryAddress.cellJ()) + ", "
                    + std::to_string(summaryAddress.cellK());
            }
        }
        break;
        case RifEclipseSummaryAddress::SUMMARY_WELL_LGR:
        {
            appendLgrName(text, summaryAddress);
            appendWellName(text, summaryAddress);
        }
        break;
        case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR:
        {
            appendLgrName(text, summaryAddress);
            appendWellName(text, summaryAddress);

            if (m_completion)
            {
                if (text.size() > 0) text += ":";
                text += std::to_string(summaryAddress.cellI()) + ", "
                    + std::to_string(summaryAddress.cellJ()) + ", "
                    + std::to_string(summaryAddress.cellK());
            }
        }
        break;
        case RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT:
        {
            appendWellName(text, summaryAddress);

            if (m_wellSegmentNumber)
            {
                if (text.size() > 0) text += ":";
                text += ":" + summaryAddress.wellSegmentNumber();
            }
        }
        break;
        case RifEclipseSummaryAddress::SUMMARY_BLOCK:
        {
            if (m_completion)
            {
                if (text.size() > 0) text += ":";
                text += std::to_string(summaryAddress.cellI()) + ", "
                    + std::to_string(summaryAddress.cellJ()) + ", "
                    + std::to_string(summaryAddress.cellK());
            }
        }
        break;
        case RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR:
        {
            appendLgrName(text, summaryAddress);

            if (m_completion)
            {
                if (text.size() > 0) text += ":";
                text += std::to_string(summaryAddress.cellI()) + ", "
                    + std::to_string(summaryAddress.cellJ()) + ", "
                    + std::to_string(summaryAddress.cellK());
            }
        }
        break;
    }


    if (summaryCurve)
    {
        if (m_caseName)
        {
            if (summaryCurve && summaryCurve->summaryCase())
            {
                if (text.size() > 0) text += ", ";
                text += summaryCurve->summaryCase()->caseName().toStdString();
            }
        }
    }

    return QString::fromStdString(text);
}