Block transfer for active cell info

This commit is contained in:
Magne Sjaastad 2014-04-15 14:03:41 +02:00
parent b4821ed7a3
commit 476387fda4
2 changed files with 4 additions and 17 deletions

View File

@ -132,20 +132,9 @@ public:
quint64 timestepByteCount = (quint64)(timestepResultCount*sizeof(qint32));
socketStream << timestepByteCount;
// Then write the data.
for (size_t tIdx = 0; tIdx < columnCount; ++tIdx)
{
#if 1 // Write data as raw bytes, fast but does not handle byteswapping
RiaSocketTools::writeBlockData(server, server->currentClient(), (const char *)activeCellInfo[tIdx].data(), timestepByteCount);
#else // Write data using QDataStream, does byteswapping for us. Must use QDataStream on client as well
for (size_t cIdx = 0; cIdx < activeCellInfo[tIdx].size(); ++cIdx)
{
socketStream << activeCellInfo[tIdx][cIdx];
}
#endif
}
// Write data as raw bytes, fast but does not handle byteswapping
RiaSocketTools::writeBlockData(server, server->currentClient(), (const char *)activeCellInfo.data(), columnCount*timestepByteCount);
return true;
}

View File

@ -2,10 +2,8 @@
#include <QStringList>
#include <octave/oct.h>
#include "riSettings.h"
#include "riSocketTools.h"
#include "RiaSocketDataTransfer.cpp" // NB! Include cpp-file to avoid linking of additional file in oct-compile configuration
void getActiveCellInfo(int32NDArray& activeCellInfo, const QString &hostName, quint16 port, const qint64& caseId, const QString& porosityModel)
{
@ -67,7 +65,7 @@ void getActiveCellInfo(int32NDArray& activeCellInfo, const QString &hostName, qu
qint32* internalMatrixData = (qint32*)activeCellInfo.fortran_vec()->mex_get_data();
QStringList errorMessages;
if (!readBlockData(socket, (char*)(internalMatrixData), columnCount * byteCountForOneTimestep, errorMessages))
if (!RiaSocketDataTransfer::readBlockDataFromSocket(&socket, (char*)(internalMatrixData), columnCount * byteCountForOneTimestep, errorMessages))
{
for (int i = 0; i < errorMessages.size(); i++)
{