Commit b56d0fd3 by Amaury Johnen

remove rhoShapeMeasure + add SICN and SIGE everywhere in interface

parent 1c1e6f39
......@@ -278,7 +278,7 @@ class CTX {
int jpegQuality, jpegSmoothing, geoLabels, geoOnlyPhysicals;
int text, texAsEquation;
int gifDither, gifSort, gifInterlace, gifTransparent;
int posElementary, posElement, posGamma, posEta, posRho, posDisto;
int posElementary, posElement, posGamma, posEta, posSICN, posSIGE, posDisto;
int compositeWindows, deleteTmpFiles, background;
int width, height;
double parameter, parameterFirst, parameterLast, parameterSteps;
......
......@@ -377,10 +377,10 @@ void CreateOutputFile(const std::string &fileName, int format,
case FORMAT_POS:
GModel::current()->writePOS
(name, CTX::instance()->print.posElementary,
CTX::instance()->print.posElement, CTX::instance()->print.posGamma,
CTX::instance()->print.posEta, CTX::instance()->print.posRho,
CTX::instance()->print.posDisto, CTX::instance()->mesh.saveAll,
CTX::instance()->mesh.scalingFactor);
CTX::instance()->print.posElement,
CTX::instance()->print.posSICN, CTX::instance()->print.posSIGE,
CTX::instance()->print.posGamma, CTX::instance()->print.posDisto,
CTX::instance()->mesh.saveAll, CTX::instance()->mesh.scalingFactor);
break;
case FORMAT_GEO:
......
......@@ -1189,8 +1189,9 @@ StringXNumber MeshOptions_Number[] = {
{ F|O, "QualitySup" , opt_mesh_quality_sup , 0.0 ,
"Only display elements whose quality measure is smaller than QualitySup" },
{ F|O, "QualityType" , opt_mesh_quality_type , 2. ,
"Type of quality measure (0=gamma~vol/sum_face/max_edge, "
"1=eta~vol^(2/3)/sum_edge^2, 2=rho~min_edge/max_edge)" },
"Type of quality measure (0=SICN~signed inverse condition number, "
"1=SIGE~signed inverse gradient error, 2=gamma~vol/sum_face/max_edge, "
"3=Disto~minJ/maxJ"},
{ F|O, "RadiusInf" , opt_mesh_radius_inf , 0.0 ,
"Only display elements whose longest edge is greater than RadiusInf" },
......@@ -1756,9 +1757,12 @@ StringXNumber PrintOptions_Number[] = {
{ F|O, "PostEta" , opt_print_pos_eta , 0. ,
"Save Eta quality measure in mesh statistics exported as "
"post-processing views" },
{ F|O, "PostRho" , opt_print_pos_rho , 0. ,
"Save Rho quality measure in mesh statistics exported as "
"post-processing views" },
{ F|O, "PostSICN" , opt_print_pos_SICN , 0. ,
"Save SICN (signed inverse condition number) quality measure in mesh "
"statistics exported as post-processing views" },
{ F|O, "PostSICN" , opt_print_pos_SIGE , 0. ,
"Save SIGE (signed inverse gradient error) quality measure in mesh "
"statistics exported as post-processing views" },
{ F|O, "PostDisto" , opt_print_pos_disto , 0. ,
"Save Disto quality measure in mesh statistics exported as "
"post-processing views" },
......
......@@ -5158,7 +5158,7 @@ double opt_mesh_quality_type(OPT_ARGS_NUM)
if(CTX::instance()->mesh.qualityType != val)
CTX::instance()->mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME);
CTX::instance()->mesh.qualityType = (int)val;
if(CTX::instance()->mesh.qualityType < 0 || CTX::instance()->mesh.qualityType > 4)
if(CTX::instance()->mesh.qualityType < 0 || CTX::instance()->mesh.qualityType > 3)
CTX::instance()->mesh.qualityType = 0;
}
#if defined(HAVE_FLTK)
......@@ -9174,11 +9174,18 @@ double opt_print_pos_eta(OPT_ARGS_NUM)
return CTX::instance()->print.posEta;
}
double opt_print_pos_rho(OPT_ARGS_NUM)
double opt_print_pos_SICN(OPT_ARGS_NUM)
{
if(action & GMSH_SET)
CTX::instance()->print.posRho = (int)val;
return CTX::instance()->print.posRho;
CTX::instance()->print.posSICN = (int)val;
return CTX::instance()->print.posSICN;
}
double opt_print_pos_SIGE(OPT_ARGS_NUM)
{
if(action & GMSH_SET)
CTX::instance()->print.posSIGE = (int)val;
return CTX::instance()->print.posSIGE;
}
double opt_print_pos_disto(OPT_ARGS_NUM)
......
......@@ -718,7 +718,8 @@ double opt_print_pos_elementary(OPT_ARGS_NUM);
double opt_print_pos_element(OPT_ARGS_NUM);
double opt_print_pos_gamma(OPT_ARGS_NUM);
double opt_print_pos_eta(OPT_ARGS_NUM);
double opt_print_pos_rho(OPT_ARGS_NUM);
double opt_print_pos_SICN(OPT_ARGS_NUM);
double opt_print_pos_SIGE(OPT_ARGS_NUM);
double opt_print_pos_disto(OPT_ARGS_NUM);
double opt_print_gif_dither(OPT_ARGS_NUM);
double opt_print_gif_sort(OPT_ARGS_NUM);
......
......@@ -912,7 +912,7 @@ int meshStatFileDialog(const char *name)
{
struct _meshStatFileDialog{
Fl_Window *window;
Fl_Check_Button *b[7];
Fl_Check_Button *b[8];
Fl_Button *ok, *cancel;
};
static _meshStatFileDialog *dialog = NULL;
......@@ -921,7 +921,7 @@ int meshStatFileDialog(const char *name)
if(!dialog){
dialog = new _meshStatFileDialog;
int h = 3 * WB + 8 * BH, w = 2 * BBB + 3 * WB, y = WB;
int h = 3 * WB + 9 * BH, w = 2 * BBB + 3 * WB, y = WB;
dialog->window = new Fl_Double_Window(w, h, "POS Options");
dialog->window->box(GMSH_WINDOW_BOX);
dialog->window->set_modal();
......@@ -932,12 +932,14 @@ int meshStatFileDialog(const char *name)
dialog->b[2] = new Fl_Check_Button
(WB, y, 2 * BBB + WB, BH, "Print element numbers"); y += BH;
dialog->b[3] = new Fl_Check_Button
(WB, y, 2 * BBB + WB, BH, "Print Gamma quality measure"); y += BH;
(WB, y, 2 * BBB + WB, BH, "Print SICN quality measure"); y += BH;
dialog->b[4] = new Fl_Check_Button
(WB, y, 2 * BBB + WB, BH, "Print Eta quality measure"); y += BH;
(WB, y, 2 * BBB + WB, BH, "Print SIGE quality measure"); y += BH;
dialog->b[5] = new Fl_Check_Button
(WB, y, 2 * BBB + WB, BH, "Print Rho quality measure"); y += BH;
(WB, y, 2 * BBB + WB, BH, "Print Gamma quality measure"); y += BH;
dialog->b[6] = new Fl_Check_Button
(WB, y, 2 * BBB + WB, BH, "Print Eta quality measure"); y += BH;
dialog->b[7] = new Fl_Check_Button
(WB, y, 2 * BBB + WB, BH, "Print Disto quality measure"); y += BH;
for(int i = 0; i < 6; i++)
dialog->b[i]->type(FL_TOGGLE_BUTTON);
......@@ -950,9 +952,10 @@ int meshStatFileDialog(const char *name)
dialog->b[0]->value(CTX::instance()->mesh.saveAll ? 1 : 0);
dialog->b[1]->value(CTX::instance()->print.posElementary ? 1 : 0);
dialog->b[2]->value(CTX::instance()->print.posElement ? 1 : 0);
dialog->b[3]->value(CTX::instance()->print.posGamma ? 1 : 0);
dialog->b[4]->value(CTX::instance()->print.posEta ? 1 : 0);
dialog->b[5]->value(CTX::instance()->print.posRho ? 1 : 0);
dialog->b[3]->value(CTX::instance()->print.posSICN ? 1 : 0);
dialog->b[4]->value(CTX::instance()->print.posSIGE ? 1 : 0);
dialog->b[5]->value(CTX::instance()->print.posGamma ? 1 : 0);
dialog->b[6]->value(CTX::instance()->print.posEta ? 1 : 0);
dialog->window->show();
while(dialog->window->shown()){
......@@ -964,10 +967,13 @@ int meshStatFileDialog(const char *name)
opt_mesh_save_all(0, GMSH_SET | GMSH_GUI, dialog->b[0]->value() ? 1 : 0);
opt_print_pos_elementary(0, GMSH_SET | GMSH_GUI, dialog->b[1]->value() ? 1 : 0);
opt_print_pos_element(0, GMSH_SET | GMSH_GUI, dialog->b[2]->value() ? 1 : 0);
opt_print_pos_gamma(0, GMSH_SET | GMSH_GUI, dialog->b[3]->value() ? 1 : 0);
opt_print_pos_eta(0, GMSH_SET | GMSH_GUI, dialog->b[4]->value() ? 1 : 0);
opt_print_pos_rho(0, GMSH_SET | GMSH_GUI, dialog->b[5]->value() ? 1 : 0);
opt_print_pos_disto(0, GMSH_SET | GMSH_GUI, dialog->b[6]->value() ? 1 : 0);
opt_print_pos_SICN(0, GMSH_SET | GMSH_GUI,
dialog->b[3]->value() ? 1 : 0);
opt_print_pos_SIGE(0, GMSH_SET | GMSH_GUI,
dialog->b[4]->value() ? 1 : 0);
opt_print_pos_gamma(0, GMSH_SET | GMSH_GUI, dialog->b[5]->value() ? 1 : 0);
opt_print_pos_eta(0, GMSH_SET | GMSH_GUI, dialog->b[6]->value() ? 1 : 0);
opt_print_pos_disto(0, GMSH_SET | GMSH_GUI, dialog->b[7]->value() ? 1 : 0);
CreateOutputFile(name, FORMAT_POS);
dialog->window->hide();
return 1;
......
......@@ -2086,8 +2086,7 @@ static std::vector<std::string> getInfoStrings(MElement *ele)
std::ostringstream sstream;
sstream.precision(12);
sstream << " Quality: "
<< "gamma = " << ele->gammaShapeMeasure() << " "
<< "rho = " << ele->rhoShapeMeasure();
<< "gamma = " << ele->gammaShapeMeasure();
info.push_back(sstream.str());
}
{
......
......@@ -2520,7 +2520,6 @@ optionWindow::optionWindow(int deltaFontSize)
{"SICN", 0, 0, 0},
{"SIGE", 0, 0, 0},
{"Gamma", 0, 0, 0},
{"Rho", 0, 0, 0},
{"Disto", 0, 0, 0},
{0}
};
......
......@@ -20,7 +20,6 @@
enum QM_HISTO {QMH_SICN_XY, QMH_SICN_3D,
QMH_GAMMA_XY, QMH_GAMMA_3D,
QMH_RHO_XY, QMH_RHO_3D,
QMH_SIGE_XY, QMH_SIGE_3D};
void statistics_cb(Fl_Widget *w, void *data)
......@@ -53,13 +52,6 @@ static void statistics_histogram_cb(Fl_Widget *w, void *data)
}
new PView("Gamma", "# Elements", x, y);
}
else if (qmh == QMH_RHO_XY) {
for(int i = 0; i < 100; i++){
x.push_back((double)i / 99);
y.push_back(FlGui::instance()->stats->quality[2][i]);
}
new PView("Rho", "# Elements", x, y);
}
else if (qmh == QMH_SIGE_XY) {
for(int i = 0; i < 100; i++){
x.push_back((double)(2*i-99) / 99);
......@@ -79,15 +71,12 @@ static void statistics_histogram_cb(Fl_Widget *w, void *data)
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)
d[e->getNum()].push_back(e->rhoShapeMeasure());
else if (qmh == QMH_SIGE_3D)
d[e->getNum()].push_back(e->minSIGEShapeMeasure());
}
}
std::string name = (qmh == QMH_SICN_3D) ? "SICN" :
(qmh == QMH_GAMMA_3D) ? "Gamma" :
(qmh == QMH_RHO_3D) ? "Rho" :
(qmh == QMH_SIGE_3D) ? "SIGE" : "";
new PView(name, "ElementData", GModel::current(), d);
}
......
......@@ -18,7 +18,7 @@ class statisticsWindow{
Fl_Button *butt[8];
Fl_Group *group[3];
Fl_Box *memUsage;
double quality[4][100];
double quality[3][100];
public:
statisticsWindow(int deltaFontSize);
void compute(bool elementQuality);
......
......@@ -633,8 +633,9 @@ class GModel {
// mesh statistics (saved as a Gmsh post-processing view)
int writePOS(const std::string &name, bool printElementary,
bool printElementNumber, bool printSICN, bool printGamma, bool printRho,
bool printDisto, bool saveAll=false, double scalingFactor=1.0);
bool printElementNumber, bool printSICN, bool printSIGE,
bool printGamma, bool printDisto, bool saveAll=false,
double scalingFactor=1.0);
// Stereo lithography format
int readSTL(const std::string &name, double tolerance=1.e-3);
......
......@@ -9,8 +9,8 @@
#include "MElement.h"
int GModel::writePOS(const std::string &name, bool printElementary,
bool printElementNumber, bool printSICN, bool printGamma,
bool printRho, bool printDisto,
bool printElementNumber, bool printSICN, bool printSIGE,
bool printGamma, bool printDisto,
bool saveAll, double scalingFactor)
{
FILE *fp = Fopen(name.c_str(), "w");
......@@ -36,32 +36,29 @@ int GModel::writePOS(const std::string &name, bool printElementary,
}
*/
bool f[6] = {printElementary, printElementNumber, printSICN, printGamma, printRho,
printDisto};
bool first = true;
std::string names;
if(f[0]){
if(printElementary){
if(first) first = false; else names += ",";
names += "\"Elementary Entity\"";
}
if(f[1]){
if(printElementNumber){
if(first) first = false; else names += ",";
names += "\"Element Number\"";
}
if(f[2]){
if(printSICN){
if(first) first = false; else names += ",";
names += "\"SICN\"";
}
if(f[3]){
if(printSIGE){
if(first) first = false; else names += ",";
names += "\"Gamma\"";
names += "\"SIGE\"";
}
if(f[4]){
if(printGamma){
if(first) first = false; else names += ",";
names += "\"Rho\"";
names += "\"Gamma\"";
}
if(f[5]){
if(printDisto){
if(first) first = false; else names += ",";
names += "\"Disto\"";
}
......@@ -79,7 +76,8 @@ int GModel::writePOS(const std::string &name, bool printElementary,
if(saveAll || entities[i]->physicals.size())
for(unsigned int j = 0; j < entities[i]->getNumMeshElements(); j++)
entities[i]->getMeshElement(j)->writePOS
(fp, f[0], f[1], f[2], f[3], f[4], f[5], scalingFactor, entities[i]->tag());
(fp, printElementary, printElementNumber, printSICN, printSIGE,
printGamma, printDisto, scalingFactor, entities[i]->tag());
fprintf(fp, "};\n");
fclose(fp);
......
......@@ -103,10 +103,8 @@ bool isElementVisible(MElement *ele)
if(!ele->getVisibility()) return false;
if(CTX::instance()->mesh.qualitySup) {
double q;
if(CTX::instance()->mesh.qualityType == 4)
if(CTX::instance()->mesh.qualityType == 3)
q = ele->distoShapeMeasure();
else if(CTX::instance()->mesh.qualityType == 3)
q = ele->rhoShapeMeasure();
else if(CTX::instance()->mesh.qualityType == 2)
q = ele->gammaShapeMeasure();
else if(CTX::instance()->mesh.qualityType == 1)
......
......@@ -116,16 +116,6 @@ double MElement::maxEdge()
return m;
}
double MElement::rhoShapeMeasure()
{
double min = minEdge();
double max = maxEdge();
if(max)
return min / max;
else
return 0.;
}
double MElement::maxDistToStraight() const
{
const nodalBasis *lagBasis = getFunctionSpace();
......@@ -334,8 +324,7 @@ void MElement::signedInvCondNumRange(double &iCNMin, double &iCNMax, GEntity *ge
#endif
}
void MElement::signedInvGradErrorRange(double &minSIGE, double &maxSIGE,
GEntity *ge)
void MElement::signedInvGradErrorRange(double &minSIGE, double &maxSIGE)
{
jacobianBasedQuality::sampleIGEMeasure(this, getPolynomialOrder(),
minSIGE, maxSIGE);
......@@ -1143,7 +1132,7 @@ void MElement::writeMSH2(FILE *fp, double version, bool binary, int num,
}
void MElement::writePOS(FILE *fp, bool printElementary, bool printElementNumber,
bool printSICN, bool printGamma, bool printRho,
bool printSICN, bool printSIGE, bool printGamma,
bool printDisto, double scalingFactor, int elementary)
{
const char *str = getStringForPOS();
......@@ -1177,19 +1166,19 @@ void MElement::writePOS(FILE *fp, bool printElementary, bool printElementNumber,
fprintf(fp, "%g", sICNMin);
}
}
if(printGamma){
double gamma = gammaShapeMeasure();
if(printSIGE){
double sIGEMin = minSIGEShapeMeasure();
for(int i = 0; i < n; i++){
if(first) first = false; else fprintf(fp, ",");
fprintf(fp, "%g", gamma);
//fprintf(fp, "%d", getVertex(i)->getNum());
fprintf(fp, "%g", sIGEMin);
}
}
if(printRho){
double rho = rhoShapeMeasure();
if(printGamma){
double gamma = gammaShapeMeasure();
for(int i = 0; i < n; i++){
if(first) first = false; else fprintf(fp, ",");
fprintf(fp, "%g", rho);
fprintf(fp, "%g", gamma);
//fprintf(fp, "%d", getVertex(i)->getNum());
}
}
if(printDisto){
......
......@@ -199,7 +199,6 @@ class MElement
// get the quality measures
double skewness();
virtual double rhoShapeMeasure();
virtual double gammaShapeMeasure(){ return 0.; }
virtual double etaShapeMeasure(){ return 0.; }
double minSICNShapeMeasure()
......@@ -228,7 +227,7 @@ class MElement
virtual void scaledJacRange(double &jmin, double &jmax, GEntity *ge = 0) const;
virtual void idealJacRange(double &jmin, double &jmax, GEntity *ge = 0);
virtual void signedInvCondNumRange(double &iCNMin, double &iCNMax, GEntity *ge = 0);
virtual void signedInvGradErrorRange(double &minSIGE, double &maxSIGE, GEntity *ge = 0);
virtual void signedInvGradErrorRange(double &minSIGE, double &maxSIGE);
// get the radius of the inscribed circle/sphere if it exists,
// otherwise get the minimum radius of all the circles/spheres
......@@ -376,7 +375,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 printSICN, bool printGamma, bool printRho,
bool printSICN, bool printSIGE, bool printGamma,
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);
......
......@@ -119,9 +119,8 @@ template<class T>
static void GetQualityMeasure(std::vector<T*> &ele,
double &gamma, double &gammaMin, double &gammaMax,
double &minSICN, double &minSICNMin, double &minSICNMax,
double &rho, double &rhoMin, double &rhoMax,
double &minSIGE, double &minSIGEMin, double &minSIGEMax,
double quality[4][100])
double quality[3][100])
{
for(unsigned int i = 0; i < ele.size(); i++){
double g = ele[i]->gammaShapeMeasure();
......@@ -136,20 +135,15 @@ static void GetQualityMeasure(std::vector<T*> &ele,
minSIGE += e;
minSIGEMin = std::min(minSIGEMin, e);
minSIGEMax = std::max(minSIGEMax, e);
double r = ele[i]->rhoShapeMeasure();
rho += r;
rhoMin = std::min(rhoMin, r);
rhoMax = std::max(rhoMax, r);
for(int j = 0; j < 100; j++){
if(s > (2*j-100) / 100. && s <= (2*j-98) / 100.) quality[0][j]++;
if(g > j / 100. && g <= (j + 1) / 100.) quality[1][j]++;
if(r > j / 100. && r <= (j + 1) / 100.) quality[2][j]++;
if(e > (2*j-100) / 100. && e <= (2*j-98) / 100.) quality[3][j]++;
if(e > (2*j-100) / 100. && e <= (2*j-98) / 100.) quality[2][j]++;
}
}
}
void GetStatistics(double stat[50], double quality[4][100])
void GetStatistics(double stat[50], double quality[3][100])
{
for(int i = 0; i < 50; i++) stat[i] = 0.;
......@@ -198,22 +192,21 @@ void GetStatistics(double stat[50], double quality[4][100])
double minSICN = 0., minSICNMin = 1., minSICNMax = -1.;
double minSIGE = 0., minSIGEMin = 1., minSIGEMax = -1.;
double gamma = 0., gammaMin = 1., gammaMax = 0.;
double rho = 0., rhoMin = 1., rhoMax = 0.;
double N = stat[9] + stat[10] + stat[11] + stat[12] + stat[13];
if(N){ // if we have 3D elements
for(GModel::riter it = m->firstRegion(); it != m->lastRegion(); ++it){
GetQualityMeasure((*it)->tetrahedra, gamma, gammaMin, gammaMax,
minSICN, minSICNMin, minSICNMax, rho, rhoMin, rhoMax,
minSICN, minSICNMin, minSICNMax,
minSIGE, minSIGEMin, minSIGEMax, quality);
GetQualityMeasure((*it)->hexahedra, gamma, gammaMin, gammaMax,
minSICN, minSICNMin, minSICNMax, rho, rhoMin, rhoMax,
minSICN, minSICNMin, minSICNMax,
minSIGE, minSIGEMin, minSIGEMax, quality);
GetQualityMeasure((*it)->prisms, gamma, gammaMin, gammaMax,
minSICN, minSICNMin, minSICNMax, rho, rhoMin, rhoMax,
minSICN, minSICNMin, minSICNMax,
minSIGE, minSIGEMin, minSIGEMax, quality);
GetQualityMeasure((*it)->pyramids, gamma, gammaMin, gammaMax,
minSICN, minSICNMin, minSICNMax, rho, rhoMin, rhoMax,
minSICN, minSICNMin, minSICNMax,
minSIGE, minSIGEMin, minSIGEMax, quality);
}
}
......@@ -221,17 +214,16 @@ void GetStatistics(double stat[50], double quality[4][100])
N = stat[7] + stat[8];
for(GModel::fiter it = m->firstFace(); it != m->lastFace(); ++it){
GetQualityMeasure((*it)->quadrangles, gamma, gammaMin, gammaMax,
minSICN, minSICNMin, minSICNMax, rho, rhoMin, rhoMax,
minSICN, minSICNMin, minSICNMax,
minSIGE, minSIGEMin, minSIGEMax, quality);
GetQualityMeasure((*it)->triangles, gamma, gammaMin, gammaMax,
minSICN, minSICNMin, minSICNMax, rho, rhoMin, rhoMax,
minSICN, minSICNMin, minSICNMax,
minSIGE, minSIGEMin, minSIGEMax, quality);
}
}
if(N){
stat[18] = minSICN / N; stat[19] = minSICNMin; stat[20] = minSICNMax;
stat[21] = gamma / N; stat[22] = gammaMin; stat[23] = gammaMax;
// stat[24] = rho / N; stat[25] = rhoMin; stat[26] = rhoMax;
stat[24] = minSIGE / N; stat[25] = minSIGEMin; stat[26] = minSIGEMax;
}
}
......
......@@ -396,7 +396,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,false,true,false,false);
t->writePOS (f, false,false,false,false,true,false);
}
ittet++;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment