Overview
Comment:Fixed some memory leaks.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 17f786bed8a8802e78d91e144b6686de0bcc7c12a137ef1d5fc9af90680e089f
User & Date: geraint@users.sourceforge.net on 2002-05-14 20:19:06
Other Links: branch diff | manifest | tags
Context
2002-05-15
11:01:24
New PI controller component check-in: d2e6dc7890 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
2002-05-14
20:19:06
Fixed some memory leaks. check-in: 17f786bed8 user: geraint@users.sourceforge.net tags: origin/master, trunk
15:43:41
Complete rewrite check-in: 99eaa00ae6 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/lib/rep/sfun_rep/sfun.cc.tmpl from [0ed4c539b6] to [3d56d803b8].

102
103
104
105
106
107
108


109
110
111
112
113
114
115
  prhs[0] = P;
  
  mexCallMATLAB (1, plhs, 1, prhs, "<mtt_model_name>_state");  

  for (int i = 0; i < MTTNX; i++) {
    ssGetContStates (S)[i] = states [i];
  }


}

static void mdlOutputs(SimStruct *S, int_T tid)
{
  static mxArray *plhs[1];
  static mxArray *prhs[4];








>
>







102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
  prhs[0] = P;
  
  mexCallMATLAB (1, plhs, 1, prhs, "<mtt_model_name>_state");  

  for (int i = 0; i < MTTNX; i++) {
    ssGetContStates (S)[i] = states [i];
  }

  mxDestroyArray (plhs[0]);
}

static void mdlOutputs(SimStruct *S, int_T tid)
{
  static mxArray *plhs[1];
  static mxArray *prhs[4];

127
128
129
130
131
132
133


134
135
136
137
138
139
140

  mexCallMATLAB (1, plhs, 4, prhs, "<mtt_model_name>_odeo");
  double *outputs = mxGetPr (plhs[0]);

  for (int i = 0; i < MTTNY; i++) {
      ssGetOutputPortRealSignal (S,i)[0] = outputs [i];
  }


}

#define MDL_DERIVATIVES
static void mdlDerivatives(SimStruct *S)
{
  static mxArray *plhs[1];
  static mxArray *prhs[4];







>
>







129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144

  mexCallMATLAB (1, plhs, 4, prhs, "<mtt_model_name>_odeo");
  double *outputs = mxGetPr (plhs[0]);

  for (int i = 0; i < MTTNY; i++) {
      ssGetOutputPortRealSignal (S,i)[0] = outputs [i];
  }

  mxDestroyArray (plhs[0]);
}

#define MDL_DERIVATIVES
static void mdlDerivatives(SimStruct *S)
{
  static mxArray *plhs[1];
  static mxArray *prhs[4];
151
152
153
154
155
156
157


158
159
160
161
162
163
164
165
166
167
168
169

  mexCallMATLAB (1, plhs, 4, prhs, "<mtt_model_name>_ode");
  double *rates= mxGetPr (plhs[0]);
  
  for (int i = 0; i < MTTNX; i++) {
    ssGetdX (S)[i] = rates [i];
  }


}

static void mdlTerminate(SimStruct *S)
{
    UNUSED_ARG(S);
}

#ifdef  MATLAB_MEX_FILE    /* Is this file being compiled as a MEX-file? */
#include "simulink.c"      /* MEX-file interface mechanism */
#else
#include "cg_sfun.h"       /* Code generation registration function */
#endif







>
>












155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175

  mexCallMATLAB (1, plhs, 4, prhs, "<mtt_model_name>_ode");
  double *rates= mxGetPr (plhs[0]);
  
  for (int i = 0; i < MTTNX; i++) {
    ssGetdX (S)[i] = rates [i];
  }

  mxDestroyArray (plhs[0]);
}

static void mdlTerminate(SimStruct *S)
{
    UNUSED_ARG(S);
}

#ifdef  MATLAB_MEX_FILE    /* Is this file being compiled as a MEX-file? */
#include "simulink.c"      /* MEX-file interface mechanism */
#else
#include "cg_sfun.h"       /* Code generation registration function */
#endif


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]