/* The gateway function */
void mexFunction( int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[])
{
mwIndex InterestBE;
mwIndex BladeElement;
double *WakeXYZ;
double *RQuarter;
double *BE_RControl;
double *BE_Gamma;
double *GCBladeElement;
const mwSize *dimsWakeXYZ;
const mwSize *dimsBE_RControl;
mwSize NoOfBlades, NoOfFilaments, NoOfSegments, NoOfWakeItems;
mwSize NoOfElements, NoOfDimensions;
double p_CompressibleBiot;
double *p_M;
double *p_CompressibleWakeMachMax;
mwSize p_WakePointsNo;
double p_BoundVorticity;
double *p_VortexCoreOffset;
double *p_VortexDelta;
double *p_kin_visc;
double *p_VatistasN;
//----------------------------------------------------------
// First retrieve inputs
//----------------------------------------------------------
/* Get the value of the scalar input InterestBE */
InterestBE = (mwIndex)mxGetScalar(prhs[0]);
/* Get the value of the scalar input Filament */
BladeElement = (mwIndex)mxGetScalar(prhs[1]);
/* create a pointer to the real data in the WakeXYZ matrix */
WakeXYZ = mxGetPr(prhs[2]);
/* create a pointer to the real data in the RQuarter matrix */
RQuarter = mxGetPr(prhs[3]);
/* create a pointer to the real data in the BE_RControl matrix */
BE_RControl = mxGetPr(prhs[4]);
/* create a pointer to the real data in the BE_RControl matrix */
BE_Gamma = mxGetPr(prhs[5]);
/* create pointers to the fields of the conf structure */
p_CompressibleBiot = mxGetScalar(mxGetField(prhs[6], 0, "CompressibleBiot"));
p_M = mxGetPr(mxGetField(prhs[6], 0, "M"));
p_CompressibleWakeMachMax = mxGetPr(mxGetField(prhs[6], 0, "CompressibleWakeMachMax"));
p_VortexCoreOffset = mxGetPr(mxGetField(prhs[6], 0, "VortexCoreOffset"));
p_VortexDelta = mxGetPr(mxGetField(prhs[6], 0, "VortexDelta"));
p_kin_visc = mxGetPr(mxGetField(prhs[6], 0, "kin_visc"));
p_VatistasN = mxGetPr(mxGetField(prhs[6], 0, "VatistasN"));
p_WakePointsNo = (mwSize)mxGetScalar(mxGetField(prhs[6],0,"WakePoints"));
p_BoundVorticity = mxGetScalar(mxGetField(prhs[6],0,"BoundVorticity"));
// Get the dimensions of the WakeXYZ array
dimsWakeXYZ = mxGetDimensions(prhs[2]);
// Get the dimensions of the BE_RControl array
dimsBE_RControl = mxGetDimensions(prhs[4]);
NoOfBlades = dimsWakeXYZ[0];
NoOfFilaments = dimsWakeXYZ[1];
NoOfSegments = dimsWakeXYZ[2];
NoOfWakeItems = dimsWakeXYZ[3];
NoOfElements = dimsBE_RControl[1];
//----------------------------------------------------------
// Call the calculation subroutine
//----------------------------------------------------------
/* create the output matrix */
plhs[0] = mxCreateDoubleMatrix(1,3,mxREAL);
GCBladeElement = mxGetPr(plhs[0]);
BladeElementGC(InterestBE, BladeElement,
WakeXYZ, RQuarter, BE_RControl, BE_Gamma,
NoOfBlades, NoOfFilaments, NoOfSegments, NoOfWakeItems,
NoOfElements,
p_CompressibleBiot, *p_M, *p_CompressibleWakeMachMax,
*p_VortexCoreOffset,
*p_VortexDelta,
*p_kin_visc,
*p_VatistasN,
p_BoundVorticity,
GCBladeElement);
}