Result Storage: Finally things have come together, and seems to behave.

Refactored the loadProject system to make loading of statistical cases work as they should.
Got the update of references regarding grid and unionActive cells work
Introduced a bool to keep track of what cell results to store.
Introduced a clear method in ActiveCellInfo.
Renamed a bit
p4#: 21036
This commit is contained in:
Jacob Støren
2013-03-21 15:31:47 +01:00
parent d0d96ba145
commit 326cd79754
20 changed files with 334 additions and 155 deletions

View File

@@ -158,6 +158,19 @@ void RigActiveCellInfo::setMatrixActiveCellsGeometryBoundingBox(cvf::BoundingBox
m_matrixActiveCellsBoundingBox = bb;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigActiveCellInfo::clear()
{
m_perGridActiveCellInfo.clear();
m_activeInMatrixModel.clear();
m_globalMatrixModelActiveCellCount = 0;
m_activeCellPositionMin = cvf::Vec3st(0,0,0);
m_activeCellPositionMax = cvf::Vec3st(0,0,0);
m_matrixActiveCellsBoundingBox.reset();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -51,6 +51,8 @@ public:
cvf::BoundingBox matrixActiveCellsGeometryBoundingBox() const;
void setMatrixActiveCellsGeometryBoundingBox(cvf::BoundingBox bb);
void clear();
private:
class GridActiveCellCounts
{

View File

@@ -277,7 +277,7 @@ public:
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigEclipseCase::computeActiveCellData()
void RigEclipseCase::computeActiveCellIJKBBox()
{
CellRangeBB matrixModelActiveBB;
CellRangeBB fractureModelActiveBB;
@@ -306,9 +306,9 @@ void RigEclipseCase::computeActiveCellData()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigEclipseCase::computeCachedData()
void RigEclipseCase::computeActiveCellBoundingBoxes()
{
computeActiveCellData();
computeActiveCellIJKBBox();
computeActiveCellsGeometryBoundingBox();
}

View File

@@ -59,20 +59,18 @@ public:
size_t timeStepIndex,
size_t scalarSetIndex);
void setWellResults(const cvf::Collection<RigWellResults>& data);
void setWellResults(const cvf::Collection<RigWellResults>& data);
const cvf::Collection<RigWellResults>& wellResults() { return m_wellResults; }
cvf::UByteArray* wellCellsInGrid(size_t gridIndex);
RigCell& cellFromWellResultCell(const RigWellResultCell& wellResultCell);
bool findSharedSourceFace(cvf::StructGridInterface::FaceType& sharedSourceFace, const RigWellResultCell& sourceWellCellResult, const RigWellResultCell& otherWellCellResult) const;
void computeCachedData();
//void closeReaderInterface();
void computeActiveCellBoundingBoxes();
private:
void computeActiveCellData();
void computeActiveCellIJKBBox();
void computeWellCellsPrGrid();
void computeActiveCellsGeometryBoundingBox();

View File

@@ -337,7 +337,7 @@ size_t RigReservoirCellResults::findScalarResultIndex(const QString& resultName)
/// Adds an empty scalar set, and returns the scalarResultIndex to it.
/// if resultName already exists, it returns the scalarResultIndex to the existing result.
//--------------------------------------------------------------------------------------------------
size_t RigReservoirCellResults::addEmptyScalarResult(RimDefines::ResultCatType type, const QString& resultName)
size_t RigReservoirCellResults::addEmptyScalarResult(RimDefines::ResultCatType type, const QString& resultName, bool needsToBeStored)
{
size_t scalarResultIndex = cvf::UNDEFINED_SIZE_T;
@@ -346,7 +346,7 @@ size_t RigReservoirCellResults::addEmptyScalarResult(RimDefines::ResultCatType t
{
scalarResultIndex = this->resultCount();
m_cellScalarResults.push_back(std::vector<std::vector<double> >());
ResultInfo resInfo(type, resultName, scalarResultIndex);
ResultInfo resInfo(type, needsToBeStored, resultName, scalarResultIndex);
m_resultInfos.push_back(resInfo);
}
@@ -435,9 +435,8 @@ void RigReservoirCellResults::setTimeStepDates(size_t scalarResultIndex, const s
m_resultInfos[scalarResultIndex].m_timeStepDates = dates;
// We need this. But not yet ...
//std::vector< std::vector<double> >& dataValues = this->cellScalarResults(scalarResultIndex);
//dataValues.resize(dates.size());
std::vector< std::vector<double> >& dataValues = this->cellScalarResults(scalarResultIndex);
dataValues.resize(dates.size());
}
//--------------------------------------------------------------------------------------------------
@@ -517,9 +516,9 @@ void RigReservoirCellResults::clearAllResults()
//--------------------------------------------------------------------------------------------------
/// Add a result with given type and name, and allocate one result vector for the static result values
//--------------------------------------------------------------------------------------------------
size_t RigReservoirCellResults::addStaticScalarResult(RimDefines::ResultCatType type, const QString& resultName, size_t resultValueCount)
size_t RigReservoirCellResults::addStaticScalarResult(RimDefines::ResultCatType type, const QString& resultName, bool needsToBeStored, size_t resultValueCount)
{
size_t resultIdx = addEmptyScalarResult(type, resultName);
size_t resultIdx = addEmptyScalarResult(type, resultName, needsToBeStored);
m_cellScalarResults[resultIdx].push_back(std::vector<double>());
m_cellScalarResults[resultIdx][0].resize(resultValueCount, HUGE_VAL);

View File

@@ -35,10 +35,7 @@ class RigReservoirCellResults : public cvf::Object
public:
RigReservoirCellResults(RigMainGrid* ownerGrid);
//void setReaderInterface(RifReaderInterface* readerInterface);
//RifReaderInterface* readerInterface();
void setMainGrid(RigMainGrid* ownerGrid);
void setMainGrid(RigMainGrid* ownerGrid);
// Max and min values of the results
void recalculateMinMax(size_t scalarResultIndex);
@@ -64,14 +61,14 @@ public:
size_t findScalarResultIndex(RimDefines::ResultCatType type, const QString& resultName) const;
size_t findScalarResultIndex(const QString& resultName) const;
size_t addEmptyScalarResult(RimDefines::ResultCatType type, const QString& resultName);
size_t addEmptyScalarResult(RimDefines::ResultCatType type, const QString& resultName, bool needsToBeStored);
QString makeResultNameUnique(const QString& resultNameProposal) const;
void removeResult(const QString& resultName);
void clearAllResults();
// Access the results data
const std::vector< std::vector<double> > & cellScalarResults(size_t scalarResultIndex) const;
std::vector< std::vector<double> > & cellScalarResults(size_t scalarResultIndex);
std::vector<double>& cellScalarResults(size_t scalarResultIndex, size_t timeStepIndex);
@@ -83,14 +80,15 @@ public:
class ResultInfo
{
public:
ResultInfo(RimDefines::ResultCatType resultType, QString resultName, size_t gridScalarResultIndex)
: m_resultType(resultType), m_resultName(resultName), m_gridScalarResultIndex(gridScalarResultIndex) { }
ResultInfo(RimDefines::ResultCatType resultType, bool needsToBeStored, QString resultName, size_t gridScalarResultIndex)
: m_resultType(resultType), m_needsToBeStored(needsToBeStored), m_resultName(resultName), m_gridScalarResultIndex(gridScalarResultIndex) { }
public:
RimDefines::ResultCatType m_resultType;
bool m_needsToBeStored;
QString m_resultName;
size_t m_gridScalarResultIndex;
std::vector<QDateTime> m_timeStepDates;
std::vector<QDateTime> m_timeStepDates;
};
const std::vector<ResultInfo>& infoForEachResultIndex() { return m_resultInfos;}
@@ -98,6 +96,7 @@ public:
public:
size_t addStaticScalarResult(RimDefines::ResultCatType type,
const QString& resultName,
bool needsToBeStored,
size_t resultValueCount);
private: