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:
Magne Sjaastad 2013-08-09 13:42:25 +02:00
parent ff45f6885e
commit b45c49104a
2 changed files with 28 additions and 10 deletions

View File

@ -130,7 +130,7 @@ DEFUN_DLD (riGetGridProperty, args, nargout,
{
if (nargout < 1)
{
error("riGetActiveCellProperty: Missing output argument.\n");
error("riGetGridProperty: Missing output argument.\n");
print_usage();
return octave_value_list ();
}
@ -138,14 +138,14 @@ DEFUN_DLD (riGetGridProperty, args, nargout,
int nargin = args.length ();
if (nargin < 2)
{
error("riGetActiveCellProperty: Too few arguments. The name of the property and index of the grid requested is neccesary.\n");
error("riGetGridProperty: Too few arguments. The name of the property and index of the grid requested is neccesary.\n");
print_usage();
return octave_value_list ();
}
if (nargin > 5)
{
error("riGetActiveCellProperty: Too many arguments.\n");
error("riGetGridProperty: Too many arguments.\n");
print_usage();
return octave_value_list ();
}
@ -187,7 +187,7 @@ DEFUN_DLD (riGetGridProperty, args, nargout,
// Check if we have more arguments than we should
if (nargin > lastArgumentIndex + 1)
{
error("riGetActiveCellProperty: Unexpected argument after the PorosityModel.\n");
error("riGetGridProperty: Unexpected argument after the PorosityModel.\n");
print_usage();
return octave_value_list ();
}
@ -207,6 +207,7 @@ DEFUN_DLD (riGetGridProperty, args, nargout,
if (argIndices[3] >= 0) requestedTimeSteps = args(argIndices[3]).int32_array_value();
if (argIndices[4] >= 0) porosityModel = args(argIndices[4]).string_value();
if (porosityModel != "Matrix" && porosityModel != "Fracture")
{
error("riGetGridProperty: The value for \"PorosityModel\" is unknown. Please use either \"Matrix\" or \"Fracture\"\n");

View File

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