/* IN : ind_tr, XYZv, weight, defl, tri_pt4 OUT : Cii_lin weight = (sig1-sig2)/((sig1+sig2)*2*pi) */ #include #include "mex.h" #define NR_NEIGH_TRI 10 /* Max # of triangle neighbours */ void Cii_constant(double C[], double ind_tr[], int Ntri, double XYZv[], int Nvert, double weight, double defl, double tri_pt4[]) { double pi, dO, dO1, dO2, dO3 ; double si[3], r1[3], r2[3], r3[3], det, den ; double d1, d2, d3, sumOm, di2pi ; double r21[3], r32[3], r13[3], l21, l32, l13 ; double g1, g2 ,g3, Ome[3], z1[3], z2[3], z3[3] ; double tmp[3], n[3], nn, beta, ideuxA, epsi ; double a[3][3], b[3], deter, rc[3], r_b[3], R ; /* r0 = si, for the calculuus of the ASA */ double psi1, psi2, phi12, Ome_n[NR_NEIGH_TRI], Ome_ro ; int i, j, u, v, w, nze, lze[NR_NEIGH_TRI] ; /* 10 neighbouring triangles max for the ASA */ printf("Nvert = %d\n",Nvert) ; printf("Ntri = %d\n",Ntri) ; printf("weight = %f , defl = %f \n",weight,defl) ; epsi = .00000000000000001 ; pi = 4.*atan(1.) ; for (i=0;i1) { mexErrMsgTxt("Only ONE output : Cii_lin") ; } mind=mxGetM(prhs[0]) ; nind=mxGetN(prhs[0]) ; if (!mxIsNumeric(prhs[0]) || mxIsComplex(prhs[0]) || mxIsSparse(prhs[0]) || (nind!=3)) { mexErrMsgTxt("tri must be a matrix : Ntri x 3") ; } mXYZv=mxGetM(prhs[1]) ; nXYZv=mxGetN(prhs[1]) ; if (!mxIsNumeric(prhs[1]) || mxIsComplex(prhs[1]) || mxIsSparse(prhs[1]) || (nXYZv!=3) ) { mexErrMsgTxt("XYZv must be a matrix : Nvert x 3") ; } if (!mxIsNumeric(prhs[2]) || mxIsComplex(prhs[2]) || mxIsSparse(prhs[2]) || !mxIsDouble(prhs[2]) || mxGetN(prhs[2])*mxGetM(prhs[2])!=1 ) { mexErrMsgTxt("weight must be a scalar") ; } if (!mxIsNumeric(prhs[3]) || mxIsComplex(prhs[3]) || mxIsSparse(prhs[3]) || !mxIsDouble(prhs[3]) || mxGetN(prhs[3])*mxGetM(prhs[3])!=1 ) { mexErrMsgTxt("defl must be a scalar") ; } mtri_pt4=mxGetM(prhs[4]) ; ntri_pt4=mxGetN(prhs[4]) ; if (!mxIsNumeric(prhs[4]) || mxIsComplex(prhs[4]) || mxIsSparse(prhs[4]) || (ntri_pt4!=3) || (mtri_pt4!=mind)) { mexErrMsgTxt("tri_pt4 must be a matrix : Ntri x 3") ; } plhs[0]=mxCreateDoubleMatrix(mXYZv,mXYZv,mxREAL) ; Cii_c = mxGetPr(plhs[0]) ; ind_tr = mxGetPr(prhs[0]) ; XYZv = mxGetPr(prhs[1]) ; weight = mxGetScalar(prhs[2]) ; defl = mxGetScalar(prhs[3]) ; tri_pt4 = mxGetPr(prhs[4]) ; Cii_constant(Cii_c, ind_tr, mind, XYZv, mXYZv, weight, defl, tri_pt4) ; mxSetPr(plhs[0],Cii_c) ; }