Use read/write functions of the stream to increase performance

p4#: 21699
This commit is contained in:
Magne Sjaastad 2013-05-23 11:55:33 +02:00
parent 511ea74d4e
commit f556171bec
2 changed files with 11 additions and 7 deletions

View File

@ -365,15 +365,19 @@ public:
quint64 byteCount = cellCount * 3 * sizeof(double);
socketStream << byteCount;
for (size_t i = 0; i < cellCount; i++)
{
cvf::Vec3d center = rigGrid->cell(i).center();
std::vector<double> cellCenterValues(cellCount * 3);
socketStream << center.x();
socketStream << center.y();
socketStream << center.z();
for (size_t localGridCellIdx = 0; localGridCellIdx < rigGrid->cellCount(); localGridCellIdx++)
{
cvf::Vec3d center = rigGrid->cell(localGridCellIdx).center();
cellCenterValues[localGridCellIdx * 3 + 0] = center.x();
cellCenterValues[localGridCellIdx * 3 + 1] = center.y();
cellCenterValues[localGridCellIdx * 3 + 2] = center.z();
}
server->currentClient()->write((const char *)cellCenterValues.data(), byteCount);
return true;
}
};

View File

@ -92,7 +92,7 @@ void getCellCenters(NDArray& cellCenterValues, const QString &hostName, quint16
double* internalMatrixData = cellCenterValues.fortran_vec();
#if 1
#if 0
double val;
for (octave_idx_type i = 0; i < valueCount; i++)
{