Skip to content
Snippets Groups Projects
Commit dc50e16a authored by Amaury Johnen's avatar Amaury Johnen
Browse files

rename: Scaled Jacobian -> IGE & Isotropy -> ICN

parent 3ed270bc
No related branches found
No related tags found
No related merge requests found
...@@ -24,8 +24,8 @@ class bezierBasis; ...@@ -24,8 +24,8 @@ class bezierBasis;
StringXNumber CurvedMeshOptions_Number[] = { StringXNumber CurvedMeshOptions_Number[] = {
{GMSH_FULLRC, "Jacobian determinant", NULL, 1}, {GMSH_FULLRC, "Jacobian determinant", NULL, 1},
{GMSH_FULLRC, "Scaled Jacobian", NULL, 0}, {GMSH_FULLRC, "IGE measure", NULL, 1},
{GMSH_FULLRC, "Isotropy", NULL, 1}, {GMSH_FULLRC, "ICN measure", NULL, 1},
{GMSH_FULLRC, "Hidding threshold", NULL, 9}, {GMSH_FULLRC, "Hidding threshold", NULL, 9},
{GMSH_FULLRC, "Draw PView", NULL, 0}, {GMSH_FULLRC, "Draw PView", NULL, 0},
{GMSH_FULLRC, "Recompute", NULL, 0}, {GMSH_FULLRC, "Recompute", NULL, 0},
...@@ -54,36 +54,39 @@ std::string GMSH_AnalyseCurvedMeshPlugin::getHelp() const ...@@ -54,36 +54,39 @@ std::string GMSH_AnalyseCurvedMeshPlugin::getHelp() const
{ {
return "Plugin(AnalyseCurvedMesh) analyse all elements of a given dimension. " return "Plugin(AnalyseCurvedMesh) analyse all elements of a given dimension. "
"According to what is asked, it computes the minimum of the Jacobian " "According to what is asked, it computes the minimum of the Jacobian "
"determinant (J), of the scaled Jacobian and/or of the isotropy measure. " "determinant (J), the IGE quality measure (Inverse Gradient Error) and/or "
"Statistics are printed and if asked a Pview is created for each measure. " "the ICN quality measure (Inverse Condition Number). "
"Statistics are printed and, if asked, a Pview is created for each measure. "
"The plugin hides elements for which the measure mu > 'Hidding threshold', " "The plugin hides elements for which the measure mu > 'Hidding threshold', "
"where mu is the isotropy measure if asked otherwise the scaled Jacobian if " "where mu is the ICN measure if asked otherwise the IGE measure if "
"asked otherwise the Jacobian determinant.\n" "asked otherwise the Jacobian determinant.\n"
"\n" "\n"
"J is faster to compute but gives informations only on validity while the " "J is faster to compute but gives information only on validity while the "
"other measure gives also informations on quality.\n" "other measure gives also information on quality.\n"
"Warning: the scaled Jacobian is experimental for triangles, tetrahedra, " "The IGE measure is related to the error on the gradient of the finite "
"prisms and pyramids. Computation may take a lot of time for those " "element solution. It is the scaled Jacobian for quads and hexes and a new "
"elements!\n" "measure for triangles and tetrahedra.\n"
"The ICN measure is related to the condition number of the stiffness matrix.\n"
"(See article \"Efficient computation of the minimum of shape quality "
"measures on curvilinear finite elements\" for details.)\n"
"\n" "\n"
"Parameters:\n" "Parameters:\n"
"\n" "\n"
"- Jacobian determinant = {0, 1}\n" "- Jacobian determinant = {0, 1}\n"
"- Scaled Jacobian = {0, 1}\n" "- IGE measure = {0, 1}\n"
"- Isotropy = {0, 1}\n" "- ICN measure = {0, 1}\n"
"\n" "\n"
"- Hidding threshold = [0, 1]: Does nothing if Isotropy == 0 and Scaled " "- Hidding threshold = [0, 1]: Hides all element for which min(mu) is "
"Jacobian == 0. Otherwise, hides all element for which min(mu) is " "strictly greater than the threshold, where mu is the ICN if ICN measure == 1, "
"strictly greater than the threshold, where mu is the isotropy if Isotropy " "otherwise mu is the IGE it IGE measure == 1, "
"== 1, otherwise it is the Scaled Jacobian. If threshold == 1, no effect, " "otherwise mu is the Jacobian determinant.\n"
"if == 0 hide all elements except invalid.\n" "If threshold == 0, hides all elements except invalid.\n"
"\n" "\n"
"- Draw PView = {0, 1}: Creates a PView of min(J)/max(J), min(scaled Jac) " "- Draw PView = {0, 1}: Creates a PView of min(J)/max(J), min(IGE) "
"and/or min(isotropy) according to what is asked. If 'Recompute' = 1, a " "and/or min(ICN) according to what is asked. If 'Recompute' = 1, "
"new PView is redrawed.\n" "new PViews are created.\n"
"\n" "\n"
"- Recompute = {0,1}: If the mesh has changed, set to 1 to recompute the " "- Recompute = {0,1}: Should be 1 if the mesh has changed.\n"
"bounds.\n"
"\n" "\n"
"- Dimension = {-1, 1, 2, 3, 4}: If == -1, analyse element of the greater " "- Dimension = {-1, 1, 2, 3, 4}: If == -1, analyse element of the greater "
"dimension. If == 4, analyse 2D and 3D elements."; "dimension. If == 4, analyse 2D and 3D elements.";
...@@ -93,8 +96,8 @@ PView* GMSH_AnalyseCurvedMeshPlugin::execute(PView *v) ...@@ -93,8 +96,8 @@ PView* GMSH_AnalyseCurvedMeshPlugin::execute(PView *v)
{ {
_m = GModel::current(); _m = GModel::current();
bool computeJac = static_cast<int>(CurvedMeshOptions_Number[0].def); bool computeJac = static_cast<int>(CurvedMeshOptions_Number[0].def);
bool computeScaledJac = static_cast<int>(CurvedMeshOptions_Number[1].def); bool computeIGE = static_cast<int>(CurvedMeshOptions_Number[1].def);
bool computeIsotropy = static_cast<int>(CurvedMeshOptions_Number[2].def); bool computeICN = static_cast<int>(CurvedMeshOptions_Number[2].def);
_threshold = static_cast<double>(CurvedMeshOptions_Number[3].def); _threshold = static_cast<double>(CurvedMeshOptions_Number[3].def);
bool drawPView = static_cast<int>(CurvedMeshOptions_Number[4].def); bool drawPView = static_cast<int>(CurvedMeshOptions_Number[4].def);
bool recompute = static_cast<bool>(CurvedMeshOptions_Number[5].def); bool recompute = static_cast<bool>(CurvedMeshOptions_Number[5].def);
...@@ -105,20 +108,20 @@ PView* GMSH_AnalyseCurvedMeshPlugin::execute(PView *v) ...@@ -105,20 +108,20 @@ PView* GMSH_AnalyseCurvedMeshPlugin::execute(PView *v)
if (recompute) { if (recompute) {
_data.clear(); _data.clear();
if (askedDim < 4) { if (askedDim < 4) {
_computedJ[askedDim-1] = false; _computedJac[askedDim-1] = false;
_computedS[askedDim-1] = false; _computedIGE[askedDim-1] = false;
_computedI[askedDim-1] = false; _computedICN[askedDim-1] = false;
_PViewJ[askedDim-1] = false; _PViewJac[askedDim-1] = false;
_PViewS[askedDim-1] = false; _PViewIGE[askedDim-1] = false;
_PViewI[askedDim-1] = false; _PViewICN[askedDim-1] = false;
} }
else { else {
_computedJ[1] = _computedJ[2] = false; _computedJac[1] = _computedJac[2] = false;
_computedS[1] = _computedS[2] = false; _computedIGE[1] = _computedIGE[2] = false;
_computedI[1] = _computedI[2] = false; _computedICN[1] = _computedICN[2] = false;
_PViewJ[1] = _PViewJ[2] = false; _PViewJac[1] = _PViewJac[2] = false;
_PViewS[1] = _PViewS[2] = false; _PViewIGE[1] = _PViewIGE[2] = false;
_PViewI[1] = _PViewI[2] = false; _PViewICN[1] = _PViewICN[2] = false;
} }
} }
...@@ -128,7 +131,7 @@ PView* GMSH_AnalyseCurvedMeshPlugin::execute(PView *v) ...@@ -128,7 +131,7 @@ PView* GMSH_AnalyseCurvedMeshPlugin::execute(PView *v)
bool printStatI = false; bool printStatI = false;
for (int dim = 1; dim <= 3 && dim <= _m->getDim(); ++dim) { for (int dim = 1; dim <= 3 && dim <= _m->getDim(); ++dim) {
if ((askedDim == 4 && dim > 1) || dim == askedDim) { if ((askedDim == 4 && dim > 1) || dim == askedDim) {
if (!_computedJ[dim-1]) { if (!_computedJac[dim-1]) {
double time = Cpu(); double time = Cpu();
Msg::StatusBar(true, "Computing Jacobian for %dD elements...", dim); Msg::StatusBar(true, "Computing Jacobian for %dD elements...", dim);
_computeMinMaxJandValidity(dim); _computeMinMaxJandValidity(dim);
...@@ -136,34 +139,34 @@ PView* GMSH_AnalyseCurvedMeshPlugin::execute(PView *v) ...@@ -136,34 +139,34 @@ PView* GMSH_AnalyseCurvedMeshPlugin::execute(PView *v)
dim, Cpu()-time); dim, Cpu()-time);
printStatJ = true; printStatJ = true;
} }
if (computeScaledJac && !_computedS[dim-1]) { if (computeIGE && !_computedIGE[dim-1]) {
double time = Cpu(); double time = Cpu();
Msg::StatusBar(true, "Computing scaled Jacobian for %dD elements...", dim); Msg::StatusBar(true, "Computing IGE for %dD elements...", dim);
_computeMinScaledJac(dim); _computeMinIGE(dim);
Msg::StatusBar(true, "Done computing scaled Jacobian for %dD elements (%g s)", Msg::StatusBar(true, "Done computing IGE for %dD elements (%g s)",
dim, Cpu()-time); dim, Cpu()-time);
printStatS = true; printStatS = true;
} }
if (computeIsotropy && !_computedI[dim-1]) { if (computeICN && !_computedICN[dim-1]) {
double time = Cpu(); double time = Cpu();
Msg::StatusBar(true, "Computing isotropy for %dD elements...", dim); Msg::StatusBar(true, "Computing ICN for %dD elements...", dim);
_computeMinIsotropy(dim); _computeMinICN(dim);
Msg::StatusBar(true, "Done computing isotropy for %dD elements (%g s)", Msg::StatusBar(true, "Done computing ICN for %dD elements (%g s)",
dim, Cpu()-time); dim, Cpu()-time);
printStatI = true; printStatI = true;
} }
} }
} }
if (printStatJ) _printStatJacobian(); if (printStatJ) _printStatJacobian();
if (printStatS) _printStatScaledJac(); if (printStatS) _printStatIGE();
if (printStatI) _printStatIsotropy(); if (printStatI) _printStatICN();
// Create PView // Create PView
if (drawPView) if (drawPView)
for (int dim = 1; dim <= 3; ++dim) { for (int dim = 1; dim <= 3; ++dim) {
if ((askedDim == 4 && dim > 1) || dim == askedDim) { if ((askedDim == 4 && dim > 1) || dim == askedDim) {
if (!_PViewJ[dim-1] && computeJac) { if (!_PViewJac[dim-1] && computeJac) {
_PViewJ[dim-1] = true; _PViewJac[dim-1] = true;
std::map<int, std::vector<double> > dataPV; std::map<int, std::vector<double> > dataPV;
for (unsigned int i = 0; i < _data.size(); ++i) { for (unsigned int i = 0; i < _data.size(); ++i) {
MElement *const el = _data[i].element(); MElement *const el = _data[i].element();
...@@ -176,8 +179,8 @@ PView* GMSH_AnalyseCurvedMeshPlugin::execute(PView *v) ...@@ -176,8 +179,8 @@ PView* GMSH_AnalyseCurvedMeshPlugin::execute(PView *v)
new PView(name.str().c_str(), "ElementData", _m, dataPV); new PView(name.str().c_str(), "ElementData", _m, dataPV);
} }
} }
if (!_PViewS[dim-1] && computeScaledJac) { if (!_PViewIGE[dim-1] && computeIGE) {
_PViewS[dim-1] = true; _PViewIGE[dim-1] = true;
std::map<int, std::vector<double> > dataPV; std::map<int, std::vector<double> > dataPV;
for (unsigned int i = 0; i < _data.size(); ++i) { for (unsigned int i = 0; i < _data.size(); ++i) {
MElement *const el = _data[i].element(); MElement *const el = _data[i].element();
...@@ -186,12 +189,12 @@ PView* GMSH_AnalyseCurvedMeshPlugin::execute(PView *v) ...@@ -186,12 +189,12 @@ PView* GMSH_AnalyseCurvedMeshPlugin::execute(PView *v)
} }
if (dataPV.size()) { if (dataPV.size()) {
std::stringstream name; std::stringstream name;
name << "Scaled Jacobian " << dim << "D"; name << "IGE " << dim << "D";
new PView(name.str().c_str(), "ElementData", _m, dataPV); new PView(name.str().c_str(), "ElementData", _m, dataPV);
} }
} }
if (!_PViewI[dim-1] && computeIsotropy) { if (!_PViewICN[dim-1] && computeICN) {
_PViewI[dim-1] = true; _PViewICN[dim-1] = true;
std::map<int, std::vector<double> > dataPV; std::map<int, std::vector<double> > dataPV;
for (unsigned int i = 0; i < _data.size(); ++i) { for (unsigned int i = 0; i < _data.size(); ++i) {
MElement *const el = _data[i].element(); MElement *const el = _data[i].element();
...@@ -200,7 +203,7 @@ PView* GMSH_AnalyseCurvedMeshPlugin::execute(PView *v) ...@@ -200,7 +203,7 @@ PView* GMSH_AnalyseCurvedMeshPlugin::execute(PView *v)
} }
if (dataPV.size()) { if (dataPV.size()) {
std::stringstream name; std::stringstream name;
name << "Isotropy " << dim << "D"; name << "ICN " << dim << "D";
new PView(name.str().c_str(), "ElementData", _m, dataPV); new PView(name.str().c_str(), "ElementData", _m, dataPV);
} }
} }
...@@ -210,8 +213,8 @@ PView* GMSH_AnalyseCurvedMeshPlugin::execute(PView *v) ...@@ -210,8 +213,8 @@ PView* GMSH_AnalyseCurvedMeshPlugin::execute(PView *v)
// Hide elements // Hide elements
#if defined(HAVE_OPENGL) #if defined(HAVE_OPENGL)
_hideWithThreshold(askedDim, _hideWithThreshold(askedDim,
computeIsotropy ? 2 : computeICN ? 2 :
computeScaledJac ? 1 : computeIGE ? 1 :
computeJac ? 0 : -1); computeJac ? 0 : -1);
CTX::instance()->mesh.changed = (ENT_ALL); CTX::instance()->mesh.changed = (ENT_ALL);
drawContext::global()->draw(); drawContext::global()->draw();
...@@ -222,7 +225,7 @@ PView* GMSH_AnalyseCurvedMeshPlugin::execute(PView *v) ...@@ -222,7 +225,7 @@ PView* GMSH_AnalyseCurvedMeshPlugin::execute(PView *v)
void GMSH_AnalyseCurvedMeshPlugin::_computeMinMaxJandValidity(int dim) void GMSH_AnalyseCurvedMeshPlugin::_computeMinMaxJandValidity(int dim)
{ {
if (_computedJ[dim-1]) return; if (_computedJac[dim-1]) return;
std::set<GEntity*, GEntityLessThan> entities; std::set<GEntity*, GEntityLessThan> entities;
switch (dim) { switch (dim) {
...@@ -337,12 +340,12 @@ void GMSH_AnalyseCurvedMeshPlugin::_computeMinMaxJandValidity(int dim) ...@@ -337,12 +340,12 @@ void GMSH_AnalyseCurvedMeshPlugin::_computeMinMaxJandValidity(int dim)
} }
delete normals; delete normals;
} }
_computedJ[dim-1] = true; _computedJac[dim-1] = true;
} }
void GMSH_AnalyseCurvedMeshPlugin::_computeMinScaledJac(int dim) void GMSH_AnalyseCurvedMeshPlugin::_computeMinIGE(int dim)
{ {
if (_computedS[dim-1]) return; if (_computedIGE[dim-1]) return;
MsgProgressStatus progress(_data.size()); MsgProgressStatus progress(_data.size());
...@@ -358,12 +361,12 @@ void GMSH_AnalyseCurvedMeshPlugin::_computeMinScaledJac(int dim) ...@@ -358,12 +361,12 @@ void GMSH_AnalyseCurvedMeshPlugin::_computeMinScaledJac(int dim)
progress.next(); progress.next();
} }
_computedS[dim-1] = true; _computedIGE[dim-1] = true;
} }
void GMSH_AnalyseCurvedMeshPlugin::_computeMinIsotropy(int dim) void GMSH_AnalyseCurvedMeshPlugin::_computeMinICN(int dim)
{ {
if (_computedI[dim-1]) return; if (_computedICN[dim-1]) return;
MsgProgressStatus progress(_data.size()); MsgProgressStatus progress(_data.size());
...@@ -379,7 +382,7 @@ void GMSH_AnalyseCurvedMeshPlugin::_computeMinIsotropy(int dim) ...@@ -379,7 +382,7 @@ void GMSH_AnalyseCurvedMeshPlugin::_computeMinIsotropy(int dim)
progress.next(); progress.next();
} }
_computedI[dim-1] = true; _computedICN[dim-1] = true;
} }
int GMSH_AnalyseCurvedMeshPlugin::_hideWithThreshold(int askedDim, int whichMeasure) int GMSH_AnalyseCurvedMeshPlugin::_hideWithThreshold(int askedDim, int whichMeasure)
...@@ -461,7 +464,7 @@ void GMSH_AnalyseCurvedMeshPlugin::_printStatJacobian() ...@@ -461,7 +464,7 @@ void GMSH_AnalyseCurvedMeshPlugin::_printStatJacobian()
avgratJc, countc); avgratJc, countc);
} }
void GMSH_AnalyseCurvedMeshPlugin::_printStatScaledJac() void GMSH_AnalyseCurvedMeshPlugin::_printStatIGE()
{ {
if (_data.empty()) { if (_data.empty()) {
Msg::Info("No stat to print."); Msg::Info("No stat to print.");
...@@ -477,11 +480,11 @@ void GMSH_AnalyseCurvedMeshPlugin::_printStatScaledJac() ...@@ -477,11 +480,11 @@ void GMSH_AnalyseCurvedMeshPlugin::_printStatScaledJac()
} }
avgminS /= _data.size(); avgminS /= _data.size();
Msg::Info("Scaled Jacobian : %6.3f, %6.3f, %6.3f (= worst, avg, best)", Msg::Info("IGE : %6.3f, %6.3f, %6.3f (= worst, avg, best)",
infminS, avgminS, supminS); infminS, avgminS, supminS);
} }
void GMSH_AnalyseCurvedMeshPlugin::_printStatIsotropy() void GMSH_AnalyseCurvedMeshPlugin::_printStatICN()
{ {
if (_data.empty()) { if (_data.empty()) {
Msg::Info("No stat to print."); Msg::Info("No stat to print.");
...@@ -497,7 +500,7 @@ void GMSH_AnalyseCurvedMeshPlugin::_printStatIsotropy() ...@@ -497,7 +500,7 @@ void GMSH_AnalyseCurvedMeshPlugin::_printStatIsotropy()
} }
avgminI /= _data.size(); avgminI /= _data.size();
Msg::Info("Isotropy : %6.3f, %6.3f, %6.3f (= worst, avg, best)", Msg::Info("ICN : %6.3f, %6.3f, %6.3f (= worst, avg, best)",
infminI, avgminI, supminI); infminI, avgminI, supminI);
} }
......
...@@ -19,21 +19,21 @@ class data_elementMinMax ...@@ -19,21 +19,21 @@ class data_elementMinMax
{ {
private: private:
MElement *_el; MElement *_el;
double _minJ, _maxJ, _minS, _minI; double _minJac, _maxJac, _minIGE, _minICN;
public: public:
data_elementMinMax(MElement *e, data_elementMinMax(MElement *e,
double minJ = 2, double minJ = 2,
double maxJ = 0, double maxJ = 0,
double minS = -1, double minIGE = -1,
double minI = -1) double minICN = -1)
: _el(e), _minJ(minJ), _maxJ(maxJ), _minS(minS), _minI(minI) {} : _el(e), _minJac(minJ), _maxJac(maxJ), _minIGE(minIGE), _minICN(minICN) {}
void setMinS(double r) { _minS = r; } void setMinS(double r) { _minIGE = r; }
void setMinI(double r) { _minI = r; } void setMinI(double r) { _minICN = r; }
MElement* element() { return _el; } MElement* element() { return _el; }
double minJ() { return _minJ; } double minJ() { return _minJac; }
double maxJ() { return _maxJ; } double maxJ() { return _maxJac; }
double minS() { return _minS; } double minS() { return _minIGE; }
double minI() { return _minI; } double minI() { return _minICN; }
}; };
class GMSH_AnalyseCurvedMeshPlugin : public GMSH_PostPlugin class GMSH_AnalyseCurvedMeshPlugin : public GMSH_PostPlugin
...@@ -43,8 +43,8 @@ private : ...@@ -43,8 +43,8 @@ private :
double _threshold; double _threshold;
// for 1d, 2d, 3d // for 1d, 2d, 3d
bool _computedJ[3], _computedS[3], _computedI[3]; bool _computedJac[3], _computedIGE[3], _computedICN[3];
bool _PViewJ[3], _PViewS[3], _PViewI[3]; bool _PViewJac[3], _PViewIGE[3], _PViewICN[3];
std::vector<data_elementMinMax> _data; std::vector<data_elementMinMax> _data;
...@@ -54,18 +54,18 @@ public : ...@@ -54,18 +54,18 @@ public :
_m = NULL; _m = NULL;
_threshold = -1; _threshold = -1;
for (int i = 0; i < 3; ++i) { for (int i = 0; i < 3; ++i) {
_computedJ[i] = false; _computedJac[i] = false;
_computedS[i] = false; _computedIGE[i] = false;
_computedI[i] = false; _computedICN[i] = false;
_PViewJ[i] = false; _PViewJac[i] = false;
_PViewS[i] = false; _PViewIGE[i] = false;
_PViewI[i] = false; _PViewICN [i] = false;
} }
} }
std::string getName() const { return "AnalyseCurvedMesh"; } std::string getName() const { return "AnalyseCurvedMesh"; }
std::string getShortHelp() const std::string getShortHelp() const
{ {
return "Compute bounds on Jacobian and metric quality."; return "Compute validity and quality of curved elements.";
} }
std::string getHelp() const; std::string getHelp() const;
std::string getAuthor() const { return "Amaury Johnen"; } std::string getAuthor() const { return "Amaury Johnen"; }
...@@ -75,12 +75,12 @@ public : ...@@ -75,12 +75,12 @@ public :
private : private :
void _computeMinMaxJandValidity(int dim); void _computeMinMaxJandValidity(int dim);
void _computeMinScaledJac(int dim); void _computeMinIGE(int dim);
void _computeMinIsotropy(int dim); void _computeMinICN(int dim);
int _hideWithThreshold(int askedDim, int whichMeasure); int _hideWithThreshold(int askedDim, int whichMeasure);
void _printStatJacobian(); void _printStatJacobian();
void _printStatScaledJac(); void _printStatIGE();
void _printStatIsotropy(); void _printStatICN();
}; };
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment