diff --git a/Common/GmshDefines.h b/Common/GmshDefines.h index e27349c686af4e1007a0cc25ada37259f3a1619c..b6a1917fd6c0d5a1378cf85ed86cad6ae04a1644 100644 --- a/Common/GmshDefines.h +++ b/Common/GmshDefines.h @@ -6,8 +6,6 @@ #ifndef _GMSH_DEFINES_H_ #define _GMSH_DEFINES_H_ -//#define METRICSHAPEMEASURE - // IO file formats (numbers should not be changed) #define FORMAT_MSH 1 #define FORMAT_UNV 2 diff --git a/Fltk/graphicWindow.cpp b/Fltk/graphicWindow.cpp index 12c54b984712e520def2ee7260199ecf5bfdae36..8b9951d0997c249da1325b095fdf58017ff66d47 100644 --- a/Fltk/graphicWindow.cpp +++ b/Fltk/graphicWindow.cpp @@ -1627,20 +1627,15 @@ static std::vector<std::string> getInfoStrings(MElement *ele) { std::ostringstream sstream; sstream << " Quality: " -#ifdef METRICSHAPEMEASURE - << "metric = " << ele->metricShapeMeasure() << " " -#else - << "rho = " << ele->rhoShapeMeasure() << " " -#endif - << "gamma = " << ele->gammaShapeMeasure() << " " - << "eta = " << ele->etaShapeMeasure(); + << "gamma = " << ele->gammaShapeMeasure() << " " + << "rho = " << ele->rhoShapeMeasure(); info.push_back(sstream.str()); } { std::ostringstream sstream; - double jmin, jmax; - ele->scaledJacRange(jmin, jmax); - sstream << " Scaled Jacobian range: " << jmin << " " << jmax; + double sICNMin, sICNMax; + ele->signedInvCondNumRange(sICNMin, sICNMax); + sstream << " SICN range: " << sICNMin << " " << sICNMax; info.push_back(sstream.str()); } { diff --git a/Fltk/statisticsWindow.cpp b/Fltk/statisticsWindow.cpp index f9bb15bdd94c8406ee57d56cb8e6604e4d3cb949..6e8ff87b5d694c5159ff6ba7e0497f741b8a7c80 100644 --- a/Fltk/statisticsWindow.cpp +++ b/Fltk/statisticsWindow.cpp @@ -65,11 +65,8 @@ static void statistics_histogram_cb(Fl_Widget *w, void *data) if (entities_[i]->dim() < 2) continue; for (unsigned int j = 0; j < entities_[i]->getNumMeshElements(); j++) { MElement *e = entities_[i]->getMeshElement(j); - if (qmh == QMH_SICN_3D) { - double minSICN, maxSICN; - e->invCondNumRange(minSICN, maxSICN); - d[e->getNum()].push_back(minSICN); - } + if (qmh == QMH_SICN_3D) + d[e->getNum()].push_back(e->minSICNShapeMeasure()); else if (qmh == QMH_GAMMA_3D) d[e->getNum()].push_back(e->gammaShapeMeasure()); else if (qmh == QMH_RHO_3D) diff --git a/Geo/GModel.h b/Geo/GModel.h index 538983b0d0462e223c34bea5d69ccaee3f7edd21..98b79d108caa192cf981e2ef29f5c872000af8bd 100644 --- a/Geo/GModel.h +++ b/Geo/GModel.h @@ -620,7 +620,7 @@ class GModel // mesh statistics (saved as a Gmsh post-processing view) int writePOS(const std::string &name, bool printElementary, - bool printElementNumber, bool printGamma, bool printEta, bool printRho, + bool printElementNumber, bool printSICN, bool printGamma, bool printRho, bool printDisto, bool saveAll=false, double scalingFactor=1.0); // Stereo lithography format diff --git a/Geo/GModelIO_POS.cpp b/Geo/GModelIO_POS.cpp index f9b562259ab76ce328bb378c1a2ad2cc81ecfdc2..9179b146d30dad9ba8e6293642e55f75ff2fc866 100644 --- a/Geo/GModelIO_POS.cpp +++ b/Geo/GModelIO_POS.cpp @@ -9,7 +9,7 @@ #include "MElement.h" int GModel::writePOS(const std::string &name, bool printElementary, - bool printElementNumber, bool printGamma, bool printEta, + bool printElementNumber, bool printSICN, bool printGamma, bool printRho, bool printDisto, bool saveAll, double scalingFactor) { @@ -36,7 +36,7 @@ int GModel::writePOS(const std::string &name, bool printElementary, } */ - bool f[6] = {printElementary, printElementNumber, printGamma, printEta, printRho, + bool f[6] = {printElementary, printElementNumber, printSICN, printGamma, printRho, printDisto}; bool first = true; @@ -51,11 +51,11 @@ int GModel::writePOS(const std::string &name, bool printElementary, } if(f[2]){ if(first) first = false; else names += ","; - names += "\"Gamma\""; + names += "\"SICN\""; } if(f[3]){ if(first) first = false; else names += ","; - names += "\"Eta\""; + names += "\"Gamma\""; } if(f[4]){ if(first) first = false; else names += ","; diff --git a/Geo/GModelVertexArrays.cpp b/Geo/GModelVertexArrays.cpp index abc00806fa9ab43a5ddb9e154aa7ef53fa1b3a54..ca8d54b2c2ad44c1da6c6a3b3d99c7389f0ee657 100644 --- a/Geo/GModelVertexArrays.cpp +++ b/Geo/GModelVertexArrays.cpp @@ -107,10 +107,8 @@ bool isElementVisible(MElement *ele) q = ele->rhoShapeMeasure(); else if(CTX::instance()->mesh.qualityType == 1) q = ele->gammaShapeMeasure(); - else { - double sICNMax; - ele->invCondNumRange(q, sICNMax); - } + else + q = ele->minSICNShapeMeasure(); if(q < CTX::instance()->mesh.qualityInf || q > CTX::instance()->mesh.qualitySup) return false; } diff --git a/Geo/MElement.cpp b/Geo/MElement.cpp index dcc9c52a2ebb2c603f93284d02a6b1f03f01225f..a637d348a9f7111f17691c204245e21002336d8c 100644 --- a/Geo/MElement.cpp +++ b/Geo/MElement.cpp @@ -322,7 +322,7 @@ void MElement::idealJacRange(double &jmin, double &jmax, GEntity *ge) #endif } -void MElement::invCondNumRange(double &iCNMin, double &iCNMax, GEntity *ge) +void MElement::signedInvCondNumRange(double &iCNMin, double &iCNMax, GEntity *ge) { iCNMin = iCNMax = 1.0; #if defined(HAVE_MESH) @@ -1129,7 +1129,7 @@ void MElement::writeMSH2(FILE *fp, double version, bool binary, int num, } void MElement::writePOS(FILE *fp, bool printElementary, bool printElementNumber, - bool printGamma, bool printEta, bool printRho, + bool printSICN, bool printGamma, bool printRho, bool printDisto, double scalingFactor, int elementary) { const char *str = getStringForPOS(); @@ -1156,26 +1156,22 @@ void MElement::writePOS(FILE *fp, bool printElementary, bool printElementNumber, fprintf(fp, "%d", getNum()); } } - if(printGamma){ - double gamma = gammaShapeMeasure(); + if(printSICN){ + double sICNMin = minSICNShapeMeasure(); for(int i = 0; i < n; i++){ if(first) first = false; else fprintf(fp, ","); - fprintf(fp, "%g", gamma); + fprintf(fp, "%g", sICNMin); } } - if(printEta){ - double eta = etaShapeMeasure(); + if(printGamma){ + double gamma = gammaShapeMeasure(); for(int i = 0; i < n; i++){ if(first) first = false; else fprintf(fp, ","); - fprintf(fp, "%g", eta); + fprintf(fp, "%g", gamma); } } if(printRho){ -#ifdef METRICSHAPEMEASURE - double rho = metricShapeMeasure(); -#else double rho = rhoShapeMeasure(); -#endif for(int i = 0; i < n; i++){ if(first) first = false; else fprintf(fp, ","); fprintf(fp, "%g", rho); diff --git a/Geo/MElement.h b/Geo/MElement.h index 1ce7cfdeb6e6a5dfa6bc8bbfa45234f14f3b2da2..f44d75d75a5a744bfae3e28f3c9d3f0689ce6e65 100644 --- a/Geo/MElement.h +++ b/Geo/MElement.h @@ -196,16 +196,22 @@ class MElement virtual double rhoShapeMeasure(); virtual double gammaShapeMeasure(){ return 0.; } virtual double etaShapeMeasure(){ return 0.; } - virtual double distoShapeMeasure() + double distoShapeMeasure() { double jmin, jmax; scaledJacRange(jmin, jmax); return jmin; } + double minSICNShapeMeasure() + { + double sICNMin, sICNMax; + signedInvCondNumRange(sICNMin, sICNMax); + return sICNMin; + } virtual double angleShapeMeasure() { return 1.0; } virtual void scaledJacRange(double &jmin, double &jmax, GEntity *ge = 0) const; virtual void idealJacRange(double &jmin, double &jmax, GEntity *ge = 0); - virtual void invCondNumRange(double &iCNMin, double &iCNMax, GEntity *ge = 0); + virtual void signedInvCondNumRange(double &iCNMin, double &iCNMax, GEntity *ge = 0); virtual double metricShapeMeasure(); virtual double metricShapeMeasure2(); @@ -350,7 +356,7 @@ class MElement int parentNum=0, int dom1Num = 0, int dom2Num = 0, std::vector<short> *ghosts=0); virtual void writePOS(FILE *fp, bool printElementary, bool printElementNumber, - bool printGamma, bool printEta, bool printRho, + bool printSICN, bool printGamma, bool printRho, bool printDisto,double scalingFactor=1.0, int elementary=1); virtual void writeSTL(FILE *fp, bool binary=false, double scalingFactor=1.0); virtual void writeVRML(FILE *fp); diff --git a/Mesh/Generator.cpp b/Mesh/Generator.cpp index ad0aa24ba587b637746e5a0c32b2b9998bcc2452..6e334f7763a1ad2148a4e3b5d205e02d4d617693 100644 --- a/Mesh/Generator.cpp +++ b/Mesh/Generator.cpp @@ -58,8 +58,7 @@ static void GetQualityMeasure(std::vector<T*> &ele, gamma += g; gammaMin = std::min(gammaMin, g); gammaMax = std::max(gammaMax, g); - double s, sDum; - ele[i]->invCondNumRange(s, sDum); + double s = ele[i]->minSICNShapeMeasure(); minSICN += s; minSICNMin = std::min(minSICNMin, s); minSICNMax = std::max(minSICNMax, s); diff --git a/Mesh/meshGFaceOptimize.cpp b/Mesh/meshGFaceOptimize.cpp index b5ec7972b131000561831dcd05f9ee53e2f0f627..2a958076b64aef2896a38cf9a7c4ef3ac77ecb86 100644 --- a/Mesh/meshGFaceOptimize.cpp +++ b/Mesh/meshGFaceOptimize.cpp @@ -2026,7 +2026,7 @@ struct opti_data_vertex_relocation { fprintf(f,"View \"\"{\n"); for (unsigned int i=0;i<e.size();++i){ MElement *el = e[i]; - el->writePOS(f,false,false,true,false,false,false); + el->writePOS(f,false,false,false,true,false,false); } fprintf(f,"};"); fclose (f); diff --git a/Mesh/meshGRegionDelaunayInsertion.cpp b/Mesh/meshGRegionDelaunayInsertion.cpp index fa04be33182491dad64feade6ebf94547dfdd6aa..4dfd22f0e877a83e6b86989a90ccd6aac9784cf0 100644 --- a/Mesh/meshGRegionDelaunayInsertion.cpp +++ b/Mesh/meshGRegionDelaunayInsertion.cpp @@ -415,7 +415,7 @@ void printTets (const char *fn, std::list<MTet4*> &cavity, bool force = false ) MTet4 *tet = *ittet; if (force || !tet->isDeleted()){ MTetrahedron *t = tet->tet(); - t->writePOS (f, false,false,true,false,false,false); + t->writePOS (f, false,false,false,true,false,false); } ittet++; } diff --git a/contrib/MeshQualityOptimizer/MeshQualityOptimizer.cpp b/contrib/MeshQualityOptimizer/MeshQualityOptimizer.cpp index 45e768233fc3d59e983af88d79851b00ae188c31..e5c75535ac03327b3c9c457429c2c542ae18c18e 100644 --- a/contrib/MeshQualityOptimizer/MeshQualityOptimizer.cpp +++ b/contrib/MeshQualityOptimizer/MeshQualityOptimizer.cpp @@ -63,7 +63,7 @@ double QualPatchDefParameters::elBadness(MElement *el) const // el->idealJacRange(jMin, jMax); // return jMin-_idealJacMin; double iCNMin, iCNMax; - el->invCondNumRange(iCNMin, iCNMax); + el->signedInvCondNumRange(iCNMin, iCNMax); return iCNMin-_invCondNumMin; }