Skip to content

Commit

Permalink
#11042 octave: Adjustments for updated API in version 7
Browse files Browse the repository at this point in the history
Minor adjustments in data access for octave version 7. Previously used and verified version is octave 4.
  • Loading branch information
magnesj committed Jan 12, 2024
1 parent d065c8e commit 3f3ced5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
7 changes: 6 additions & 1 deletion OctavePlugin/riGetActiveCellInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ void getActiveCellInfo(int32NDArray& activeCellInfo, const QString &hostName, qu
return;
}

qint32* internalMatrixData = (qint32*)activeCellInfo.fortran_vec()->mex_get_data();
#if OCTAVE_MAJOR_VERSION > 6
auto internalMatrixData = (qint32*)activeCellInfo.fortran_vec();
#else
auto internalMatrixData = (qint32*)activeCellInfo.fortran_vec()->mex_get_data();
#endif

QStringList errorMessages;
if (!RiaSocketDataTransfer::readBlockDataFromSocket(&socket, (char*)(internalMatrixData), columnCount * byteCountForOneTimestep, errorMessages))
{
Expand Down
7 changes: 6 additions & 1 deletion OctavePlugin/riGetSelectedCells.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ void getSelectedCells(int32NDArray& selectedCellInfo, const QString &hostName, q
return;
}

qint32* internalMatrixData = (qint32*)selectedCellInfo.fortran_vec()->mex_get_data();
#if OCTAVE_MAJOR_VERSION > 6
auto internalMatrixData = (qint32*)selectedCellInfo.fortran_vec();
#else
auto internalMatrixData = (qint32*)selectedCellInfo.fortran_vec()->mex_get_data();
#endif

QStringList errorMessages;
if (!RiaSocketDataTransfer::readBlockDataFromSocket(&socket, (char*)(internalMatrixData), columnCount * byteCountForOneTimestep, errorMessages))
{
Expand Down
7 changes: 5 additions & 2 deletions OctavePlugin/riSetActiveCellProperty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ void setEclipseProperty(const Matrix& propertyFrames, const QString &hostName, q
socketStream << (qint64)(timeStepCount);
socketStream << (qint64)timeStepByteCount;

const double* internalData = propertyFrames.fortran_vec();
#if OCTAVE_MAJOR_VERSION > 6
auto internalData = propertyFrames.data();
#else
auto internalData = propertyFrames.fortran_vec();
#endif

QStringList errorMessages;
if (!RiaSocketDataTransfer::writeBlockDataToSocket(&socket, (const char *)internalData, timeStepByteCount*timeStepCount, errorMessages))
Expand Down Expand Up @@ -135,7 +139,6 @@ DEFUN_DLD (riSetActiveCellProperty, args, nargout,

Matrix propertyFrames = args(0).matrix_value();


dim_vector mxDims = propertyFrames.dims();
if (mxDims.length() != 2)
{
Expand Down
6 changes: 5 additions & 1 deletion OctavePlugin/riSetGridProperty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ void setEclipseProperty(const NDArray& propertyFrames, const QString &hostName,
socketStream << (qint64)(timeStepCount);
socketStream << (qint64)singleTimeStepByteCount;

const double* internalData = propertyFrames.fortran_vec();
#if OCTAVE_MAJOR_VERSION > 6
auto internalData = propertyFrames.data();
#else
auto internalData = propertyFrames.fortran_vec();
#endif

QStringList errorMessages;
if (!RiaSocketDataTransfer::writeBlockDataToSocket(&socket, (const char *)internalData, timeStepCount*singleTimeStepByteCount, errorMessages))
Expand Down

0 comments on commit 3f3ced5

Please sign in to comment.