Octave Interface: GetActiveCellProperty now handles coarsening

p4#: 21683
This commit is contained in:
Jacob Støren 2013-05-21 14:35:47 +02:00
parent 2009838b04
commit d947f68f83
4 changed files with 44 additions and 3 deletions

View File

@ -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();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -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;

View File

@ -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;

View File

@ -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];