summaryrefslogtreecommitdiff
path: root/sci_gateway/cpp/sci_iofunc.cpp
diff options
context:
space:
mode:
authorHarpreet2015-11-24 11:50:13 +0530
committerHarpreet2015-11-24 11:50:13 +0530
commit92e88ea2600cc66ff8e8b7bb9c63bf72d78f1619 (patch)
treee4ae42f00de606e65ec3e6acb7fc7ce3366e2209 /sci_gateway/cpp/sci_iofunc.cpp
parent5d6df2fd95bc566d3b9efab874ad26c4a4789b71 (diff)
downloadFOSSEE-Optimization-toolbox-92e88ea2600cc66ff8e8b7bb9c63bf72d78f1619.tar.gz
FOSSEE-Optimization-toolbox-92e88ea2600cc66ff8e8b7bb9c63bf72d78f1619.tar.bz2
FOSSEE-Optimization-toolbox-92e88ea2600cc66ff8e8b7bb9c63bf72d78f1619.zip
code optimization
Diffstat (limited to 'sci_gateway/cpp/sci_iofunc.cpp')
-rw-r--r--sci_gateway/cpp/sci_iofunc.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/sci_gateway/cpp/sci_iofunc.cpp b/sci_gateway/cpp/sci_iofunc.cpp
index e1c8610..395aa3a 100644
--- a/sci_gateway/cpp/sci_iofunc.cpp
+++ b/sci_gateway/cpp/sci_iofunc.cpp
@@ -159,6 +159,28 @@ int getDoubleMatrixFromScilab(int argNum, int *rows, int *cols, double **dest)
return 0;
}
+int getFixedSizeDoubleMatrixInList(int argNum, int itemPos, int rows, int cols, double **dest)
+{
+ int *varAddress,inputMatrixRows,inputMatrixCols;
+ SciErr sciErr;
+ const char errMsg[]="Wrong type for input argument #%d: A matrix of double of size %d by %d is expected.\n";
+ const int errNum=999;
+ //same steps as above
+ sciErr = getVarAddressFromPosition(pvApiCtx, argNum, &varAddress);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ getMatrixOfDoubleInList(pvApiCtx, varAddress, itemPos, &rows, &cols, dest);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+}
+
int return0toScilab()
{
int iRet;
@@ -192,3 +214,36 @@ int returnDoubleToScilab(double retVal)
//ReturnArguments(pvApiCtx);
return 0;
}
+
+int returnDoubleMatrixToScilab(int itemPos, int rows, int cols, double *dest)
+{
+ SciErr sciErr;
+ //same steps as above
+ sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + itemPos, rows, cols, dest);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+
+ AssignOutputVariable(pvApiCtx, itemPos) = nbInputArgument(pvApiCtx)+itemPos;
+
+ return 0;
+}
+
+int returnIntegerMatrixToScilab(int itemPos, int rows, int cols, int *dest)
+{
+ SciErr sciErr;
+ //same steps as above
+ sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + itemPos, rows, cols, dest);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+
+ AssignOutputVariable(pvApiCtx, itemPos) = nbInputArgument(pvApiCtx)+itemPos;
+
+ return 0;
+}
+