Octave Interface: Fixed wrong timestep array detection

The test to check whether an argument was a array of timestep indices
was not good enough. Text was also interpreted as a matrix.
Typechecking of the arguments is difficult due to the lack of
documentation of the octave API
This commit is contained in:
Jacob Støren 2013-10-06 08:45:40 +02:00 committed by JacobStoren
parent 05ae735519
commit a7ba7c793c
5 changed files with 13 additions and 14 deletions

View File

@ -1,7 +1,6 @@
### The case with caseid 1 has to be selected/active in ResInsight when running this test-script
### Coarsening and Dual porosity is not exercised by this tes yet. We need models
### CaseInfo riGetCurrentCase()
printf ("===== Testing ====> riGetCurrentCase\n");
caseInfo = riGetCurrentCase();
@ -58,25 +57,25 @@ PropertyInfos4 = riGetPropertyNames(1, "Matrix");
### Matrix[numActiveCells][numTimestepsRequested] riGetActiveCellProperty([CaseId], PropertyName, [RequestedTimeSteps], [PorosityModel = "Matrix"|"Fracture"])
printf ("===== Testing ====> riGetActiveCellProperty\n");
ActivePropData1 = riGetActiveCellProperty("SOIL");
##ActivePropData2 = riGetActiveCellProperty("SOIL", "Matrix");
ActivePropData2 = riGetActiveCellProperty("SOIL", "Matrix");
ActivePropData3 = riGetActiveCellProperty("SOIL", [1,3]);
ActivePropData4 = riGetActiveCellProperty("SOIL", [1,3], "Matrix");
ActivePropData5 = riGetActiveCellProperty(1, "SOIL");
ActivePropData6 = riGetActiveCellProperty(1, "SOIL", [1,3]);
ActivePropData7 = riGetActiveCellProperty(1, "SOIL", [1,3], "Matrix");
##ActivePropData8 = riGetActiveCellProperty(1, "SOIL", "Matrix");
ActivePropData8 = riGetActiveCellProperty(1, "SOIL", "Matrix");
### Matrix[numI][numJ][numK][numTimestepsRequested] riGetGridProperty([CaseId], GridIndex , PropertyName, [RequestedTimeSteps], [PorosityModel = "Matrix"|"Fracture"])
printf ("===== Testing ====> riGetGridProperty\n");
GridProps1 = riGetGridProperty( 0 , "SOIL" );
GridProps2 = riGetGridProperty( 0 , "SOIL", [1,3]);
GridProps3 = riGetGridProperty( 0 , "SOIL", [1,3], "Matrix");
##GridProps4 = riGetGridProperty( 0 , "SOIL", "Matrix");
GridProps4 = riGetGridProperty( 0 , "SOIL", "Matrix");
GridProps5 = riGetGridProperty(1, 0 , "SOIL" );
GridProps6 = riGetGridProperty(1, 0 , "SOIL", [1,3]);
GridProps7 = riGetGridProperty(1, 0 , "SOIL", [1,3], "Matrix");
##GridProps8 = riGetGridProperty(1, 0 , "SOIL", "Matrix");
GridProps8 = riGetGridProperty(1, 0 , "SOIL", "Matrix");
### riSetActiveCellProperty( Matrix[numActiveCells][numTimeSteps], [CaseId], PropertyName, [TimeStepIndices], [PorosityModel = "Matrix"|"Fracture"])
@ -85,22 +84,22 @@ riSetActiveCellProperty( ActivePropData1, "PropertyName1" );
riSetActiveCellProperty( ActivePropData3, "PropertyName2", [1,3]);
riSetActiveCellProperty( ActivePropData3, "PropertyName3", [1,3], "Matrix");
##riSetActiveCellProperty( ActivePropData1, "PropertyName4", "Matrix");
riSetActiveCellProperty( ActivePropData1, "PropertyName4", "Matrix");
riSetActiveCellProperty( ActivePropData1, 1, "PropertyName5" );
riSetActiveCellProperty( ActivePropData3, 1, "PropertyName6", [1,3]);
riSetActiveCellProperty( ActivePropData3, 1, "PropertyName7", [1,3], "Matrix");
##riSetActiveCellProperty( ActivePropData1, 1, "PropertyName8", "Matrix");
riSetActiveCellProperty( ActivePropData1, 1, "PropertyName8", "Matrix");
### riSetGridProperty( Matrix[numI][numJ][numK][numTimeSteps], [CaseId], GridIndex, PropertyName, [TimeStepIndices], [PorosityModel = "Matrix"|"Fracture"])
printf ("===== Testing ====> riSetGridProperty\n");
riSetGridProperty( GridProps1, 0, "PropertyName11" );
riSetGridProperty( GridProps2, 0, "PropertyName12", [1,3]);
riSetGridProperty( GridProps2, 0, "PropertyName13", [1,3], "Matrix");
##riSetGridProperty( GridProps1, 0, "PropertyName14", "Matrix");
riSetGridProperty( GridProps1, 0, "PropertyName14", "Matrix");
riSetGridProperty( GridProps1, 1, 0, "PropertyName15" );
riSetGridProperty( GridProps2, 1, 0, "PropertyName16", [1,3]);
riSetGridProperty( GridProps2, 1, 0, "PropertyName17", [1,3], "Matrix");
##riSetGridProperty( GridProps1, 1, 0, "PropertyName18", "Matrix");
riSetGridProperty( GridProps1, 1, 0, "PropertyName18", "Matrix");
### Matrix[numI][numJ][numK][3] riGetCellCenters([CaseId], GridIndex)

View File

@ -168,8 +168,8 @@ DEFUN_DLD (riGetActiveCellProperty, args, nargout,
}
// Check if we have a Requested TimeSteps
if (!(nargin > argIndices[2] && args(argIndices[2]).is_matrix_type()))
if (!(nargin > argIndices[2] && args(argIndices[2]).is_matrix_type() && !args(argIndices[2]).is_string()))
{
argIndices[2] = -1;
for (size_t aIdx = 3; aIdx < argIndices.size(); ++aIdx)

View File

@ -168,7 +168,7 @@ DEFUN_DLD (riGetGridProperty, args, nargout,
// Check if we have a Requested TimeSteps
if (!(nargin > argIndices[3] && args(argIndices[3]).is_matrix_type()))
if (!(nargin > argIndices[3] && args(argIndices[3]).is_matrix_type() && !args(argIndices[3]).is_string()))
{
argIndices[3] = -1;
for (size_t aIdx = 3; aIdx < argIndices.size(); ++aIdx)

View File

@ -146,7 +146,7 @@ DEFUN_DLD (riSetActiveCellProperty, args, nargout,
// Check if we have a Requested TimeSteps
if (!(nargin > argIndices[3] && args(argIndices[3]).is_matrix_type()))
if (!(nargin > argIndices[3] && args(argIndices[3]).is_matrix_type() && !args(argIndices[3]).is_string()))
{
argIndices[3] = -1;
for (size_t aIdx = 4; aIdx < argIndices.size(); ++aIdx)

View File

@ -176,7 +176,7 @@ DEFUN_DLD (riSetGridProperty, args, nargout,
// Check if we have a Requested TimeSteps
if (!(nargin > argIndices[4] && args(argIndices[4]).is_matrix_type()))
if (!(nargin > argIndices[4] && args(argIndices[4]).is_matrix_type() && !args(argIndices[4]).is_string()))
{
argIndices[4] = -1;
for (size_t aIdx = 5; aIdx < argIndices.size(); ++aIdx)