diff --git a/Geo/MElement.cpp b/Geo/MElement.cpp index e76d4b04a7c5584cd355b831cb45ca8e69a01887..880936ba498ff6a16f22b51edfdb74270f59419e 100644 --- a/Geo/MElement.cpp +++ b/Geo/MElement.cpp @@ -152,7 +152,7 @@ double MElement::maxDistToStraight() const double MElement::minIsotropyMeasure(bool knownValid, bool reversedOK) { #if defined(HAVE_MESH) - return jacobianBasedQuality::minIsotropyMeasure(this, knownValid, reversedOK); + return jacobianBasedQuality::minICNMeasure(this, knownValid, reversedOK); #else return 0.; #endif @@ -161,7 +161,7 @@ double MElement::minIsotropyMeasure(bool knownValid, bool reversedOK) double MElement::minScaledJacobian(bool knownValid, bool reversedOK) { #if defined(HAVE_MESH) - return jacobianBasedQuality::minScaledJacobian(this, knownValid, reversedOK); + return jacobianBasedQuality::minIGEMeasure(this, knownValid, reversedOK); #else return 0.; #endif @@ -175,7 +175,7 @@ double MElement::specialQuality() if (minJ <= 0.) return minJ; // if (minJ < 0 && maxJ >= 0) return minJ/maxJ; // accept -inf as an answer // if (minJ < 0 && maxJ < 0) return -std::numeric_limits<double>::infinity(); - return jacobianBasedQuality::minIsotropyMeasure(this, true); + return jacobianBasedQuality::minICNMeasure(this, true); #else return 0; #endif @@ -189,7 +189,7 @@ double MElement::specialQuality2() if (minJ <= 0.) return minJ; // if (minJ < 0 && maxJ >= 0) return minJ/maxJ; // accept -inf as an answer // if (minJ < 0 && maxJ < 0) return -std::numeric_limits<double>::infinity(); - return jacobianBasedQuality::minScaledJacobian(this, true); + return jacobianBasedQuality::minIGEMeasure(this, true); #else return 0; #endif diff --git a/Mesh/qualityMeasuresJacobian.cpp b/Mesh/qualityMeasuresJacobian.cpp index 81c82855b25d85d7248832da8b75f9528dd32ce8..1ad2692f92e2bf65773649bd645aa7fcff0a5841 100644 --- a/Mesh/qualityMeasuresJacobian.cpp +++ b/Mesh/qualityMeasuresJacobian.cpp @@ -27,9 +27,9 @@ double TM##n = Cpu(); namespace jacobianBasedQuality { -double _CoeffDataScaledJac::cTri = 2/std::sqrt(3); -double _CoeffDataScaledJac::cTet = std::sqrt(2); -double _CoeffDataScaledJac::cPyr = std::sqrt(2); +double _CoeffDataIGE::cTri = 2/std::sqrt(3); +double _CoeffDataIGE::cTet = std::sqrt(2); +double _CoeffDataIGE::cPyr = std::sqrt(2); void minMaxJacobianDeterminant(MElement *el, double &min, double &max, const fullMatrix<double> *normals) @@ -65,10 +65,12 @@ void minMaxJacobianDeterminant(MElement *el, double &min, double &max, } } -double minScaledJacobian(MElement *el, bool knownValid, bool reversedOk) +double minIGEMeasure(MElement *el, bool knownValid, bool reversedOk) { bool isReversed = false; if (!knownValid) { + // Computation of the measure should never + // be performed to invalid elements (for which the measure is 0). double jmin, jmax; minMaxJacobianDeterminant(el, jmin, jmax); if (jmax < 0) { @@ -77,8 +79,6 @@ double minScaledJacobian(MElement *el, bool knownValid, bool reversedOk) } else if (jmin <= 0) return 0; } - // Computation of the minimum (or maximum) of the scaled Jacobian should never - // be performed to invalid elements (for which the measure is 0). fullMatrix<double> nodesXYZ(el->getNumVertices(), 3); el->getNodesCoord(nodesXYZ); @@ -113,7 +113,7 @@ double minScaledJacobian(MElement *el, bool knownValid, bool reversedOk) jacDetSpace = FuncSpaceData(el, false, jacOrder, jacOrder-3, &serendipFalse); break; default: - Msg::Error("Scaled Jacobian not implemented for type of element %d", el->getType()); + Msg::Error("IGE measure not implemented for type of element %d", el->getType()); return -1; } gradBasis = BasisFactory::getGradientBasis(jacMatSpace); @@ -142,7 +142,7 @@ double minScaledJacobian(MElement *el, bool knownValid, bool reversedOk) std::vector<_CoeffData*> domains; domains.push_back( - new _CoeffDataScaledJac(coeffDetBez, coeffMatBez, jacBasis->getBezier(), + new _CoeffDataIGE(coeffDetBez, coeffMatBez, jacBasis->getBezier(), gradBasis->getBezier(), 0, el->getType()) ); @@ -164,12 +164,14 @@ double minScaledJacobian(MElement *el, bool knownValid, bool reversedOk) return min; } -double minIsotropyMeasure(MElement *el, - bool knownValid, - bool reversedOk) +double minICNMeasure(MElement *el, + bool knownValid, + bool reversedOk) { bool isReversed = false; if (!knownValid) { + // Computation of the measure should never + // be performed to invalid elements (for which the measure is 0). double jmin, jmax; minMaxJacobianDeterminant(el, jmin, jmax); if (jmax < 0) { @@ -178,8 +180,6 @@ double minIsotropyMeasure(MElement *el, } else if (jmin <= 0) return 0; } - // Computation of the minimum (or maximum) of the scaled Jacobian should never - // be performed to invalid elements (for which the measure is 0). fullMatrix<double> nodesXYZ(el->getNumVertices(), 3); el->getNodesCoord(nodesXYZ); @@ -214,7 +214,7 @@ double minIsotropyMeasure(MElement *el, jacDetSpace = FuncSpaceData(el, false, jacOrder, jacOrder-3, &serendipFalse); break; default: - Msg::Error("Isotropy not implemented for type of element %d", el->getType()); + Msg::Error("ICN not implemented for type of element %d", el->getType()); return -1; } gradBasis = BasisFactory::getGradientBasis(jacMatSpace); @@ -243,7 +243,7 @@ double minIsotropyMeasure(MElement *el, std::vector<_CoeffData*> domains; domains.push_back( - new _CoeffDataIsotropy(coeffDetBez, coeffMatBez, jacBasis->getBezier(), + new _CoeffDataICN(coeffDetBez, coeffMatBez, jacBasis->getBezier(), gradBasis->getBezier(), 0) ); @@ -281,7 +281,7 @@ double minIsotropyMeasure(MElement *el, // return min; //} -double minSampledIsotropyMeasure(MElement *el, int deg, bool writeInFile)//fordebug +double minSampledICNMeasure(MElement *el, int deg, bool writeInFile)//fordebug { fullMatrix<double> nodesXYZ(el->getNumVertices(), 3); el->getNodesCoord(nodesXYZ); @@ -310,7 +310,7 @@ double minSampledIsotropyMeasure(MElement *el, int deg, bool writeInFile)//forde // jacDetSpace = FuncSpaceData(el, false, jacOrder, jacOrder-3, &serendipFalse); break; default: - Msg::Error("Isotropy not implemented for type of element %d", el->getType()); + Msg::Error("ICN not implemented for type of element %d", el->getType()); return -1; } gradBasis = BasisFactory::getGradientBasis(jacMatSpace); @@ -340,7 +340,7 @@ double minSampledIsotropyMeasure(MElement *el, int deg, bool writeInFile)//forde return min; } -double minSampledScaledJacobian(MElement *el, int deg, bool writeInFile)//fordebug +double minSampledIGEMeasure(MElement *el, int deg, bool writeInFile)//fordebug { fullMatrix<double> nodesXYZ(el->getNumVertices(), 3); el->getNodesCoord(nodesXYZ); @@ -369,7 +369,7 @@ double minSampledScaledJacobian(MElement *el, int deg, bool writeInFile)//fordeb // jacDetSpace = FuncSpaceData(el, false, jacOrder, jacOrder-3, &serendipFalse); break; default: - Msg::Error("Isotropy not implemented for type of element %d", el->getType()); + Msg::Error("ICN not implemented for type of element %d", el->getType()); return -1; } gradBasis = BasisFactory::getGradientBasis(jacMatSpace); @@ -469,8 +469,8 @@ void _CoeffDataJac::getSubCoeff(std::vector<_CoeffData*> &v) const } } -// Scaled Jacobian (quality of quads and hexes) -_CoeffDataScaledJac::_CoeffDataScaledJac(fullVector<double> &det, +// IGE measure (Inverse Gradient Error) +_CoeffDataIGE::_CoeffDataIGE(fullVector<double> &det, fullMatrix<double> &mat, const bezierBasis *bfsDet, const bezierBasis *bfsMat, @@ -480,7 +480,7 @@ _CoeffDataScaledJac::_CoeffDataScaledJac(fullVector<double> &det, _bfsDet(bfsDet), _bfsMat(bfsMat), _type(type) { if (!det.getOwnData() || !mat.getOwnData()) { - Msg::Fatal("Cannot create an instance of _CoeffDataScaledJac from a " + Msg::Fatal("Cannot create an instance of _CoeffDataIGE from a " "fullVector or a fullMatrix that does not own its data."); } // _coeffsJacDet and _coeffsJacMat reuse data, this avoid to allocate new @@ -499,13 +499,13 @@ _CoeffDataScaledJac::_CoeffDataScaledJac(fullVector<double> &det, // computation of _maxB not implemented for now } -bool _CoeffDataScaledJac::boundsOk(double minL, double maxL) const +bool _CoeffDataIGE::boundsOk(double minL, double maxL) const { static double tol = 1e-3; return minL - _minB < tol; } -void _CoeffDataScaledJac::getSubCoeff(std::vector<_CoeffData*> &v) const +void _CoeffDataIGE::getSubCoeff(std::vector<_CoeffData*> &v) const { v.clear(); v.reserve(_bfsDet->getNumDivision()); @@ -522,14 +522,14 @@ void _CoeffDataScaledJac::getSubCoeff(std::vector<_CoeffData*> &v) const fullMatrix<double> coeffM(szM1, szM2); coeffD.copy(subCoeffD, i * szD, szD, 0); coeffM.copy(subCoeffM, i * szM1, szM1, 0, szM2, 0, 0); - _CoeffDataScaledJac *newData; - newData = new _CoeffDataScaledJac(coeffD, coeffM, _bfsDet, _bfsMat, + _CoeffDataIGE *newData; + newData = new _CoeffDataIGE(coeffD, coeffM, _bfsDet, _bfsMat, _depth+1, _type); v.push_back(newData); } } -void _CoeffDataScaledJac::_computeAtCorner(double &min, double &max) const +void _CoeffDataIGE::_computeAtCorner(double &min, double &max) const { min = std::numeric_limits<double>::infinity(); max = -min; @@ -581,7 +581,7 @@ void _CoeffDataScaledJac::_computeAtCorner(double &min, double &max) const 1/v(i,4)/v(i,5)/v(i,3) ) / 8; break; default: - Msg::Error("Unkown type for scaled jac computation"); + Msg::Error("Unkown type for IGE computation"); return; } min = std::min(min, sJ); @@ -589,7 +589,7 @@ void _CoeffDataScaledJac::_computeAtCorner(double &min, double &max) const } } -double _CoeffDataScaledJac::_computeLowerBound() const +double _CoeffDataIGE::_computeLowerBound() const { // Speedup: If one coeff _coeffsJacDet is negative, without bounding // J^2/(a^2+b^2), we would get with certainty a negative lower bound. @@ -706,12 +706,12 @@ double _CoeffDataScaledJac::_computeLowerBound() const } default: - Msg::Info("Unknown type for scaled Jacobian (%d)", _type); + Msg::Info("Unknown type for IGE (%d)", _type); return -1; } } -void _CoeffDataScaledJac::_getCoeffLengthVectors(fullMatrix<double> &coeff, +void _CoeffDataIGE::_getCoeffLengthVectors(fullMatrix<double> &coeff, bool corners) const { int sz1 = corners ? _bfsDet->getNumLagCoeff() : _coeffsJacMat.size1(); @@ -724,7 +724,7 @@ void _CoeffDataScaledJac::_getCoeffLengthVectors(fullMatrix<double> &coeff, case TYPE_TET: coeff.resize(sz1, 6); break; case TYPE_PYR: coeff.resize(sz1, 6); break; default: - Msg::Error("Unkown type for scaled jac computation"); + Msg::Error("Unkown type for IGE computation"); coeff.resize(0, 0); return; } @@ -798,8 +798,8 @@ void _CoeffDataScaledJac::_getCoeffLengthVectors(fullMatrix<double> &coeff, } } -// Isotropy measure -_CoeffDataIsotropy::_CoeffDataIsotropy(fullVector<double> &det, +// ICN measure (Inverse Condition Number) +_CoeffDataICN::_CoeffDataICN(fullVector<double> &det, fullMatrix<double> &mat, const bezierBasis *bfsDet, const bezierBasis *bfsMat, @@ -809,7 +809,7 @@ _CoeffDataIsotropy::_CoeffDataIsotropy(fullVector<double> &det, _bfsDet(bfsDet), _bfsMat(bfsMat) { if (!det.getOwnData() || !mat.getOwnData()) { - Msg::Fatal("Cannot create an instance of _CoeffDataScaledJac from a " + Msg::Fatal("Cannot create an instance of _CoeffDataIGE from a " "fullVector or a fullMatrix that does not own its data."); } // _coeffsJacDet and _coeffsMetric reuse data, this avoid to allocate new @@ -832,13 +832,13 @@ _CoeffDataIsotropy::_CoeffDataIsotropy(fullVector<double> &det, // _maxB not used for now } -bool _CoeffDataIsotropy::boundsOk(double minL, double maxL) const +bool _CoeffDataICN::boundsOk(double minL, double maxL) const { static double tol = 1e-3; return minL < tol*1e-3 || (_minB > minL-tol && _minB > minL*(1-100*tol)); } -void _CoeffDataIsotropy::getSubCoeff(std::vector<_CoeffData*> &v) const +void _CoeffDataICN::getSubCoeff(std::vector<_CoeffData*> &v) const { v.clear(); v.reserve(_bfsMat->getNumDivision()); @@ -855,13 +855,13 @@ void _CoeffDataIsotropy::getSubCoeff(std::vector<_CoeffData*> &v) const fullMatrix<double> coeffM(szM1, szM2); coeffD.copy(subCoeffD, i * szD, szD, 0); coeffM.copy(subCoeffM, i * szM1, szM1, 0, szM2, 0, 0); - _CoeffDataIsotropy *newData - = new _CoeffDataIsotropy(coeffD, coeffM, _bfsDet, _bfsMat, _depth+1); + _CoeffDataICN *newData + = new _CoeffDataICN(coeffD, coeffM, _bfsDet, _bfsMat, _depth+1); v.push_back(newData); } } -void _CoeffDataIsotropy::_computeAtCorner(double &min, double &max) const +void _CoeffDataICN::_computeAtCorner(double &min, double &max) const { min = std::numeric_limits<double>::infinity(); max = -min; @@ -881,7 +881,7 @@ void _CoeffDataIsotropy::_computeAtCorner(double &min, double &max) const } } -double _CoeffDataIsotropy::_computeLowerBound() const +double _CoeffDataICN::_computeLowerBound() const { // Speedup: If one coeff _coeffsJacDet is negative, we would get // a negative lower bound. For now, returning 0. diff --git a/Mesh/qualityMeasuresJacobian.h b/Mesh/qualityMeasuresJacobian.h index 2ed23400530756962ad0bc52b2c3ff5d2875acc7..5169c8e2d7ea4d65202462a3df01ff221195e514 100644 --- a/Mesh/qualityMeasuresJacobian.h +++ b/Mesh/qualityMeasuresJacobian.h @@ -17,18 +17,18 @@ namespace jacobianBasedQuality { void minMaxJacobianDeterminant(MElement *el, double &min, double &max, const fullMatrix<double> *normals = NULL); -double minScaledJacobian(MElement *el, - bool knownValid = false, - bool reversedOk = false); -double minIsotropyMeasure(MElement *el, - bool knownValid = false, - bool reversedOk = false); +double minIGEMeasure(MElement *el, + bool knownValid = false, + bool reversedOk = false); +double minICNMeasure(MElement *el, + bool knownValid = false, + bool reversedOk = false); //double minSampledAnisotropyMeasure(MElement *el, int order,//fordebug // bool writeInFile = false); -double minSampledIsotropyMeasure(MElement *el, int order,//fordebug - bool writeInFile = false); -double minSampledScaledJacobian(MElement *el, int order,//fordebug - bool writeInFile = false); +double minSampledICNMeasure(MElement *el, int order,//fordebug + bool writeInFile = false); +double minSampledIGEMeasure(MElement *el, int order,//fordebug + bool writeInFile = false); class _CoeffData { @@ -75,7 +75,7 @@ public: int getNumMeasure() const {return 1;}//fordebug }; -class _CoeffDataScaledJac: public _CoeffData +class _CoeffDataIGE: public _CoeffData { private: const fullVector<double> _coeffsJacDet; @@ -87,12 +87,12 @@ private: static double cPyr; public: - _CoeffDataScaledJac(fullVector<double> &det, + _CoeffDataIGE(fullVector<double> &det, fullMatrix<double> &mat, const bezierBasis *bfsDet, const bezierBasis *bfsMat, int depth, int type); - ~_CoeffDataScaledJac() {} + ~_CoeffDataIGE() {} bool boundsOk(double minL, double maxL) const; void getSubCoeff(std::vector<_CoeffData*>&) const; @@ -106,7 +106,7 @@ private: fullMatrix<double> &coeffScaledJacobian) const; }; -class _CoeffDataIsotropy: public _CoeffData +class _CoeffDataICN: public _CoeffData { private: const fullVector<double> _coeffsJacDet; @@ -114,12 +114,12 @@ private: const bezierBasis *_bfsDet, *_bfsMat; public: - _CoeffDataIsotropy(fullVector<double> &det, + _CoeffDataICN(fullVector<double> &det, fullMatrix<double> &metric, const bezierBasis *bfsDet, const bezierBasis *bfsMet, int depth); - ~_CoeffDataIsotropy() {} + ~_CoeffDataICN() {} bool boundsOk(double minL, double maxL) const; void getSubCoeff(std::vector<_CoeffData*>&) const; diff --git a/Mesh/yamakawa.cpp b/Mesh/yamakawa.cpp index 983fbf4695d3714b58685e0fed39829ab81f8ff3..12e5f2c7462b74d784f42036e84b390b5ab35c67 100644 --- a/Mesh/yamakawa.cpp +++ b/Mesh/yamakawa.cpp @@ -1477,7 +1477,7 @@ double Recombinator::min_scaled_jacobian(Hex &hex) { /*MHexahedron *h1 = new MHexahedron(a, b, c, d, e, f, g, h); MHexahedron *h2 = new MHexahedron(e, f, g, h, a, b, c, d); double min1 = jacobianBasedQuality::minScaledJacobian(h1); - double min2 = jacobianBasedQuality::minScaledJacobian(h2); + double min2 = jacobianBasedQuality::minIGEMeasure(h2); for(i=0;i<8;i++){ file << jacobians[i] << " "; } @@ -2980,7 +2980,7 @@ double Supplementary::min_scaled_jacobian(Prism prism) { /*MPrism *p1 = new MPrism(a, b, c, d, e, f); MPrism *p2 = new MPrism(d, e, f, a, b, c); double min1 = jacobianBasedQuality::minScaledJacobian(p1); - double min2 = jacobianBasedQuality::minScaledJacobian(p2); + double min2 = jacobianBasedQuality::minIGEMeasure(p2); for(i=0;i<6;i++){ file << jacobians[i] << " "; } diff --git a/Mesh/yamakawa.h b/Mesh/yamakawa.h index 9025a5029bffbaf44f91a7643337c9f6b596f601..c1420bfe260aa1c3fde3e378751d55a5810c4073 100644 --- a/Mesh/yamakawa.h +++ b/Mesh/yamakawa.h @@ -40,7 +40,7 @@ class Hex { void compute_quality() { MHexahedron elt(vertices_); - quality = jacobianBasedQuality::minScaledJacobian(&elt, false, true); + quality = jacobianBasedQuality::minIGEMeasure(&elt, false, true); } void initialize() { diff --git a/Plugin/AnalyseCurvedMesh.cpp b/Plugin/AnalyseCurvedMesh.cpp index bec7180b29ab5ab891a8eeeedb1834a9436cd630..f14b9ffaf73b8808a88f160a58766af81bdd3ddd 100644 --- a/Plugin/AnalyseCurvedMesh.cpp +++ b/Plugin/AnalyseCurvedMesh.cpp @@ -356,7 +356,7 @@ void GMSH_AnalyseCurvedMeshPlugin::_computeMinIGE(int dim) _data[i].setMinS(0); } else { - _data[i].setMinS(jacobianBasedQuality::minScaledJacobian(el, true)); + _data[i].setMinS(jacobianBasedQuality::minIGEMeasure(el, true)); } progress.next(); } @@ -377,7 +377,7 @@ void GMSH_AnalyseCurvedMeshPlugin::_computeMinICN(int dim) _data[i].setMinI(0); } else { - _data[i].setMinI(jacobianBasedQuality::minIsotropyMeasure(el, true)); + _data[i].setMinI(jacobianBasedQuality::minICNMeasure(el, true)); } progress.next(); }