diff --git a/Geo/GModelIO.cpp b/Geo/GModelIO.cpp index 962f6b409276185b50761e9bb00024f5fee5bb8b..ee1d3fa573d8d110fc812e87f5a39f6d5a8e09e9 100644 --- a/Geo/GModelIO.cpp +++ b/Geo/GModelIO.cpp @@ -1,4 +1,4 @@ -// $Id: GModelIO.cpp,v 1.56 2006-09-23 02:48:09 geuzaine Exp $ +// $Id: GModelIO.cpp,v 1.57 2006-09-26 01:05:43 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -680,7 +680,9 @@ int GModel::writePOS(const std::string &name, double scalingFactor) return 0; } - if(numRegion()){ + int status = getMeshStatus(); + + if(status >= 3){ fprintf(fp, "View \"Volumes\" {\n"); fprintf(fp, "T2(1.e5,30,%d){\"Elementary Entity\", \"Element Number\", " "\"Gamma\", \"Eta\", \"Rho\"};\n", (1<<16)|(4<<8)); @@ -697,7 +699,7 @@ int GModel::writePOS(const std::string &name, double scalingFactor) fprintf(fp, "};\n"); } - if(numFace()){ + if(status >= 2){ fprintf(fp, "View \"Surfaces\" {\n"); fprintf(fp, "T2(1.e5,30,%d){\"Elementary Entity\", \"Element Number\", " "\"Gamma\", \"Eta\", \"Rho\"};\n", (1<<16)|(4<<8)); @@ -710,7 +712,7 @@ int GModel::writePOS(const std::string &name, double scalingFactor) fprintf(fp, "};\n"); } - if(numEdge()){ + if(status >= 1){ fprintf(fp, "View \"Lines\" {\n"); fprintf(fp, "T2(1.e5,30,%d){\"Elementary Entity\", \"Element Number\", " "\"Gamma\", \"Eta\", \"Rho\"};\n", (1<<16)|(4<<8)); diff --git a/Geo/MElement.cpp b/Geo/MElement.cpp index 3950b2a0bbe286a39701ffbd9434463cee7703ff..5eeb4cb1cf0a5942870586dc58aa9f81efae3211 100644 --- a/Geo/MElement.cpp +++ b/Geo/MElement.cpp @@ -1,4 +1,4 @@ -// $Id: MElement.cpp,v 1.20 2006-09-10 15:36:15 geuzaine Exp $ +// $Id: MElement.cpp,v 1.21 2006-09-26 01:05:44 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -26,20 +26,12 @@ int MElement::_globalNum = 0; -static double dist(MVertex *v1, MVertex *v2) -{ - double dx = v1->x() - v2->x(); - double dy = v1->y() - v2->y(); - double dz = v1->z() - v2->z(); - return sqrt(dx * dx + dy * dy + dz * dz); -} - double MElement::minEdge() { double m = 1.e25; for(int i = 0; i < getNumEdges(); i++){ MEdge e = getEdge(i); - m = std::min(m, dist(e.getVertex(0), e.getVertex(1))); + m = std::min(m, e.getVertex(0)->distance(e.getVertex(1))); } return m; } @@ -49,7 +41,7 @@ double MElement::maxEdge() double m = 0.; for(int i = 0; i < getNumEdges(); i++){ MEdge e = getEdge(i); - m = std::max(m, dist(e.getVertex(0), e.getVertex(1))); + m = std::max(m, e.getVertex(0)->distance(e.getVertex(1))); } return m; } @@ -83,7 +75,7 @@ double MTetrahedron::etaShapeMeasure() double lij2 = 0.; for(int i = 0; i <= 3; i++) { for(int j = i + 1; j <= 3; j++) { - double lij = dist(_v[i], _v[j]); + double lij = _v[i]->distance(_v[j]); lij2 += lij * lij; } }