mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Moved result value vectors from MainGrid to Reservoir
p4#: 20499
This commit is contained in:
parent
f14c03f172
commit
b1cb8a6716
@ -68,7 +68,7 @@ TEST(RigReservoirTest, FileOutputToolsTest)
|
||||
|
||||
void buildResultInfoString(RigReservoir* reservoir, RifReaderInterface::PorosityModelResultType porosityModel, RimDefines::ResultCatType resultType)
|
||||
{
|
||||
RigReservoirCellResults* matrixResults = reservoir->mainGrid()->results(porosityModel);
|
||||
RigReservoirCellResults* matrixResults = reservoir->results(porosityModel);
|
||||
{
|
||||
QStringList resultNames = matrixResults->resultNames(resultType);
|
||||
|
||||
|
@ -212,11 +212,11 @@ std::map<QString, QString> RifEclipseInputFileTools::readProperties(const QStri
|
||||
ecl_kw_type* eclKeyWordData = ecl_kw_fscanf_alloc_current_grdecl__(gridFilePointer, false , ECL_FLOAT_TYPE);
|
||||
if (eclKeyWordData)
|
||||
{
|
||||
QString newResultName = reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(fileKeywords[i].keyword);
|
||||
QString newResultName = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(fileKeywords[i].keyword);
|
||||
|
||||
size_t resultIndex = reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->addEmptyScalarResult(RimDefines::INPUT_PROPERTY, newResultName); // Should really merge with inputProperty object information because we need to use PropertyName, and not keyword
|
||||
size_t resultIndex = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->addEmptyScalarResult(RimDefines::INPUT_PROPERTY, newResultName); // Should really merge with inputProperty object information because we need to use PropertyName, and not keyword
|
||||
|
||||
std::vector< std::vector<double> >& newPropertyData = reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex);
|
||||
std::vector< std::vector<double> >& newPropertyData = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex);
|
||||
newPropertyData.push_back(std::vector<double>());
|
||||
newPropertyData[0].resize(ecl_kw_get_size(eclKeyWordData), HUGE_VAL);
|
||||
ecl_kw_get_data_as_double(eclKeyWordData, newPropertyData[0].data());
|
||||
@ -294,13 +294,13 @@ bool RifEclipseInputFileTools::readProperty(const QString& fileName, RigReservoi
|
||||
if (eclKeyWordData)
|
||||
{
|
||||
QString newResultName = resultName;
|
||||
size_t resultIndex = reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->findScalarResultIndex(newResultName);
|
||||
size_t resultIndex = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->findScalarResultIndex(newResultName);
|
||||
if (resultIndex == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
resultIndex = reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->addEmptyScalarResult(RimDefines::INPUT_PROPERTY, newResultName);
|
||||
resultIndex = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->addEmptyScalarResult(RimDefines::INPUT_PROPERTY, newResultName);
|
||||
}
|
||||
|
||||
std::vector< std::vector<double> >& newPropertyData = reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex);
|
||||
std::vector< std::vector<double> >& newPropertyData = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex);
|
||||
newPropertyData.resize(1);
|
||||
newPropertyData[0].resize(ecl_kw_get_size(eclKeyWordData), HUGE_VAL);
|
||||
ecl_kw_get_data_as_double(eclKeyWordData, newPropertyData[0].data());
|
||||
@ -374,7 +374,7 @@ bool RifEclipseInputFileTools::writePropertyToTextFile(const QString& fileName,
|
||||
{
|
||||
CVF_ASSERT(reservoir);
|
||||
|
||||
size_t resultIndex = reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->findScalarResultIndex(resultName);
|
||||
size_t resultIndex = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->findScalarResultIndex(resultName);
|
||||
if (resultIndex == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
return false;
|
||||
@ -386,7 +386,7 @@ bool RifEclipseInputFileTools::writePropertyToTextFile(const QString& fileName,
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector< std::vector<double> >& resultData = reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex);
|
||||
std::vector< std::vector<double> >& resultData = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex);
|
||||
if (resultData.size() == 0)
|
||||
{
|
||||
return false;
|
||||
@ -406,7 +406,7 @@ bool RifEclipseInputFileTools::writeBinaryResultToTextFile(const QString& fileNa
|
||||
{
|
||||
CVF_ASSERT(reservoir);
|
||||
|
||||
size_t resultIndex = reservoir->mainGrid()->results(porosityModel)->findScalarResultIndex(resultName);
|
||||
size_t resultIndex = reservoir->results(porosityModel)->findScalarResultIndex(resultName);
|
||||
if (resultIndex == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
return false;
|
||||
@ -418,8 +418,7 @@ bool RifEclipseInputFileTools::writeBinaryResultToTextFile(const QString& fileNa
|
||||
return false;
|
||||
}
|
||||
|
||||
RigActiveCellInfo* activeCellInfo = reservoir->activeCellInfo();
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObject = reservoir->mainGrid()->dataAccessObject(activeCellInfo, porosityModel, timeStep, resultIndex);
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObject = reservoir->dataAccessObject(reservoir->mainGrid(), porosityModel, timeStep, resultIndex);
|
||||
if (dataAccessObject.isNull())
|
||||
{
|
||||
return false;
|
||||
@ -533,13 +532,13 @@ bool RifEclipseInputFileTools::readPropertyAtFilePosition(const QString& fileNam
|
||||
if (eclKeyWordData)
|
||||
{
|
||||
QString newResultName = resultName;
|
||||
size_t resultIndex = reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->findScalarResultIndex(newResultName);
|
||||
size_t resultIndex = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->findScalarResultIndex(newResultName);
|
||||
if (resultIndex == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
resultIndex = reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->addEmptyScalarResult(RimDefines::INPUT_PROPERTY, newResultName);
|
||||
resultIndex = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->addEmptyScalarResult(RimDefines::INPUT_PROPERTY, newResultName);
|
||||
}
|
||||
|
||||
std::vector< std::vector<double> >& newPropertyData = reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex);
|
||||
std::vector< std::vector<double> >& newPropertyData = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex);
|
||||
newPropertyData.resize(1);
|
||||
newPropertyData[0].resize(ecl_kw_get_size(eclKeyWordData), HUGE_VAL);
|
||||
ecl_kw_get_data_as_double(eclKeyWordData, newPropertyData[0].data());
|
||||
|
@ -372,8 +372,8 @@ bool RifReaderEclipseOutput::open(const QString& fileName, RigReservoir* reservo
|
||||
|
||||
m_reservoir = reservoir;
|
||||
|
||||
reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(this);
|
||||
reservoir->mainGrid()->results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(this);
|
||||
reservoir->results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(this);
|
||||
reservoir->results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(this);
|
||||
|
||||
// Build results meta data
|
||||
if (!buildMetaData(reservoir)) return false;
|
||||
@ -409,8 +409,8 @@ bool RifReaderEclipseOutput::buildMetaData(RigReservoir* reservoir)
|
||||
|
||||
progInfo.incrementProgress();
|
||||
|
||||
RigReservoirCellResults* matrixModelResults = m_reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS);
|
||||
RigReservoirCellResults* fractureModelResults = m_reservoir->mainGrid()->results(RifReaderInterface::FRACTURE_RESULTS);
|
||||
RigReservoirCellResults* matrixModelResults = m_reservoir->results(RifReaderInterface::MATRIX_RESULTS);
|
||||
RigReservoirCellResults* fractureModelResults = m_reservoir->results(RifReaderInterface::FRACTURE_RESULTS);
|
||||
|
||||
if (m_dynamicResultsAccess.notNull())
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ bool RifReaderMockModel::open(const QString& fileName, RigReservoir* reservoir)
|
||||
|
||||
m_reservoir = reservoir;
|
||||
|
||||
RigReservoirCellResults* cellResults = reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS);
|
||||
RigReservoirCellResults* cellResults = reservoir->results(RifReaderInterface::MATRIX_RESULTS);
|
||||
|
||||
|
||||
QList<QDateTime> dates;
|
||||
|
@ -96,8 +96,8 @@ void RivCellEdgeGeometryGenerator::addCellEdgeResultsToDrawableGeo(
|
||||
const RigGridBase* grid = dynamic_cast<const RigGridBase*>(generator->activeGrid());
|
||||
CVF_ASSERT(grid != NULL);
|
||||
|
||||
RigActiveCellInfo* activeCellInfo = cellResultSlot->reservoirView()->eclipseCase()->reservoirData()->activeCellInfo();
|
||||
CVF_ASSERT(activeCellInfo != NULL);
|
||||
RigReservoir* reservoir = cellResultSlot->reservoirView()->eclipseCase()->reservoirData();
|
||||
CVF_ASSERT(reservoir != NULL);
|
||||
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> cellCenterDataAccessObject = NULL;
|
||||
if (cellResultSlot->hasResult())
|
||||
@ -109,7 +109,7 @@ void RivCellEdgeGeometryGenerator::addCellEdgeResultsToDrawableGeo(
|
||||
}
|
||||
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigReservoirCellResults::convertFromProjectModelPorosityModel(cellResultSlot->porosityModel());
|
||||
cellCenterDataAccessObject = grid->dataAccessObject(activeCellInfo, porosityModel, timeStepIndex, cellResultSlot->gridScalarIndex());
|
||||
cellCenterDataAccessObject = reservoir->dataAccessObject(grid, porosityModel, timeStepIndex, cellResultSlot->gridScalarIndex());
|
||||
}
|
||||
|
||||
CVF_ASSERT(cellEdgeResultSlot->hasResult());
|
||||
@ -128,7 +128,7 @@ void RivCellEdgeGeometryGenerator::addCellEdgeResultsToDrawableGeo(
|
||||
{
|
||||
// Assuming static values to be mapped onto cell edge, always using time step zero
|
||||
// TODO: Now hardcoded matrix results, should it be possible to use fracture results?
|
||||
daObj = grid->dataAccessObject(activeCellInfo, RifReaderInterface::MATRIX_RESULTS, 0, resultIndices[cubeFaceIdx]);
|
||||
daObj = reservoir->dataAccessObject(grid, RifReaderInterface::MATRIX_RESULTS, 0, resultIndices[cubeFaceIdx]);
|
||||
}
|
||||
|
||||
cellEdgeDataAccessObjects.push_back(daObj.p());
|
||||
|
@ -223,8 +223,8 @@ void RivGridPartMgr::updateCellResultColor(size_t timeStepIndex, RimResultSlot*
|
||||
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigReservoirCellResults::convertFromProjectModelPorosityModel(cellResultSlot->porosityModel());
|
||||
|
||||
RigActiveCellInfo* activeCellInfo = cellResultSlot->reservoirView()->eclipseCase()->reservoirData()->activeCellInfo();
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObject = m_grid->dataAccessObject(activeCellInfo, porosityModel, resTimeStepIdx, scalarSetIndex);
|
||||
RigReservoir* reservoir = cellResultSlot->reservoirView()->eclipseCase()->reservoirData();
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObject = reservoir->dataAccessObject(m_grid.p(), porosityModel, resTimeStepIdx, scalarSetIndex);
|
||||
|
||||
if (dataAccessObject.isNull()) return;
|
||||
|
||||
|
@ -605,9 +605,9 @@ void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVis
|
||||
const RimCellFilter::FilterModeType filterType = (*pfIt)->filterMode();
|
||||
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigReservoirCellResults::convertFromProjectModelPorosityModel((*pfIt)->resultDefinition()->porosityModel());
|
||||
RigActiveCellInfo* activeCellInfo = propFilterColl->reservoirView()->eclipseCase()->reservoirData()->activeCellInfo();
|
||||
RigReservoir* reservoir = propFilterColl->reservoirView()->eclipseCase()->reservoirData();
|
||||
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObject = grid->dataAccessObject(activeCellInfo, porosityModel, timeStepIndex, scalarResultIndex);
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObject = reservoir->dataAccessObject(grid, porosityModel, timeStepIndex, scalarResultIndex);
|
||||
CVF_ASSERT(dataAccessObject.notNull());
|
||||
|
||||
#pragma omp parallel for schedule(dynamic)
|
||||
|
@ -72,8 +72,8 @@ 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());
|
||||
m_rigReservoir->results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(readerInterface.p());
|
||||
m_rigReservoir->results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(readerInterface.p());
|
||||
|
||||
m_rigReservoir->activeCellInfo()->computeDerivedData();
|
||||
|
||||
@ -183,8 +183,8 @@ bool RimInputReservoir::openEclipseGridFile()
|
||||
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->results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(readerInterface.p());
|
||||
m_rigReservoir->results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(readerInterface.p());
|
||||
m_rigReservoir->computeCachedData();
|
||||
m_rigReservoir->mainGrid()->computeCachedData();
|
||||
}
|
||||
@ -193,8 +193,8 @@ bool RimInputReservoir::openEclipseGridFile()
|
||||
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);
|
||||
RigReservoirCellResults* matrixResults = m_rigReservoir->results(RifReaderInterface::MATRIX_RESULTS);
|
||||
RigReservoirCellResults* fractureResults = m_rigReservoir->results(RifReaderInterface::FRACTURE_RESULTS);
|
||||
|
||||
matrixResults->computeDepthRelatedResults();
|
||||
fractureResults->computeDepthRelatedResults();
|
||||
@ -286,7 +286,7 @@ void RimInputReservoir::loadAndSyncronizeInputProperties()
|
||||
{
|
||||
if (fileKeywordSet.count(knownKeywords[fkIt]))
|
||||
{
|
||||
QString resultName = this->reservoirData()->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(knownKeywords[fkIt]);
|
||||
QString resultName = this->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(knownKeywords[fkIt]);
|
||||
if (RifEclipseInputFileTools::readProperty(filenames[i], this->reservoirData(), knownKeywords[fkIt], resultName))
|
||||
{
|
||||
RimInputProperty* inputProperty = new RimInputProperty;
|
||||
@ -361,7 +361,7 @@ void RimInputReservoir::removeProperty(RimInputProperty* inputProperty)
|
||||
}
|
||||
|
||||
// Remove the results pointed to by this input property
|
||||
RigReservoirCellResults* results = m_rigReservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS);
|
||||
RigReservoirCellResults* results = m_rigReservoir->results(RifReaderInterface::MATRIX_RESULTS);
|
||||
results->removeResult(inputProperty->resultName);
|
||||
|
||||
this->removeResult(inputProperty->resultName);
|
||||
|
@ -209,13 +209,13 @@ void RimReservoir::fieldChangedByUi(const caf::PdmFieldHandle* changedField, con
|
||||
reservoirView->createDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
RigReservoirCellResults* matrixModelResults = m_rigReservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS);
|
||||
RigReservoirCellResults* matrixModelResults = m_rigReservoir->results(RifReaderInterface::MATRIX_RESULTS);
|
||||
if (matrixModelResults)
|
||||
{
|
||||
matrixModelResults->clearAllResults();
|
||||
}
|
||||
|
||||
RigReservoirCellResults* fractureModelResults = m_rigReservoir->mainGrid()->results(RifReaderInterface::FRACTURE_RESULTS);
|
||||
RigReservoirCellResults* fractureModelResults = m_rigReservoir->results(RifReaderInterface::FRACTURE_RESULTS);
|
||||
if (fractureModelResults)
|
||||
{
|
||||
fractureModelResults->clearAllResults();
|
||||
|
@ -875,7 +875,7 @@ void RimReservoirView::appendCellResultInfo(size_t gridIndex, size_t cellIndex,
|
||||
if (this->cellResult()->hasResult())
|
||||
{
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigReservoirCellResults::convertFromProjectModelPorosityModel(cellResult()->porosityModel());
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObject = grid->dataAccessObject(activeCellInfo, porosityModel, m_currentTimeStep, this->cellResult()->gridScalarIndex());
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObject = reservoir->dataAccessObject(grid, porosityModel, m_currentTimeStep, this->cellResult()->gridScalarIndex());
|
||||
if (dataAccessObject.notNull())
|
||||
{
|
||||
double scalarValue = dataAccessObject->cellScalar(cellIndex);
|
||||
@ -896,7 +896,7 @@ void RimReservoirView::appendCellResultInfo(size_t gridIndex, size_t cellIndex,
|
||||
|
||||
// Cell edge results are static, results are loaded for first time step only
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigReservoirCellResults::convertFromProjectModelPorosityModel(cellResult()->porosityModel());
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObject = grid->dataAccessObject(activeCellInfo, porosityModel, 0, resultIndices[idx]);
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObject = reservoir->dataAccessObject(grid, porosityModel, 0, resultIndices[idx]);
|
||||
if (dataAccessObject.notNull())
|
||||
{
|
||||
double scalarValue = dataAccessObject->cellScalar(cellIndex);
|
||||
@ -968,7 +968,7 @@ RigReservoirCellResults* RimReservoirView::gridCellResults()
|
||||
{
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigReservoirCellResults::convertFromProjectModelPorosityModel(cellResult->porosityModel());
|
||||
|
||||
return m_reservoir->reservoirData()->mainGrid()->results(porosityModel);
|
||||
return m_reservoir->reservoirData()->results(porosityModel);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@ -1038,7 +1038,7 @@ void RimReservoirView::updateLegends()
|
||||
CVF_ASSERT(reservoir);
|
||||
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigReservoirCellResults::convertFromProjectModelPorosityModel(cellResult()->porosityModel());
|
||||
RigReservoirCellResults* results = reservoir->mainGrid()->results(porosityModel);
|
||||
RigReservoirCellResults* results = reservoir->results(porosityModel);
|
||||
CVF_ASSERT(results);
|
||||
|
||||
if (this->cellResult()->hasResult())
|
||||
|
@ -58,8 +58,8 @@ bool RimResultReservoir::openEclipseGridFile()
|
||||
{
|
||||
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());
|
||||
m_rigReservoir->results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(readerInterface.p());
|
||||
m_rigReservoir->results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(readerInterface.p());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -468,21 +468,6 @@ size_t RigGridBase::fractureModelActiveCellCount() const
|
||||
return m_fractureModelActiveCellCount;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> RigGridBase::dataAccessObject(const RigActiveCellInfo* activeCellInfo, RifReaderInterface::PorosityModelResultType porosityModel, size_t timeStepIndex, size_t scalarSetIndex) const
|
||||
{
|
||||
if (timeStepIndex != cvf::UNDEFINED_SIZE_T &&
|
||||
scalarSetIndex != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> dataAccess = RigGridScalarDataAccessFactory::createDataAccessObject(this, activeCellInfo, porosityModel, timeStepIndex, scalarSetIndex);
|
||||
return dataAccess;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -99,8 +99,6 @@ public:
|
||||
virtual bool isCellValid( size_t i, size_t j, size_t k ) const;
|
||||
virtual bool cellIJKNeighbor(size_t i, size_t j, size_t k, FaceType face, size_t* neighborCellIndex ) const;
|
||||
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObject(const RigActiveCellInfo* activeCellInfo, RifReaderInterface::PorosityModelResultType porosityModel, size_t timeStepIndex, size_t scalarSetIndex) const;
|
||||
|
||||
private:
|
||||
std::string m_gridName;
|
||||
cvf::Vec3st m_gridPointDimensions;
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "RigReservoirCellResults.h"
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigGridBase.h"
|
||||
#include "RigReservoir.h"
|
||||
|
||||
|
||||
|
||||
@ -37,7 +38,7 @@
|
||||
class RigGridAllCellsScalarDataAccess : public cvf::StructGridScalarDataAccess
|
||||
{
|
||||
public:
|
||||
RigGridAllCellsScalarDataAccess(const RigGridBase* grid, std::vector<double>* resultValues);
|
||||
RigGridAllCellsScalarDataAccess(const RigGridBase* grid, const std::vector<double>* resultValues);
|
||||
|
||||
virtual double cellScalar(size_t i, size_t j, size_t k) const;
|
||||
virtual double cellScalar(size_t cellIndex) const;
|
||||
@ -49,14 +50,14 @@ public:
|
||||
|
||||
protected:
|
||||
cvf::cref<RigGridBase> m_grid;
|
||||
std::vector<double>* m_resultValues;
|
||||
const std::vector<double>* m_resultValues;
|
||||
};
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigGridAllCellsScalarDataAccess::RigGridAllCellsScalarDataAccess(const RigGridBase* grid, std::vector<double>* resultValues) :
|
||||
RigGridAllCellsScalarDataAccess::RigGridAllCellsScalarDataAccess(const RigGridBase* grid, const std::vector<double>* resultValues) :
|
||||
m_grid(grid),
|
||||
m_resultValues(resultValues)
|
||||
{
|
||||
@ -133,7 +134,7 @@ const cvf::Vec3d* RigGridAllCellsScalarDataAccess::cellVector(size_t i, size_t j
|
||||
class RigGridMatrixActiveCellsScalarDataAccess : public RigGridAllCellsScalarDataAccess
|
||||
{
|
||||
public:
|
||||
RigGridMatrixActiveCellsScalarDataAccess(const RigGridBase* grid, std::vector<double>* resultValues, const RigActiveCellInfo* activeCellInfo) :
|
||||
RigGridMatrixActiveCellsScalarDataAccess(const RigGridBase* grid, const std::vector<double>* resultValues, const RigActiveCellInfo* activeCellInfo) :
|
||||
RigGridAllCellsScalarDataAccess(grid, resultValues),
|
||||
m_activeCellInfo(activeCellInfo)
|
||||
{
|
||||
@ -168,7 +169,7 @@ protected:
|
||||
class RigGridFractureActiveCellsScalarDataAccess : public RigGridAllCellsScalarDataAccess
|
||||
{
|
||||
public:
|
||||
RigGridFractureActiveCellsScalarDataAccess(const RigGridBase* grid, std::vector<double>* resultValues, const RigActiveCellInfo* activeCellInfo) :
|
||||
RigGridFractureActiveCellsScalarDataAccess(const RigGridBase* grid, const std::vector<double>* resultValues, const RigActiveCellInfo* activeCellInfo) :
|
||||
RigGridAllCellsScalarDataAccess(grid, resultValues),
|
||||
m_activeCellInfo(activeCellInfo)
|
||||
{
|
||||
@ -194,45 +195,46 @@ protected:
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> RigGridScalarDataAccessFactory::createDataAccessObject(const RigGridBase* grid,
|
||||
const RigActiveCellInfo* activeCellInfo,
|
||||
const RigReservoir* reservoir,
|
||||
RifReaderInterface::PorosityModelResultType porosityModel,
|
||||
size_t timeStepIndex,
|
||||
size_t scalarSetIndex)
|
||||
{
|
||||
CVF_ASSERT(grid);
|
||||
CVF_ASSERT(grid->mainGrid());
|
||||
CVF_ASSERT(grid->mainGrid()->results(porosityModel));
|
||||
CVF_ASSERT(activeCellInfo);
|
||||
CVF_ASSERT(reservoir);
|
||||
CVF_ASSERT(reservoir->results(porosityModel));
|
||||
CVF_ASSERT(reservoir->activeCellInfo());
|
||||
|
||||
if (!grid || !grid->mainGrid() || !grid->mainGrid()->results(porosityModel) || !activeCellInfo)
|
||||
if (!grid || !reservoir || !reservoir->results(porosityModel) || !reservoir->activeCellInfo())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
std::vector< std::vector<double> > & scalarSetResults = grid->mainGrid()->results(porosityModel)->cellScalarResults(scalarSetIndex);
|
||||
const std::vector< std::vector<double> > & scalarSetResults = reservoir->results(porosityModel)->cellScalarResults(scalarSetIndex);
|
||||
if (timeStepIndex >= scalarSetResults.size())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
std::vector<double>* resultValues = &(scalarSetResults[timeStepIndex]);
|
||||
const std::vector<double>* resultValues = &(scalarSetResults[timeStepIndex]);
|
||||
|
||||
|
||||
bool useGlobalActiveIndex = grid->mainGrid()->results(porosityModel)->isUsingGlobalActiveIndex(scalarSetIndex);
|
||||
bool useGlobalActiveIndex = reservoir->results(porosityModel)->isUsingGlobalActiveIndex(scalarSetIndex);
|
||||
if (useGlobalActiveIndex)
|
||||
{
|
||||
if (porosityModel == RifReaderInterface::MATRIX_RESULTS)
|
||||
{
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> object = new RigGridMatrixActiveCellsScalarDataAccess(grid, resultValues, activeCellInfo);
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> object = new RigGridMatrixActiveCellsScalarDataAccess(grid, resultValues, reservoir->activeCellInfo());
|
||||
return object;
|
||||
}
|
||||
else
|
||||
{
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> object = new RigGridFractureActiveCellsScalarDataAccess(grid, resultValues, activeCellInfo);
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> object = new RigGridFractureActiveCellsScalarDataAccess(grid, resultValues, reservoir->activeCellInfo());
|
||||
return object;
|
||||
}
|
||||
}
|
||||
@ -241,5 +243,6 @@ cvf::ref<cvf::StructGridScalarDataAccess> RigGridScalarDataAccessFactory::create
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> object = new RigGridAllCellsScalarDataAccess(grid, resultValues);
|
||||
return object;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -30,11 +30,10 @@ class RigGridScalarDataAccessFactory
|
||||
{
|
||||
public:
|
||||
static cvf::ref<cvf::StructGridScalarDataAccess> createDataAccessObject(const RigGridBase* grid,
|
||||
const RigActiveCellInfo* activeCellInfo,
|
||||
const RigReservoir* reservoir,
|
||||
RifReaderInterface::PorosityModelResultType porosityModel,
|
||||
size_t timeStepIndex,
|
||||
size_t scalarSetIndex);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -19,16 +19,12 @@
|
||||
#include "RIStdInclude.h"
|
||||
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigReservoirCellResults.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
RigMainGrid::RigMainGrid(void)
|
||||
: RigGridBase(this)
|
||||
{
|
||||
m_matrixModelResults = new RigReservoirCellResults(this);
|
||||
m_fractureModelResults = new RigReservoirCellResults(this);
|
||||
|
||||
m_displayModelOffset = cvf::Vec3d::ZERO;
|
||||
|
||||
m_gridIndex = 0;
|
||||
@ -122,29 +118,3 @@ const RigGridBase* RigMainGrid::gridByIndex(size_t localGridIndex) const
|
||||
return m_localGrids[localGridIndex-1].p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigReservoirCellResults* RigMainGrid::results(RifReaderInterface::PorosityModelResultType porosityModel)
|
||||
{
|
||||
if (porosityModel == RifReaderInterface::MATRIX_RESULTS)
|
||||
{
|
||||
return m_matrixModelResults.p();
|
||||
}
|
||||
|
||||
return m_fractureModelResults.p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RigReservoirCellResults* RigMainGrid::results(RifReaderInterface::PorosityModelResultType porosityModel) const
|
||||
{
|
||||
if (porosityModel == RifReaderInterface::MATRIX_RESULTS)
|
||||
{
|
||||
return m_matrixModelResults.p();
|
||||
}
|
||||
|
||||
return m_fractureModelResults.p();
|
||||
}
|
||||
|
||||
|
@ -27,8 +27,6 @@
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
class RigReservoirCellResults;
|
||||
|
||||
class RigMainGrid : public RigGridBase
|
||||
{
|
||||
public:
|
||||
@ -42,9 +40,6 @@ public:
|
||||
std::vector<RigCell>& cells() {return m_cells;}
|
||||
const std::vector<RigCell>& cells() const {return m_cells;}
|
||||
|
||||
RigReservoirCellResults* results(RifReaderInterface::PorosityModelResultType porosityModel);
|
||||
const RigReservoirCellResults* results(RifReaderInterface::PorosityModelResultType porosityModel) const;
|
||||
|
||||
void addLocalGrid(RigLocalGrid* localGrid);
|
||||
size_t gridCount() const { return m_localGrids.size() + 1; }
|
||||
RigGridBase* gridByIndex(size_t localGridIndex);
|
||||
@ -68,9 +63,6 @@ private:
|
||||
std::vector<RigCell> m_cells; ///< Global array of all cells in the reservoir (including the ones in LGR's)
|
||||
cvf::Collection<RigLocalGrid> m_localGrids; ///< List of all the LGR's in this reservoir
|
||||
|
||||
cvf::ref<RigReservoirCellResults> m_matrixModelResults;
|
||||
cvf::ref<RigReservoirCellResults> m_fractureModelResults;
|
||||
|
||||
cvf::Vec3d m_displayModelOffset;
|
||||
};
|
||||
|
||||
|
@ -19,6 +19,8 @@
|
||||
#include "RIStdInclude.h"
|
||||
#include "RigReservoir.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigReservoirCellResults.h"
|
||||
#include "RigGridScalarDataAccess.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -26,6 +28,9 @@
|
||||
RigReservoir::RigReservoir()
|
||||
{
|
||||
m_mainGrid = new RigMainGrid();
|
||||
|
||||
m_matrixModelResults = new RigReservoirCellResults(m_mainGrid.p());
|
||||
m_fractureModelResults = new RigReservoirCellResults(m_mainGrid.p());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -349,3 +354,45 @@ void RigReservoir::computeActiveCellsGeometryBoundingBox()
|
||||
|
||||
m_mainGrid->setDisplayModelOffset(bb.min());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigReservoirCellResults* RigReservoir::results(RifReaderInterface::PorosityModelResultType porosityModel)
|
||||
{
|
||||
if (porosityModel == RifReaderInterface::MATRIX_RESULTS)
|
||||
{
|
||||
return m_matrixModelResults.p();
|
||||
}
|
||||
|
||||
return m_fractureModelResults.p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RigReservoirCellResults* RigReservoir::results(RifReaderInterface::PorosityModelResultType porosityModel) const
|
||||
{
|
||||
if (porosityModel == RifReaderInterface::MATRIX_RESULTS)
|
||||
{
|
||||
return m_matrixModelResults.p();
|
||||
}
|
||||
|
||||
return m_fractureModelResults.p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> RigReservoir::dataAccessObject(const RigGridBase* grid, RifReaderInterface::PorosityModelResultType porosityModel, size_t timeStepIndex, size_t scalarSetIndex) const
|
||||
{
|
||||
if (timeStepIndex != cvf::UNDEFINED_SIZE_T &&
|
||||
scalarSetIndex != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> dataAccess = RigGridScalarDataAccessFactory::createDataAccessObject(grid, this, porosityModel, timeStepIndex, scalarSetIndex);
|
||||
return dataAccess;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include "RigWellResults.h"
|
||||
#include "RigActiveCellInfo.h"
|
||||
|
||||
class RigReservoirCellResults;
|
||||
|
||||
|
||||
class RigReservoir: public cvf::Object
|
||||
{
|
||||
@ -41,6 +43,13 @@ public:
|
||||
void allGrids(std::vector<const RigGridBase*>* grids) const;
|
||||
const RigGridBase* grid(size_t index) const;
|
||||
|
||||
|
||||
RigReservoirCellResults* results(RifReaderInterface::PorosityModelResultType porosityModel);
|
||||
const RigReservoirCellResults* results(RifReaderInterface::PorosityModelResultType porosityModel) const;
|
||||
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObject(const RigGridBase* grid, RifReaderInterface::PorosityModelResultType porosityModel, size_t timeStepIndex, size_t scalarSetIndex) const;
|
||||
|
||||
|
||||
void computeCachedData();
|
||||
|
||||
void setWellResults(const cvf::Collection<RigWellResults>& data);
|
||||
@ -65,8 +74,13 @@ private:
|
||||
|
||||
private:
|
||||
RigActiveCellInfo m_activeCellInfo;
|
||||
|
||||
cvf::ref<RigMainGrid> m_mainGrid;
|
||||
|
||||
cvf::ref<RigReservoirCellResults> m_matrixModelResults;
|
||||
cvf::ref<RigReservoirCellResults> m_fractureModelResults;
|
||||
|
||||
|
||||
cvf::Collection<RigWellResults> m_wellResults;
|
||||
cvf::Collection<cvf::UByteArray> m_wellCellsInGrid;
|
||||
};
|
||||
|
@ -231,6 +231,16 @@ size_t RigReservoirCellResults::timeStepCount(size_t scalarResultIndex) const
|
||||
return m_cellScalarResults[scalarResultIndex].size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector< std::vector<double> > & RigReservoirCellResults::cellScalarResults( size_t scalarResultIndex ) const
|
||||
{
|
||||
CVF_TIGHT_ASSERT(scalarResultIndex < resultCount());
|
||||
|
||||
return m_cellScalarResults[scalarResultIndex];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -71,6 +71,7 @@ public:
|
||||
void computeDepthRelatedResults();
|
||||
|
||||
// Access the results data
|
||||
const std::vector< std::vector<double> > & cellScalarResults(size_t scalarResultIndex) const;
|
||||
std::vector< std::vector<double> > & cellScalarResults(size_t scalarResultIndex);
|
||||
double cellScalarResult(size_t timeStepIndex, size_t scalarResultIndex, size_t resultValueIndex);
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
//
|
||||
@ -281,18 +280,18 @@ void RiaSocketServer::readCommandFromOctave()
|
||||
size_t scalarResultIndex = cvf::UNDEFINED_SIZE_T;
|
||||
std::vector< std::vector<double> >* scalarResultFrames = NULL;
|
||||
|
||||
if (reservoir && reservoir->reservoirData() && reservoir->reservoirData()->mainGrid() && reservoir->reservoirData()->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS))
|
||||
if (reservoir && reservoir->reservoirData() && reservoir->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS))
|
||||
{
|
||||
scalarResultIndex = reservoir->reservoirData()->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(propertyName);
|
||||
scalarResultIndex = reservoir->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(propertyName);
|
||||
|
||||
if (scalarResultIndex == cvf::UNDEFINED_SIZE_T && isSetProperty)
|
||||
{
|
||||
scalarResultIndex = reservoir->reservoirData()->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->addEmptyScalarResult(RimDefines::GENERATED, propertyName);
|
||||
scalarResultIndex = reservoir->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->addEmptyScalarResult(RimDefines::GENERATED, propertyName);
|
||||
}
|
||||
|
||||
if (scalarResultIndex != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
scalarResultFrames = &(reservoir->reservoirData()->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(scalarResultIndex));
|
||||
scalarResultFrames = &(reservoir->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(scalarResultIndex));
|
||||
m_currentScalarIndex = scalarResultIndex;
|
||||
m_currentPropertyName = propertyName;
|
||||
}
|
||||
@ -523,10 +522,9 @@ void RiaSocketServer::readPropertyDataFromOctave()
|
||||
|
||||
if( m_currentScalarIndex != cvf::UNDEFINED_SIZE_T &&
|
||||
m_currentReservoir->reservoirData() &&
|
||||
m_currentReservoir->reservoirData()->mainGrid() &&
|
||||
m_currentReservoir->reservoirData()->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS) )
|
||||
m_currentReservoir->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS) )
|
||||
{
|
||||
m_currentReservoir->reservoirData()->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->recalculateMinMax(m_currentScalarIndex);
|
||||
m_currentReservoir->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->recalculateMinMax(m_currentScalarIndex);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < m_currentReservoir->reservoirViews.size(); ++i)
|
||||
|
Loading…
Reference in New Issue
Block a user