Compute_cell_geometry(): Don't print misleading
diagnostic message. We don't know if we should emit a diagnostic concerning non-positive cell volumes until we have accumulated all tetrahedral contributions. While here, amend the diagnostic message to also report the cell in which non-positive volumes are detected.
This commit is contained in:
16
geometry.c
16
geometry.c
@@ -131,6 +131,12 @@ compute_cell_geometry(int ndims, double *coords,
|
|||||||
double ccell[3];
|
double ccell[3];
|
||||||
double cface[3] = {0};
|
double cface[3] = {0};
|
||||||
const double twothirds = 0.666666666666666666666666666667;
|
const double twothirds = 0.666666666666666666666666666667;
|
||||||
|
|
||||||
|
int ndigits;
|
||||||
|
|
||||||
|
ndigits = ((int) (log(ncells) / log(10.0))) + 1;
|
||||||
|
|
||||||
|
|
||||||
for (c=0; c<ncells; ++c)
|
for (c=0; c<ncells; ++c)
|
||||||
{
|
{
|
||||||
int num_faces;
|
int num_faces;
|
||||||
@@ -214,9 +220,6 @@ compute_cell_geometry(int ndims, double *coords,
|
|||||||
}
|
}
|
||||||
|
|
||||||
volume += tet_volume;
|
volume += tet_volume;
|
||||||
if(!(volume>0)){
|
|
||||||
fprintf(stderr, "Internal error in mex_compute_geometry: negative volume\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* face centroid of triangle */
|
/* face centroid of triangle */
|
||||||
for (i=0; i<ndims; ++i) cface[i] = (x[i]+twothirds*0.5*(u[i]+v[i]));
|
for (i=0; i<ndims; ++i) cface[i] = (x[i]+twothirds*0.5*(u[i]+v[i]));
|
||||||
@@ -229,6 +232,13 @@ compute_cell_geometry(int ndims, double *coords,
|
|||||||
for (i=0; i<ndims; ++i) u[i] = v[i];
|
for (i=0; i<ndims; ++i) u[i] = v[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! (volume > 0.0)) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"Internal error in mex_compute_geometry(%*d): "
|
||||||
|
"negative volume\n", ndigits, c);
|
||||||
|
}
|
||||||
|
|
||||||
for (i=0; i<ndims; ++i) ccentroids[3*c+i] = xcell[i] + ccell[i]/volume;
|
for (i=0; i<ndims; ++i) ccentroids[3*c+i] = xcell[i] + ccell[i]/volume;
|
||||||
cvolumes[c] = volume;
|
cvolumes[c] = volume;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user