mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Allow dataset to be received by ResInsight from Octave to have a dimension of 3, meaning 4D dataset with one time step
Fixed comments p4#: 22143
This commit is contained in:
@@ -41,7 +41,17 @@ void setEclipseProperty(const NDArray& propertyFrames, const QString &hostName,
|
||||
qint64 cellCountI = mxDims.elem(0);
|
||||
qint64 cellCountJ = mxDims.elem(1);
|
||||
qint64 cellCountK = mxDims.elem(2);
|
||||
qint64 timeStepCount = mxDims.elem(3);
|
||||
|
||||
qint64 timeStepCount = 0;
|
||||
if (mxDims.length() > 3)
|
||||
{
|
||||
timeStepCount = mxDims.elem(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
timeStepCount = 1;
|
||||
}
|
||||
|
||||
qint64 singleTimeStepByteCount = cellCountI * cellCountJ * cellCountK * sizeof(double);
|
||||
|
||||
//octave_stdout << " Cell count I: " << cellCountI << " Cell count J: " << cellCountJ << " Cell count K: " << cellCountK << std::endl;
|
||||
@@ -85,7 +95,7 @@ void setEclipseProperty(const NDArray& propertyFrames, const QString &hostName,
|
||||
|
||||
if (socket.bytesToWrite() && socket.state() != QAbstractSocket::ConnectedState)
|
||||
{
|
||||
error("riSetActiveCellProperty : ResInsight refused to accept the data. Maybe the dimensions or porosity model is wrong.\n");
|
||||
error("riSetGridProperty : ResInsight refused to accept the data. Maybe the dimensions or porosity model is wrong.\n");
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -128,9 +138,9 @@ DEFUN_DLD (riSetGridProperty, args, nargout,
|
||||
|
||||
|
||||
dim_vector mxDims = propertyFrames.dims();
|
||||
if (mxDims.length() != 4)
|
||||
if (!(mxDims.length() == 3 || mxDims.length() == 4))
|
||||
{
|
||||
error("riSetGridProperty: The supplied Data Matrix must have four dimensions: numI*numJ*numK*numTimeSteps");
|
||||
error("riSetGridProperty: The supplied Data Matrix must have three dimensions (numI*numJ*numK*1) or four dimensions (numI*numJ*numK*numTimeSteps)");
|
||||
print_usage();
|
||||
|
||||
return octave_value_list ();
|
||||
@@ -200,8 +210,15 @@ DEFUN_DLD (riSetGridProperty, args, nargout,
|
||||
if (argIndices[4] >= 0) timeStepIndices = args(argIndices[4]).int32_array_value();
|
||||
if (argIndices[5] >= 0) porosityModel = args(argIndices[5]).string_value();
|
||||
|
||||
if (timeStepIndices.length())
|
||||
if (timeStepIndices.length() > 1)
|
||||
{
|
||||
if (mxDims.length() == 3)
|
||||
{
|
||||
error("riSetGridProperty: The input matrix has three dimensions, but there are more than one time step in [TimeStepIndices]. If more than one time step is defined, the data matrix must be 4D.");
|
||||
print_usage();
|
||||
return octave_value_list ();
|
||||
}
|
||||
|
||||
int timeStepCount = mxDims.elem(3);
|
||||
if (timeStepIndices.length() != timeStepCount)
|
||||
{
|
||||
@@ -213,7 +230,7 @@ DEFUN_DLD (riSetGridProperty, args, nargout,
|
||||
|
||||
if (porosityModel != "Matrix" && porosityModel != "Fracture")
|
||||
{
|
||||
error("riSetActiveCellProperty: The value for \"PorosityModel\" is unknown. Please use either \"Matrix\" or \"Fracture\"\n");
|
||||
error("riSetGridProperty: The value for \"PorosityModel\" is unknown. Please use either \"Matrix\" or \"Fracture\"\n");
|
||||
print_usage();
|
||||
return octave_value_list ();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user