mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Octave Interface: GetActiveCellProperty now handles coarsening
p4#: 21683
This commit is contained in:
parent
2009838b04
commit
d947f68f83
@ -38,6 +38,14 @@ void RigActiveCellInfo::setGlobalCellCount(size_t globalCellCount)
|
||||
m_cellIndexToResultIndex.resize(globalCellCount, cvf::UNDEFINED_SIZE_T);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigActiveCellInfo::globalCellCount() const
|
||||
{
|
||||
m_cellIndexToResultIndex.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -33,6 +33,7 @@ public:
|
||||
RigActiveCellInfo();
|
||||
|
||||
void setGlobalCellCount(size_t globalCellCount);
|
||||
size_t globalCellCount() const;
|
||||
|
||||
bool isActive(size_t globalCellIndex) const;
|
||||
size_t cellResultIndex(size_t globalCellIndex) const;
|
||||
|
@ -648,7 +648,36 @@ public:
|
||||
socketStream << timestepCount;
|
||||
|
||||
// then the byte-size of the result values in one timestep
|
||||
// TODO: Rewrite to handle coarsening
|
||||
|
||||
const RigActiveCellInfo* activeInfo = rimCase->reservoirData()->activeCellInfo(porosityModelEnum);
|
||||
size_t timestepResultCount = activeInfo->globalActiveCellCount();
|
||||
|
||||
quint64 timestepByteCount = (quint64)(timestepResultCount*sizeof(double));
|
||||
socketStream << timestepByteCount ;
|
||||
|
||||
// Then write the data.
|
||||
|
||||
size_t globalCellCount = activeInfo->globalCellCount();
|
||||
for (size_t tIdx = 0; tIdx < requestedTimesteps.size(); ++tIdx)
|
||||
{
|
||||
for (size_t gcIdx = 0; gcIdx < globalCellCount; ++gcIdx)
|
||||
{
|
||||
size_t resultIdx = activeInfo->cellResultIndex(gcIdx);
|
||||
if (resultIdx != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
if (resultIdx < scalarResultFrames->at(requestedTimesteps[tIdx]).size())
|
||||
{
|
||||
socketStream << scalarResultFrames->at(requestedTimesteps[tIdx])[resultIdx];
|
||||
}
|
||||
else
|
||||
{
|
||||
socketStream << HUGE_VAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
// This aproach is faster but does not handle coarsening
|
||||
size_t timestepResultCount = scalarResultFrames->front().size();
|
||||
quint64 timestepByteCount = (quint64)(timestepResultCount*sizeof(double));
|
||||
socketStream << timestepByteCount ;
|
||||
@ -666,6 +695,7 @@ public:
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -83,9 +83,11 @@ void getEclipseProperty(Matrix& propertyFrames, const QString &serverName, quint
|
||||
qint64 bytesRead = 0;
|
||||
double * internalMatrixData = propertyFrames.fortran_vec();
|
||||
|
||||
#if 1 // Use raw data transfer. Faster.
|
||||
bytesRead = socket.read((char*)(internalMatrixData + tIdx * activeCellCount), byteCount);
|
||||
#if 0
|
||||
// Raw data transfer. Faster. Not possible when dealing with coarsening
|
||||
// bytesRead = socket.read((char*)(internalMatrixData + tIdx * activeCellCount), byteCount);
|
||||
#else
|
||||
// Compatible transfer. Now the only one working
|
||||
for (size_t cIdx = 0; cIdx < activeCellCount; ++cIdx)
|
||||
{
|
||||
socketStream >> internalMatrixData[tIdx * activeCellCount + cIdx];
|
||||
|
Loading…
Reference in New Issue
Block a user