Skip to content
Snippets Groups Projects
Commit 53ac59f8 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

fix msvc compile

parent 409bc12b
No related branches found
No related tags found
No related merge requests found
...@@ -189,8 +189,6 @@ double MQuadrangle::angleShapeMeasure() ...@@ -189,8 +189,6 @@ double MQuadrangle::angleShapeMeasure()
double MQuadrangle::getInnerRadius() double MQuadrangle::getInnerRadius()
{ {
double R = 1.e22;
#if defined(HAVE_MESH) #if defined(HAVE_MESH)
// get the coordinates (x, y, z) of the 4 points defining the Quad // get the coordinates (x, y, z) of the 4 points defining the Quad
double x[4] = {_v[0]->x(), _v[1]->x(), _v[2]->x(), _v[3]->x()}; double x[4] = {_v[0]->x(), _v[1]->x(), _v[2]->x(), _v[3]->x()};
...@@ -200,7 +198,7 @@ double MQuadrangle::getInnerRadius() ...@@ -200,7 +198,7 @@ double MQuadrangle::getInnerRadius()
// get the coefficient (a,b,c,d) of the mean plane - least square! // get the coefficient (a,b,c,d) of the mean plane - least square!
// the plane has for equation " a*x+b*y+c*z+d=0 " // the plane has for equation " a*x+b*y+c*z+d=0 "
// compute the centroïd of the 4 points // compute the centroid of the 4 points
double xm = (x[0] + x[1] + x[2] + x[3]) / 4; double xm = (x[0] + x[1] + x[2] + x[3]) / 4;
double ym = (y[0] + y[1] + y[2] + y[3]) / 4; double ym = (y[0] + y[1] + y[2] + y[3]) / 4;
double zm = (z[0] + z[1] + z[2] + z[3]) / 4; double zm = (z[0] + z[1] + z[2] + z[3]) / 4;
...@@ -246,12 +244,15 @@ double MQuadrangle::getInnerRadius() ...@@ -246,12 +244,15 @@ double MQuadrangle::getInnerRadius()
// go from XYZ-plane to XY-plane // go from XYZ-plane to XY-plane
// 4 points, 4 edges => 4 inner radii of circles tangent to (at least) 3 of the four edges! // 4 points, 4 edges => 4 inner radii of circles tangent to (at
// least) 3 of the four edges!
double xn[4], yn[4], r[4]; double xn[4], yn[4], r[4];
planarQuad_xyz2xy(xp, yp, zp, xn, yn); planarQuad_xyz2xy(xp, yp, zp, xn, yn);
// compute for each of the 4 possibilities the incircle radius, keeping the minimum // compute for each of the 4 possibilities the incircle radius,
// keeping the minimum
double R = 1.e22;
for (int j = 0; j < 4; j++){ for (int j = 0; j < 4; j++){
r[j] = computeInnerRadiusForQuad(xn, yn, j); r[j] = computeInnerRadiusForQuad(xn, yn, j);
if(r[j] < R){ if(r[j] < R){
......
...@@ -49,9 +49,7 @@ double MTetrahedronN::distoShapeMeasure() ...@@ -49,9 +49,7 @@ double MTetrahedronN::distoShapeMeasure()
double MTetrahedron::getInnerRadius() double MTetrahedron::getInnerRadius()
{ {
#if defined(HAVE_MESH) #if defined(HAVE_MESH)
double r = 0.; double dist[3], face_area = 0.;
double dist[3];
double face_area = 0.;
double vol = getVolume(); double vol = getVolume();
for(int i = 0; i < 4; i++){ for(int i = 0; i < 4; i++){
MFace f = getFace(i); MFace f = getFace(i);
...@@ -59,15 +57,17 @@ double MTetrahedron::getInnerRadius() ...@@ -59,15 +57,17 @@ double MTetrahedron::getInnerRadius()
MEdge e = f.getEdge(j); MEdge e = f.getEdge(j);
dist[j] = e.getVertex(0)->distance(e.getVertex(1)); dist[j] = e.getVertex(0)->distance(e.getVertex(1));
} }
face_area+=0.25*sqrt((dist[0]+dist[1]+dist[2])*(-dist[0]+dist[1]+dist[2])*(dist[0]-dist[1]+dist[2])*(dist[0]+dist[1]-dist[2])); face_area += 0.25 * sqrt((dist[0] + dist[1] + dist[2]) *
(-dist[0] + dist[1] + dist[2]) *
(dist[0] - dist[1] + dist[2]) *
(dist[0] + dist[1] - dist[2]));
} }
return 3 * vol / face_area;
r = 3*vol/face_area;
#else #else
r=0.; return 0.;
#endif #endif
return r;
} }
double MTetrahedron::gammaShapeMeasure() double MTetrahedron::gammaShapeMeasure()
{ {
#if defined(HAVE_MESH) #if defined(HAVE_MESH)
......
...@@ -37,16 +37,13 @@ double MTriangle::distoShapeMeasure() ...@@ -37,16 +37,13 @@ double MTriangle::distoShapeMeasure()
double MTriangle::getInnerRadius() double MTriangle::getInnerRadius()
{ {
#if defined(HAVE_MESH) #if defined(HAVE_MESH)
double r = 0.; double dist[3], k = 0.;
double dist[3];
double k = 0.;
for (int i = 0; i < 3; i++){ for (int i = 0; i < 3; i++){
MEdge e = getEdge(i); MEdge e = getEdge(i);
dist[i] = e.getVertex(0)->distance(e.getVertex(1)); dist[i] = e.getVertex(0)->distance(e.getVertex(1));
k += 0.5 * dist[i]; k += 0.5 * dist[i];
} }
r = sqrt(k * (k - dist[0]) * (k - dist[1]) * (k - dist[2])) / k; return sqrt(k * (k - dist[0]) * (k - dist[1]) * (k - dist[2])) / k;
return r;
#else #else
return 0.; return 0.;
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment