Exemplo n.º 1
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimSummaryCase::updateTreeItemName()
{
    if (caseName() != shortName())
        this->setUiName(caseName() + " (" + shortName() +")");
    else
        this->setUiName(caseName());
}
Exemplo n.º 2
0
Foam::fileName Foam::IOobject::filePath() const
{
    fileName path = this->path();
    fileName objectPath = path/name();

    if (isFile(objectPath))
    {
        return objectPath;
    }
    else
    {
        if
        (
            time().processorCase()
         && (
                instance() == time().system()
             || instance() == time().constant()
            )
        )
        {
            fileName parentObjectPath =
                rootPath()/caseName()
               /".."/instance()/db_.dbDir()/local()/name();

            if (isFile(parentObjectPath))
            {
                return parentObjectPath;
            }
        }

        if (!isDir(path))
        {
            word newInstancePath = time().findInstancePath(instant(instance()));

            if (newInstancePath.size())
            {
                fileName fName
                (
                    rootPath()/caseName()
                   /newInstancePath/db_.dbDir()/local()/name()
                );

                if (isFile(fName))
                {
                    return fName;
                }
            }
        }
    }

    return fileName::null;
}
Exemplo n.º 3
0
Foam::fileName Foam::IOobject::path
(
    const word& instance,
    const fileName& local
) const
{
    return rootPath()/caseName()/instance/db_.dbDir()/local;
}
Exemplo n.º 4
0
Foam::fileName Foam::IOobject::path
(
    const word& instance,
    const fileName& local
) const
{
    //Note: can only be called with relative instance since is word type
    return rootPath()/caseName()/instance/db_.dbDir()/local;
}
Exemplo n.º 5
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimResultReservoir::openEclipseGridFile()
{
    caf::ProgressInfo progInfo(20, "Reading Eclipse Grid File");

    progInfo.setProgressDescription("Open Grid File");
    progInfo.setNextProgressIncrement(19);
    // Early exit if reservoir data is created
    if (m_rigReservoir.notNull()) return true;

    cvf::ref<RifReaderInterface> readerInterface;

    if (caseName().contains("Result Mock Debug Model"))
    {
        readerInterface = this->createMockModel(this->caseName());
    }
    else
    {
        QString fullCaseName = caseName + ".EGRID";

        QDir dir(caseDirectory.v());
        if (!dir.exists(fullCaseName))
        {
            fullCaseName = caseName + ".GRID";
            if (!dir.exists(fullCaseName))
            {
                return false;
            }
        }

        QString fname = dir.absoluteFilePath(fullCaseName);

        RigReservoir* reservoir = new RigReservoir;
        readerInterface = new RifReaderEclipseOutput;
        if (!readerInterface->open(fname, reservoir))
        {
            delete reservoir;
            return false;
        }

        m_rigReservoir = reservoir;
    }

    progInfo.setProgress(19);

    CVF_ASSERT(m_rigReservoir.notNull());
    CVF_ASSERT(readerInterface.notNull());

    m_rigReservoir->mainGrid()->results()->setReaderInterface(readerInterface.p());

    progInfo.setProgressDescription("Computing Faults");
    m_rigReservoir->computeFaults();
    progInfo.setProgressDescription("Computing Cache");
    m_rigReservoir->mainGrid()->computeCachedData();

    return true;
 }
Exemplo n.º 6
0
Foam::fileName Foam::IOobject::path() const
{
    if (instance().isAbsolute())
    {
        return instance();
    }
    else
    {
        return rootPath()/caseName()/instance()/db_.dbDir()/local();
    }
}
Exemplo n.º 7
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimCase::initAfterRead()
{
    size_t j;
    for (j = 0; j < reservoirViews().size(); j++)
    {
        RimReservoirView* riv = reservoirViews()[j];
        CVF_ASSERT(riv);

        riv->setEclipseCase(this);
    }

    if (caseUserDescription().isEmpty() && !caseName().isEmpty())
    {
        caseUserDescription = caseName;
    }
}
Exemplo n.º 8
0
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimInputReservoir::openEclipseGridFile()
{
    // Early exit if reservoir data is created
    if (m_rigReservoir.isNull())
    {
        cvf::ref<RifReaderInterface> readerInterface;

        if (caseName().contains("Input Mock Debug Model"))
        {
            readerInterface = this->createMockModel(this->caseName());
        }
        else
        {
            RigReservoir* reservoir = new RigReservoir;
            readerInterface = new RifReaderEclipseInput;
            if (!readerInterface->open(m_gridFileName, reservoir))
            {
                delete reservoir;
                return false;
            }

            m_rigReservoir = reservoir;
            loadAndSyncronizeInputProperties();
        }

        CVF_ASSERT(m_rigReservoir.notNull());
        CVF_ASSERT(readerInterface.notNull());

        m_rigReservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(readerInterface.p());
        m_rigReservoir->mainGrid()->results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(readerInterface.p());
        m_rigReservoir->computeFaults();
        m_rigReservoir->mainGrid()->computeCachedData();
    }

    
    RIApplication* app = RIApplication::instance();
    if (app->preferences()->autocomputeDepthRelatedProperties)
    {
        RigReservoirCellResults* matrixResults = m_rigReservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS);
        RigReservoirCellResults* fractureResults = m_rigReservoir->mainGrid()->results(RifReaderInterface::FRACTURE_RESULTS);

        matrixResults->computeDepthRelatedResults();
        fractureResults->computeDepthRelatedResults();
    }

    return true;
 }
Exemplo n.º 9
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RimSummaryCase::updateAutoShortName()
{
    if(m_useAutoShortName)
    {
        RimSummaryCaseCollection* summaryCaseCollection = NULL;
        this->firstAncestorOrThisOfType(summaryCaseCollection);
        CVF_ASSERT(summaryCaseCollection);

        m_shortName =  summaryCaseCollection->uniqueShortNameForCase(this);
        updateTreeItemName();
    }
    else if (m_shortName() == QString("Display Name"))
    {
        m_shortName =  caseName();
        updateTreeItemName();
    }
}
Exemplo n.º 10
0
Foam::fileName Foam::IOobject::path() const
{
    return rootPath()/caseName()/instance()/db_.dbDir()/local();
}
Exemplo n.º 11
0
//--------------------------------------------------------------------------------------------------
/// Open the supplied file set. If no grid data has been read, it will first find the possible 
/// grid data among the files then read all supported properties from the files matching the grid
//--------------------------------------------------------------------------------------------------
void RimInputReservoir::openDataFileSet(const QStringList& filenames)
{
    if (caseName().contains("Input Mock Debug Model"))
    {
        cvf::ref<RifReaderInterface> readerInterface = this->createMockModel(this->caseName());
        m_rigReservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(readerInterface.p());
        m_rigReservoir->mainGrid()->results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(readerInterface.p());

        size_t matrixActiveCellCount = 0;
        size_t fractureActiveCellCount = 0;

        for (size_t cellIdx = 0; cellIdx < m_rigReservoir->mainGrid()->cells().size(); cellIdx++)
        {
            const RigCell& cell = m_rigReservoir->mainGrid()->cells()[cellIdx];

            if (cell.isActiveInMatrixModel())
            {
                matrixActiveCellCount++;
            }
            if (cell.isActiveInFractureModel())
            {
                fractureActiveCellCount++;
            }

        }

        m_rigReservoir->mainGrid()->setGlobalMatrixModelActiveCellCount(matrixActiveCellCount);
        m_rigReservoir->mainGrid()->setGlobalFractureModelActiveCellCount(fractureActiveCellCount);

        return;
    }

    if (m_rigReservoir.isNull()) 
    {
        RigReservoir* reservoir = new RigReservoir;
        m_rigReservoir = reservoir;
    }

    // First find and read the grid data 
    if (this->reservoirData()->mainGrid()->gridPointDimensions() == cvf::Vec3st(0,0,0))
    {
         for (int i = 0; i < filenames.size(); i++)
         {
             if (RifEclipseInputFileTools::openGridFile(filenames[i], this->reservoirData()))
             {
                 m_gridFileName = filenames[i];

                 m_rigReservoir->computeFaults();
                 m_rigReservoir->mainGrid()->computeCachedData();

                 break;
             }
         }
    }

    if (this->reservoirData()->mainGrid()->gridPointDimensions() == cvf::Vec3st(0,0,0))
    {
        return ; // No grid present
    }

    // Then read the properties possibly in the grid file
    QStringList filesToRead;
    for (int i = 0; i < filenames.size(); i++)
    {
        size_t j;
        bool exist = false;
        for (j = 0; j < m_additionalFileNames().size(); j++)
        {
            if (m_additionalFileNames()[j] == filenames[i])
            {
                exist = true;
            }
        }

        if (!exist)
        {
            filesToRead.push_back(filenames[i]);
        }
    }

    for (int i = 0; i < filesToRead.size(); i++)
    {
        QString propertyFileName = filesToRead[i];
        std::map<QString, QString> readProperties = RifEclipseInputFileTools::readProperties(propertyFileName, this->reservoirData());

        std::map<QString, QString>::iterator it;
        for (it = readProperties.begin(); it != readProperties.end(); ++it)
        {
            RimInputProperty* inputProperty = new RimInputProperty;
            inputProperty->resultName = it->first;
            inputProperty->eclipseKeyword = it->second;
            inputProperty->fileName = propertyFileName;
            inputProperty->resolvedState = RimInputProperty::RESOLVED;
            m_inputPropertyCollection->inputProperties.push_back(inputProperty);
        }

        if (propertyFileName != m_gridFileName)
        {
            m_additionalFileNames.v().push_back(propertyFileName);
        }
    }
}