*** empty log message ***
This commit is contained in:
parent
3b3b97942d
commit
cfccafb938
5 changed files with 68 additions and 4 deletions
|
|
@ -21,7 +21,8 @@ SRCS = cantera/private/ctmethods.cpp \
|
|||
cantera/private/wallmethods.cpp \
|
||||
cantera/private/flowdevicemethods.cpp \
|
||||
cantera/private/onedimmethods.cpp \
|
||||
cantera/private/surfmethods.cpp
|
||||
cantera/private/surfmethods.cpp \
|
||||
cantera/private/funcmethods.cpp
|
||||
|
||||
CANTERA_LIBDIR=@buildlib@
|
||||
os_is_win=@OS_IS_WIN@
|
||||
|
|
@ -61,6 +62,7 @@ install:
|
|||
@INSTALL@ -d @prefix@/matlab/toolbox/cantera/cantera/@Reactor/private
|
||||
@INSTALL@ -d @prefix@/matlab/toolbox/cantera/cantera/@Wall/private
|
||||
@INSTALL@ -d @prefix@/matlab/toolbox/cantera/cantera/@FlowDevice/private
|
||||
@INSTALL@ -d @prefix@/matlab/toolbox/cantera/cantera/@Func/private
|
||||
@INSTALL@ -d @prefix@/matlab/toolbox/cantera/cantera/1D
|
||||
@INSTALL@ -d @prefix@/matlab/toolbox/cantera/cantera/1D/@Domain1D/private
|
||||
@INSTALL@ -d @prefix@/matlab/toolbox/cantera/cantera/1D/@Stack/private
|
||||
|
|
@ -100,6 +102,10 @@ install:
|
|||
@prefix@/matlab/toolbox/cantera/cantera/@FlowDevice
|
||||
cd cantera/@FlowDevice/private; @INSTALL@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/@FlowDevice/private
|
||||
cd cantera/@Func; @INSTALL@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/@Func
|
||||
cd cantera/@Func/private; @INSTALL@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/@Func/private
|
||||
cd cantera/1D; @INSTALL@ *.m \
|
||||
@prefix@/matlab/toolbox/cantera/cantera/1D
|
||||
cd cantera/1D/@Domain1D; @INSTALL@ *.m \
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ const int WALL_CLASS = 70;
|
|||
const int FLOWDEVICE_CLASS = 80;
|
||||
const int ONEDIM_CLASS = 90;
|
||||
const int SURF_CLASS = 100;
|
||||
const int FUNC_CLASS = 110;
|
||||
|
||||
void ctfunctions( int nlhs, mxArray *plhs[], int nrhs,
|
||||
const mxArray *prhs[] );
|
||||
|
|
@ -62,6 +63,9 @@ void flowdevicemethods( int nlhs, mxArray *plhs[], int nrhs,
|
|||
void onedimmethods( int nlhs, mxArray *plhs[], int nrhs,
|
||||
const mxArray *prhs[] );
|
||||
|
||||
void funcmethods( int nlhs, mxArray *plhs[], int nrhs,
|
||||
const mxArray *prhs[] );
|
||||
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
|
@ -72,9 +76,6 @@ extern "C" {
|
|||
// flag specifying the class
|
||||
int iclass = getInt(prhs[0]);
|
||||
|
||||
// specifies that function writelog should write to MATLAB
|
||||
//Cantera::setMatlabMode(true);
|
||||
|
||||
// Hand off to the appropriate routine, based on the
|
||||
// value of the first parameter
|
||||
switch (iclass) {
|
||||
|
|
@ -100,6 +101,8 @@ extern "C" {
|
|||
onedimmethods(nlhs, plhs, nrhs, prhs); break;
|
||||
case SURF_CLASS:
|
||||
surfmethods(nlhs, plhs, nrhs, prhs); break;
|
||||
case FUNC_CLASS:
|
||||
funcmethods(nlhs, plhs, nrhs, prhs); break;
|
||||
default:
|
||||
mexErrMsgTxt("unknown class");
|
||||
}
|
||||
|
|
|
|||
53
Cantera/matlab/cantera/private/funcmethods.cpp
Normal file
53
Cantera/matlab/cantera/private/funcmethods.cpp
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
|
||||
#include "mex.h"
|
||||
#include "ctmatutils.h"
|
||||
#include "../../../clib/src/ctfunc.h"
|
||||
|
||||
|
||||
void funcmethods( int nlhs, mxArray *plhs[],
|
||||
int nrhs, const mxArray *prhs[] )
|
||||
{
|
||||
int job = getInt(prhs[1]);
|
||||
int nn;
|
||||
|
||||
// constructor
|
||||
if (job == 0) {
|
||||
int type = getInt(prhs[2]);
|
||||
int n = getInt(prhs[3]);
|
||||
double* ptr = mxGetPr(prhs[4]);
|
||||
int msize = mxGetM(prhs[4]);
|
||||
int nsize = mxGetN(prhs[4]);
|
||||
int lenp = msize*nsize;
|
||||
nn = func_new(type, n, lenp, ptr);
|
||||
plhs[0] = mxCreateNumericMatrix(1,1,mxDOUBLE_CLASS,mxREAL);
|
||||
double *h = mxGetPr(plhs[0]);
|
||||
*h = double(nn);
|
||||
if (nn < 0) reportError();
|
||||
return;
|
||||
}
|
||||
|
||||
else {
|
||||
int nn = 0;
|
||||
double t;
|
||||
double v;
|
||||
int i = getInt(prhs[2]);
|
||||
if (job == 1) {
|
||||
nn = func_del(int i);
|
||||
if (nn < 0) reportError();
|
||||
v = double(nn);
|
||||
}
|
||||
else if (job == 2) {
|
||||
t = getDouble(prhs[3]);
|
||||
v = func_value(i, t);
|
||||
if (v == Undef) reportError();
|
||||
}
|
||||
else {
|
||||
mexErrMsgTxt("unknown job parameter");
|
||||
}
|
||||
plhs[0] = mxCreateNumericMatrix(1,1,mxDOUBLE_CLASS,mxREAL);
|
||||
double *h = mxGetPr(plhs[0]);
|
||||
*h = v;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -18,6 +18,7 @@ mex private/ctmethods.cpp private/ctfunctions.cpp ...
|
|||
private/thermomethods.cpp private/kineticsmethods.cpp ...
|
||||
private/transportmethods.cpp private/reactormethods.cpp ...
|
||||
private/wallmethods.cpp private/flowdevicemethods.cpp ...
|
||||
prinvate/funcmethods.cpp ...
|
||||
private/onedimmethods.cpp private/surfmethods.cpp private/write.cpp ...
|
||||
"""+'-I'+incdir+' -L'+libdir+' '+libs+'\n'+"""disp('done.');
|
||||
""")
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ mex -I"""+incdir+""" private/ctmethods.cpp private/ctfunctions.cpp ...
|
|||
private/thermomethods.cpp private/kineticsmethods.cpp ...
|
||||
private/transportmethods.cpp private/reactormethods.cpp ...
|
||||
private/wallmethods.cpp private/flowdevicemethods.cpp ...
|
||||
private/funcmethods.cpp ...
|
||||
private/onedimmethods.cpp private/surfmethods.cpp private/write.cpp ...
|
||||
""")
|
||||
s = ''
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue