146 double n[3][3],t[3][3],nt[3],c1[3],c2[3],*n1,*n2,*t1,*t2;
147 double ps,ps2,ux,uy,uz,ll,l,lm,dd,M1,M2,hausd,hmin,hmax;
157 for (k=1; k<=
mesh->np; k++) {
158 p0 = &
mesh->point[k];
180 if ( !
mesh->info.nosizreq ) {
190 for (k=1; k<=
mesh->np; k++) {
191 if (
mesh->point[k].flag ) {
194 met->
m[k] =
mesh->info.hmax;
195 mesh->point[k].flag = 1;
200 for (k=1; k<=
mesh->nt; k++) {
202 if ( !
MG_EOK(pt) )
continue;
204 p[0] = &
mesh->point[pt->
v[0]];
205 p[1] = &
mesh->point[pt->
v[1]];
206 p[2] = &
mesh->point[pt->
v[2]];
209 for (i=0; i<3; i++) {
210 if (
MS_SIN(p[i]->tag) ) {
213 else if (
MG_EDG(p[i]->tag) ) {
215 n1 = &
mesh->xpoint[p[i]->
xp].n1[0];
216 n2 = &
mesh->xpoint[p[i]->
xp].n2[0];
217 ps = n1[0]*nt[0] + n1[1]*nt[1] + n1[2]*nt[2];
218 ps2 = n2[0]*nt[0] + n2[1]*nt[1] + n2[2]*nt[2];
219 if ( fabs(ps) > fabs(ps2) )
220 memcpy(&n[i],n1,3*
sizeof(
double));
222 memcpy(&n[i],n2,3*
sizeof(
double));
223 memcpy(&t[i],p[i]->n,3*
sizeof(
double));
226 memcpy(&n[i],p[i]->n,3*
sizeof(
double));
229 for (i=0; i<3; i++) {
236 hausd =
mesh->info.hausd;
237 hmin =
mesh->info.hmin;
238 hmax =
mesh->info.hmax;
240 for (j=0; j<
mesh->info.npar; j++) {
241 par = &
mesh->info.par[j];
257 ux = p[i2]->
c[0] - p[i1]->
c[0];
258 uy = p[i2]->
c[1] - p[i1]->
c[1];
259 uz = p[i2]->
c[2] - p[i1]->
c[2];
260 ll = ux*ux + uy*uy + uz*uz;
265 if (
MS_SIN(p[i1]->tag) ) {
274 if (
MS_SIN(p[i2]->tag) ) {
287 dd = (t1[0]*ux + t1[1]*uy + t1[2]*uz)/3.0;
288 c1[0] = p[i1]->
c[0] + dd * t1[0];
289 c1[1] = p[i1]->
c[1] + dd * t1[1];
290 c1[2] = p[i1]->
c[2] + dd * t1[2];
292 dd = -(t2[0]*ux + t2[1]*uy + t2[2]*uz)/3.0;
293 c2[0] = p[i2]->
c[0] + dd * t2[0];
294 c2[1] = p[i2]->
c[1] + dd * t2[1];
295 c2[2] = p[i2]->
c[2] + dd * t2[2];
297 M1 = (c2[0]-2.0*c1[0]+p[i1]->
c[0])*(c2[0]-2.0*c1[0]+p[i1]->c[0]) \
298 + (c2[1]-2.0*c1[1]+p[i1]->
c[1])*(c2[1]-2.0*c1[1]+p[i1]->c[1]) \
299 + (c2[2]-2.0*c1[2]+p[i1]->
c[2])*(c2[2]-2.0*c1[2]+p[i1]->c[2]);
301 M2 = (p[i2]->
c[0]-2.0*c2[0]+c1[0])*(p[i2]->c[0]-2.0*c2[0]+c1[0]) \
302 + (p[i2]->
c[1]-2.0*c2[1]+c1[1])*(p[i2]->c[1]-2.0*c2[1]+c1[1])\
303 + (p[i2]->
c[2]-2.0*c2[2]+c1[2])*(p[i2]->c[2]-2.0*c2[2]+c1[2]);
312 lm = (16.0*ll*hausd) / (3.0*M1);
315 if (
mesh->point[ip1].flag < 3 ) {
318 if (
mesh->point[ip2].flag < 3 ) {
326 ps = ux*n1[0] + uy*n1[1] + uz*n1[2];
327 c1[0] = (2.0*p[i1]->
c[0] + p[i2]->
c[0] - ps*n1[0]) / 3.0;
328 c1[1] = (2.0*p[i1]->
c[1] + p[i2]->
c[1] - ps*n1[1]) / 3.0;
329 c1[2] = (2.0*p[i1]->
c[2] + p[i2]->
c[2] - ps*n1[2]) / 3.0;
331 ps = -(ux*n2[0] + uy*n2[1] + uz*n2[2]);
332 c2[0] = (2.0*p[i2]->
c[0] + p[i1]->
c[0] - ps*n2[0]) / 3.0;
333 c2[1] = (2.0*p[i2]->
c[1] + p[i1]->
c[1] - ps*n2[1]) / 3.0;
334 c2[2] = (2.0*p[i2]->
c[2] + p[i1]->
c[2] - ps*n2[2]) / 3.0;
336 M1 = (c2[0]-2.0*c1[0]+p[i1]->
c[0])*(c2[0]-2.0*c1[0]+p[i1]->c[0]) \
337 + (c2[1]-2.0*c1[1]+p[i1]->
c[1])*(c2[1]-2.0*c1[1]+p[i1]->c[1]) \
338 + (c2[2]-2.0*c1[2]+p[i1]->
c[2])*(c2[2]-2.0*c1[2]+p[i1]->c[2]);
340 M2 = (p[i2]->
c[0]-2.0*c2[0]+c1[0])*(p[i2]->c[0]-2.0*c2[0]+c1[0]) \
341 + (p[i2]->
c[1]-2.0*c2[1]+c1[1])*(p[i2]->c[1]-2.0*c2[1]+c1[1])\
342 + (p[i2]->
c[2]-2.0*c2[2]+c1[2])*(p[i2]->c[2]-2.0*c2[2]+c1[2]);
351 lm = (16.0*ll*hausd) / (3.0*M1);
354 if (
mesh->point[ip1].flag < 3 ) {
357 if (
mesh->point[ip2].flag < 3 ) {
365 for (j=0; j<
mesh->info.npar; j++) {
366 par = &
mesh->info.par[j];
368 for (k=1; k<=
mesh->nt; k++) {
371 if (
mesh->point[pt->
v[0]].flag < 3 ) {
374 if (
mesh->point[pt->
v[1]].flag < 3 ) {
377 if (
mesh->point[pt->
v[2]].flag < 3 ) {
int MMGS_Set_solSize(MMG5_pMesh mesh, MMG5_pSol sol, int typEntity, MMG5_int np, int typSol)
Initialize an array of solution fields: set dimension, types and number of fields.