#3962 Octave : Replace deprecated function is_numeric_type

This commit is contained in:
Magne Sjaastad 2019-01-15 07:28:50 +01:00
parent 791a896be4
commit fff68b3ea6
18 changed files with 32 additions and 22 deletions

View File

@ -112,7 +112,7 @@ DEFUN_DLD (riGetActiveCellCenters, args, nargout,
if (nargin == 1)
{
if (args(0).is_numeric_type())
if (riOctavePlugin::isOctaveValueNumeric(args(0)))
{
caseId = args(0).uint_value();
}
@ -123,7 +123,7 @@ DEFUN_DLD (riGetActiveCellCenters, args, nargout,
}
else if (nargin == 2)
{
if (args(0).is_numeric_type())
if (riOctavePlugin::isOctaveValueNumeric(args(0)))
{
caseId = args(0).uint_value();
porosityModel = args(1).string_value();

View File

@ -112,7 +112,7 @@ DEFUN_DLD (riGetActiveCellCorners, args, nargout,
if (nargin == 1)
{
if (args(0).is_numeric_type())
if (riOctavePlugin::isOctaveValueNumeric(args(0)))
{
caseId = args(0).uint_value();
}
@ -123,7 +123,7 @@ DEFUN_DLD (riGetActiveCellCorners, args, nargout,
}
else if (nargin == 2)
{
if (args(0).is_numeric_type())
if (riOctavePlugin::isOctaveValueNumeric(args(0)))
{
caseId = args(0).uint_value();
porosityModel = args(1).string_value();

View File

@ -129,7 +129,7 @@ DEFUN_DLD (riGetActiveCellInfo, args, nargout,
if (nargin > 0)
{
if (args(0).is_numeric_type())
if (riOctavePlugin::isOctaveValueNumeric(args(0)))
{
unsigned int argCaseId = args(0).uint_value();
caseId = argCaseId;
@ -142,7 +142,7 @@ DEFUN_DLD (riGetActiveCellInfo, args, nargout,
if (nargin > 1)
{
if (args(1).is_numeric_type())
if (riOctavePlugin::isOctaveValueNumeric(args(1)))
{
unsigned int argCaseId = args(1).uint_value();
caseId = argCaseId;

View File

@ -139,7 +139,7 @@ DEFUN_DLD (riGetActiveCellProperty, args, nargout,
argIndices.push_back(3);
// Check if we have a CaseId:
if (!args(argIndices[0]).is_numeric_type())
if (!riOctavePlugin::isOctaveValueNumeric(args(argIndices[0])))
{
argIndices[0] = -1;
for (size_t aIdx = 1; aIdx < argIndices.size(); ++aIdx)
@ -148,7 +148,7 @@ DEFUN_DLD (riGetActiveCellProperty, args, nargout,
// Check if we have a Requested TimeSteps
if (!(nargin > argIndices[2] && (args(argIndices[2]).is_matrix_type() || args(argIndices[2]).is_numeric_type()) && !args(argIndices[2]).is_string()))
if (!(nargin > argIndices[2] && (args(argIndices[2]).is_matrix_type() || riOctavePlugin::isOctaveValueNumeric(args(argIndices[2]))) && !args(argIndices[2]).is_string()))
{
argIndices[2] = -1;
for (size_t aIdx = 3; aIdx < argIndices.size(); ++aIdx)

View File

@ -107,7 +107,7 @@ DEFUN_DLD (riGetCoarseningInfo, args, nargout,
qint64 caseId = -1;
if (nargin > 0)
{
if (args(0).is_numeric_type())
if (riOctavePlugin::isOctaveValueNumeric(args(0)))
{
unsigned int argCaseId = args(0).uint_value();
caseId = argCaseId;

View File

@ -133,7 +133,7 @@ DEFUN_DLD (riGetDynamicNNCValues, args, nargout,
argIndices.push_back(2);
// Check if we have a CaseId:
if (!args(argIndices[0]).is_numeric_type())
if (!riOctavePlugin::isOctaveValueNumeric(args(argIndices[0])))
{
argIndices[0] = -1;
for (size_t aIdx = 1; aIdx < argIndices.size(); ++aIdx)

View File

@ -111,7 +111,7 @@ DEFUN_DLD (riGetGridDimensions, args, nargout,
qint64 caseId = -1;
if (nargin > 0)
{
if (args(0).is_numeric_type())
if (riOctavePlugin::isOctaveValueNumeric(args(0)))
{
unsigned int argCaseId = args(0).uint_value();
caseId = argCaseId;

View File

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

View File

@ -139,7 +139,7 @@ DEFUN_DLD (riGetGridPropertyForSelectedCells, args, nargout,
argIndices.push_back(3);
// Check if we have a CaseId:
if (!args(argIndices[0]).is_numeric_type())
if (!riOctavePlugin::isOctaveValueNumeric(args(argIndices[0])))
{
argIndices[0] = -1;
for (size_t aIdx = 1; aIdx < argIndices.size(); ++aIdx)
@ -148,7 +148,7 @@ DEFUN_DLD (riGetGridPropertyForSelectedCells, args, nargout,
// Check if we have a Requested TimeSteps
if (!(nargin > argIndices[2] && (args(argIndices[2]).is_matrix_type() || args(argIndices[2]).is_numeric_type()) && !args(argIndices[2]).is_string()))
if (!(nargin > argIndices[2] && (args(argIndices[2]).is_matrix_type() || riOctavePlugin::isOctaveValueNumeric(args(argIndices[2]))) && !args(argIndices[2]).is_string()))
{
argIndices[2] = -1;
for (size_t aIdx = 3; aIdx < argIndices.size(); ++aIdx)

View File

@ -115,7 +115,7 @@ DEFUN_DLD(riGetNNCConnections, args, nargout,
if (nargin > 0)
{
if (args(0).is_numeric_type())
if (riOctavePlugin::isOctaveValueNumeric(args(0)))
{
unsigned int argCaseId = args(0).uint_value();
caseId = argCaseId;

View File

@ -114,7 +114,7 @@ DEFUN_DLD (riGetStaticNNCValues, args, nargout,
argIndices.push_back(1);
// Check if we have a CaseId:
if (!args(argIndices[0]).is_numeric_type())
if (!riOctavePlugin::isOctaveValueNumeric(args(argIndices[0])))
{
argIndices[0] = -1;
for (size_t aIdx = 1; aIdx < argIndices.size(); ++aIdx)

View File

@ -126,7 +126,7 @@ DEFUN_DLD (riGetTimeStepDates, args, nargout,
qint64 caseId = -1;
if (nargin > 0)
{
if (args(0).is_numeric_type())
if (riOctavePlugin::isOctaveValueNumeric(args(0)))
{
unsigned int argCaseId = args(0).uint_value();
caseId = argCaseId;

View File

@ -99,7 +99,7 @@ DEFUN_DLD (riGetTimeStepDays, args, nargout,
qint64 caseId = -1;
if (nargin > 0)
{
if (args(0).is_numeric_type())
if (riOctavePlugin::isOctaveValueNumeric(args(0)))
{
unsigned int argCaseId = args(0).uint_value();
caseId = argCaseId;

View File

@ -167,7 +167,7 @@ DEFUN_DLD (riGetWellCells, args, nargout,
return octave_value();
}
if (!args(argIndices[2]).is_numeric_type()) // Check if the TimeStep argument is actually a number
if (!riOctavePlugin::isOctaveValueNumeric(args(argIndices[2]))) // Check if the TimeStep argument is actually a number
{
error("riGetWellCells: The last argument must be a timestep index.\n");
print_usage();

View File

@ -136,7 +136,7 @@ DEFUN_DLD (riGetWellStatus, args, nargout,
// Check if we have a Requested TimeSteps
int lastArgumentIndex = argIndices[2] ;
if (!(nargin > argIndices[2] && (args(argIndices[2]).is_matrix_type() || args(argIndices[2]).is_numeric_type())))
if (!(nargin > argIndices[2] && (args(argIndices[2]).is_matrix_type() || riOctavePlugin::isOctaveValueNumeric(args(argIndices[2])))))
{
argIndices[2] = -1;
}

View File

@ -160,7 +160,7 @@ DEFUN_DLD (riSetActiveCellProperty, args, nargout,
argIndices.push_back(4);
// Check if we have a CaseId:
if (!args(argIndices[1]).is_numeric_type())
if (!riOctavePlugin::isOctaveValueNumeric(args(argIndices[1])))
{
argIndices[1] = -1;
for (size_t aIdx = 2; aIdx < argIndices.size(); ++aIdx)

View File

@ -159,7 +159,7 @@ DEFUN_DLD (riSetNNCProperty, args, nargout,
argIndices.push_back(3);
// Check if we have a CaseId:
if (!args(argIndices[1]).is_numeric_type())
if (!riOctavePlugin::isOctaveValueNumeric(args(argIndices[1])))
{
argIndices[1] = -1;
for (size_t aIdx = 2; aIdx < argIndices.size(); ++aIdx)

View File

@ -66,5 +66,15 @@ namespace riOctavePlugin
char cellIndex_I[] = "I";
char cellIndex_J[] = "J";
char cellIndex_K[] = "K";
bool isOctaveValueNumeric(const octave_value& value)
{
#if (OCTAVE_MAJOR_VERSION >= 4 && OCTAVE_MINOR_VERSION >= 4)
return value.isnumeric();
#else
return value.is_numeric_type();
#endif
}
}