From 62227e928392a71a014b2799d946401caf574dca Mon Sep 17 00:00:00 2001 From: abn Date: Mon, 26 Jun 2017 15:45:17 +0200 Subject: [PATCH] Refactoring QuadraticPlanar precision tuning. Fixes intersector bugs. --- .../Geometric2D/InterpKernelGeo2DBounds.cxx | 17 +-- .../InterpKernelGeo2DComposedEdge.cxx | 4 +- .../Geometric2D/InterpKernelGeo2DEdge.cxx | 6 +- .../InterpKernelGeo2DEdgeArcCircle.cxx | 18 +-- .../Geometric2D/InterpKernelGeo2DEdgeLin.cxx | 8 +- .../Geometric2D/InterpKernelGeo2DNode.hxx | 4 +- .../InterpKernelGeo2DPrecision.cxx | 34 ++++- .../InterpKernelGeo2DPrecision.hxx | 42 +++++- src/INTERP_KERNEL/Geometric2DIntersector.hxx | 2 + src/INTERP_KERNEL/Geometric2DIntersector.txx | 4 +- src/INTERP_KERNEL/InterpolationOptions.cxx | 4 +- .../QuadraticPlanarInterpTest2.cxx | 4 +- .../QuadraticPlanarInterpTest4.cxx | 80 +++++------ .../QuadraticPlanarInterpTest5.cxx | 132 +++++++++--------- src/MEDCoupling/MEDCouplingPointSet.cxx | 5 +- src/MEDCoupling/MEDCouplingUMesh.cxx | 5 +- src/MEDCoupling/MEDCouplingUMesh_internal.cxx | 2 +- src/MEDCoupling/MEDCouplingUMesh_internal.hxx | 6 +- .../MEDCouplingUMesh_intersection.cxx | 18 +-- .../MEDCouplingIntersectTest.py | 62 ++++++++ 20 files changed, 293 insertions(+), 164 deletions(-) diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DBounds.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DBounds.cxx index c65b3aa96..4f2915ed4 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DBounds.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DBounds.cxx @@ -148,15 +148,16 @@ double Bounds::fitYForXFigD(double val, int res) const Bounds *Bounds::nearlyAmIIntersectingWith(const Bounds& other) const { - if( (other._x_min > _x_max+QUADRATIC_PLANAR::_precision) || (other._x_max < _x_min-QUADRATIC_PLANAR::_precision) || (other._y_min > _y_max+QUADRATIC_PLANAR::_precision) - || (other._y_max < _y_min-QUADRATIC_PLANAR::_precision) ) + double eps = QuadraticPlanarPrecision::getPrecision(); + if( (other._x_min > _x_max+eps) || (other._x_max < _x_min-eps) || (other._y_min > _y_max+eps) + || (other._y_max < _y_min-eps) ) return 0; if( (other._x_min >= _x_max ) || (other._x_max <= _x_min) || (other._y_min >= _y_max) || (other._y_max <= _y_min) ) { - return new Bounds(std::max(_x_min-QUADRATIC_PLANAR::_precision,other._x_min), - std::min(_x_max+QUADRATIC_PLANAR::_precision,other._x_max), - std::max(_y_min-QUADRATIC_PLANAR::_precision,other._y_min), - std::min(_y_max+QUADRATIC_PLANAR::_precision,other._y_max));//In approx cases. + return new Bounds(std::max(_x_min-eps,other._x_min), + std::min(_x_max+eps,other._x_max), + std::max(_y_min-eps,other._y_min), + std::min(_y_max+eps,other._y_max));//In approx cases. } else return new Bounds(std::max(_x_min,other._x_min),std::min(_x_max,other._x_max),std::max(_y_min,other._y_min),std::min(_y_max,other._y_max)); @@ -183,7 +184,7 @@ Position Bounds::nearlyWhere(double x, double y) const bool thinY=Node::areDoubleEquals(_y_min,_y_max); if(!thinX) { - if((Node::areDoubleEquals(x,_x_min) || Node::areDoubleEquals(x,_x_max)) && ((y<_y_max+QUADRATIC_PLANAR::_precision) && (y>_y_min-QUADRATIC_PLANAR::_precision))) + if((Node::areDoubleEquals(x,_x_min) || Node::areDoubleEquals(x,_x_max)) && ((y<_y_max+QuadraticPlanarPrecision::getPrecision()) && (y>_y_min-QuadraticPlanarPrecision::getPrecision()))) return ON_BOUNDARY_POS; } else @@ -191,7 +192,7 @@ Position Bounds::nearlyWhere(double x, double y) const return OUT; if(!thinY) { - if((Node::areDoubleEquals(y,_y_min) || Node::areDoubleEquals(y,_y_max)) && ((x<_x_max+QUADRATIC_PLANAR::_precision) && (x>_x_min-QUADRATIC_PLANAR::_precision))) + if((Node::areDoubleEquals(y,_y_min) || Node::areDoubleEquals(y,_y_max)) && ((x<_x_max+QuadraticPlanarPrecision::getPrecision()) && (x>_x_min-QuadraticPlanarPrecision::getPrecision()))) return ON_BOUNDARY_POS; } else diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.cxx index 226ff2ccb..f445f5e44 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.cxx @@ -541,14 +541,14 @@ bool ComposedEdge::isInOrOut2(Node *nodeToTest) const std::set nodes; getAllNodes(nodes); for(std::set::const_iterator iter=nodes.begin();iter!=nodes.end();iter++) - if(sqrt((*iter)->distanceWithSq(*nodeToTest))distanceWithSq(*nodeToTest))::iterator iter4=inOutSwitch.begin();iter4!=inOutSwitch.end();iter4++) { double val((*iter4).getVal1()); - if(fabs(val-ref)>=QUADRATIC_PLANAR::_precision) + if(fabs(val-ref)>=QuadraticPlanarPrecision::getPrecision()) { if(val& p1, const std::pair& p2) { - return fabs(p1.first-p2.first)& addNodes, const for(std::vector< std::pair >::const_iterator it=an2.begin();it!=itend;it++) { int idd=(*mapp2.find((*it).second)).second; - if((*it).first1-QUADRATIC_PLANAR::_precision) + if((*it).first>1-QuadraticPlanarPrecision::getPrecision()) { endId=idd; continue; diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx index e0a5ea8e6..fc3fce7ed 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx @@ -174,7 +174,7 @@ void ArcCArcCIntersector::areOverlappedOrOnlyColinears(const Bounds *whereToFind { _dist=Node::distanceBtw2Pt(getE1().getCenter(),getE2().getCenter()); double radius1=getE1().getRadius(); double radius2=getE2().getRadius(); - if(_dist>radius1+radius2+QUADRATIC_PLANAR::_precision || _dist+std::min(radius1,radius2)+QUADRATIC_PLANAR::_precisionradius1+radius2+QuadraticPlanarPrecision::getPrecision() || _dist+std::min(radius1,radius2)+QuadraticPlanarPrecision::getPrecision()-2*QUADRATIC_PLANAR::_precision)//QUADRATIC_PLANAR::_precision*QUADRATIC_PLANAR::_precision*_drSq*_drSq/(2.*_dx*_dx)) + if(_determinant>-2*QuadraticPlanarPrecision::getPrecision())//QuadraticPlanarPrecision::getPrecision()*QuadraticPlanarPrecision::getPrecision()*_drSq*_drSq/(2.*_dx*_dx)) obviousNoIntersection=false; else obviousNoIntersection=true; @@ -351,7 +351,7 @@ std::list< IntersectElement > ArcCSegIntersector::getIntersectionsCharacteristic { std::list< IntersectElement > ret; const double *center=getE1().getCenter(); - if(!(fabs(_determinant)<(2.*QUADRATIC_PLANAR::_precision)))//QUADRATIC_PLANAR::_precision*QUADRATIC_PLANAR::_precision*_drSq*_drSq/(2.*_dx*_dx)) + if(!(fabs(_determinant)<(2.*QuadraticPlanarPrecision::getPrecision())))//QuadraticPlanarPrecision::getPrecision()*QuadraticPlanarPrecision::getPrecision()*_drSq*_drSq/(2.*_dx*_dx)) { double determinant=EdgeArcCircle::SafeSqrt(_determinant); double x1=(_cross*_dy/_drSq+Node::sign(_dy)*_dx*determinant)+center[0]; @@ -644,9 +644,9 @@ void EdgeArcCircle::getMiddleOfPoints(const double *p1, const double *p2, double // double myDelta1(angle1-_angle0),myDelta2(angle2-_angle0); if(_angle>0.) - { myDelta1=myDelta1>-QUADRATIC_PLANAR::_precision?myDelta1:myDelta1+2.*M_PI; myDelta2=myDelta2>-QUADRATIC_PLANAR::_precision?myDelta2:myDelta2+2.*M_PI; } + { myDelta1=myDelta1>-QuadraticPlanarPrecision::getPrecision()?myDelta1:myDelta1+2.*M_PI; myDelta2=myDelta2>-QuadraticPlanarPrecision::getPrecision()?myDelta2:myDelta2+2.*M_PI; } else - { myDelta1=myDelta10.) { - myDelta1=myDelta1>-(_radius*QUADRATIC_PLANAR::_precision)?myDelta1:myDelta1+2.*M_PI;//in some cases val1 or val2 are so close to angle0 that myDelta is close to 0. but negative. - myDelta2=myDelta2>-(_radius*QUADRATIC_PLANAR::_precision)?myDelta2:myDelta2+2.*M_PI; + myDelta1=myDelta1>-(_radius*QuadraticPlanarPrecision::getPrecision())?myDelta1:myDelta1+2.*M_PI;//in some cases val1 or val2 are so close to angle0 that myDelta is close to 0. but negative. + myDelta2=myDelta2>-(_radius*QuadraticPlanarPrecision::getPrecision())?myDelta2:myDelta2+2.*M_PI; return myDelta1 SegSegIntersector::getIntersectionsCharacteristicV bool SegSegIntersector::areColinears() const { double determinant=_matrix[0]*_matrix[3]-_matrix[1]*_matrix[2]; - return fabs(determinant)2.*QUADRATIC_PLANAR::_precision)//2*_precision due to max of offset on _start and _end + if(fabs(determinant)>2.*QuadraticPlanarPrecision::getPrecision())//2*_precision due to max of offset on _start and _end { colinearity=false; areOverlapped=false; _matrix[0]/=determinant; _matrix[1]/=determinant; _matrix[2]/=determinant; _matrix[3]/=determinant; @@ -136,7 +136,7 @@ void SegSegIntersector::areOverlappedOrOnlyColinears(const Bounds *whereToFind, double deno=sqrt(_matrix[0]*_matrix[0]+_matrix[1]*_matrix[1]); double x=(*(_e1.getStartNode()))[0]-(*(_e2.getStartNode()))[0]; double y=(*(_e1.getStartNode()))[1]-(*(_e2.getStartNode()))[1]; - areOverlapped=fabs((_matrix[1]*y+_matrix[0]*x)/deno)=0) return 1.; else return -1.; } static double norm(const double *vect) { return sqrt(vect[0]*vect[0]+vect[1]*vect[1]); } - static bool areDoubleEquals(double a, double b) { return fabs(a-b) < QUADRATIC_PLANAR::_precision; } + static bool areDoubleEquals(double a, double b) { return fabs(a-b) < QuadraticPlanarPrecision::getPrecision(); } //! idem areDoubleEquals except that precision of comparison is modified. - static bool areDoubleEqualsWP(double a, double b, double k) { return fabs(a-b) < k*QUADRATIC_PLANAR::_precision; } + static bool areDoubleEqualsWP(double a, double b, double k) { return fabs(a-b) < k*QuadraticPlanarPrecision::getPrecision(); } static double distanceBtw2Pt(const double *a, const double *b) { return sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1])); } static double distanceBtw2PtSq(const double *a, const double *b) { return (a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1]); } // diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DPrecision.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DPrecision.cxx index f570ec74c..e21076145 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DPrecision.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DPrecision.cxx @@ -20,16 +20,38 @@ #include "InterpKernelGeo2DPrecision.hxx" -double INTERP_KERNEL::QUADRATIC_PLANAR::_precision=1e-14; +double INTERP_KERNEL::QuadraticPlanarPrecision::_precision=1e-14; +double INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::_arc_detection_precision=1e-14; + +INTERP_KERNEL::QuadraticPlanarPrecision::QuadraticPlanarPrecision(double precision): + _initial_precision(_precision) +{ + _precision=precision; +} + +INTERP_KERNEL::QuadraticPlanarPrecision::~QuadraticPlanarPrecision() +{ + _precision = _initial_precision; +} + +INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::QuadraticPlanarArcDetectionPrecision(double precision): + _initial_arc_detection_precision(_arc_detection_precision) +{ + _arc_detection_precision=precision; +} + +INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::~QuadraticPlanarArcDetectionPrecision() +{ + _arc_detection_precision = _initial_arc_detection_precision; +} -double INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=1e-14; -void INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(double precision) +void INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(double precision) { - INTERP_KERNEL::QUADRATIC_PLANAR::_precision=precision; + _precision=precision; } -void INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(double precision) +void INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(double precision) { - INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=precision; + _arc_detection_precision=precision; } diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DPrecision.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DPrecision.hxx index 191312347..3db7d194d 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DPrecision.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DPrecision.hxx @@ -25,14 +25,50 @@ namespace INTERP_KERNEL { - class INTERPKERNEL_EXPORT QUADRATIC_PLANAR + /* !!TODO: a more global review of the code should be done, so that eps is always a parameter of all methods + instead of being stored as a static attribute. + */ + + /** Class storing the precision for the detection of colinear segments, coincident points, etc ... + * in Geometric2D computations. + * + * RAII pattern allowing to temporarily override Geometric2D precision. + * When the instance is destroyed, the previous precision is set back. + * + */ + class QuadraticPlanarPrecision { public: - static double _precision; - static double _arc_detection_precision; + QuadraticPlanarPrecision(double prec); + virtual ~QuadraticPlanarPrecision(); + static void setPrecision(double precision); + inline static double getPrecision() { return _precision; } + private: + static double _precision; + double _initial_precision; + }; + + /** Class storing the precision for the detection of degenerated arc of circles + * in Geometric2D computations. + * + * RAII pattern allowing to temporarily override Geometric2D precision. + * When the instance is destroyed, the previous precision is set back. + */ + class QuadraticPlanarArcDetectionPrecision + { + public: + QuadraticPlanarArcDetectionPrecision(double prec); + virtual ~QuadraticPlanarArcDetectionPrecision(); + static void setArcDetectionPrecision(double precision); + inline static double getArcDetectionPrecision() { return _arc_detection_precision; } + private: + static double _arc_detection_precision; + double _initial_arc_detection_precision; + }; } #endif + diff --git a/src/INTERP_KERNEL/Geometric2DIntersector.hxx b/src/INTERP_KERNEL/Geometric2DIntersector.hxx index a1a19a38d..541e5f4ab 100644 --- a/src/INTERP_KERNEL/Geometric2DIntersector.hxx +++ b/src/INTERP_KERNEL/Geometric2DIntersector.hxx @@ -54,6 +54,8 @@ namespace INTERP_KERNEL QuadraticPolygon *buildPolygonOfOneEdgeFrom(const std::vector& coords, NormalizedCellType type); QuadraticPolygon *buildPolygonAFrom(ConnType cell, int nbOfPoints, NormalizedCellType type); QuadraticPolygon *buildPolygonBFrom(ConnType cell, int nbOfPoints, NormalizedCellType type); + + QuadraticPlanarPrecision _precision; }; } diff --git a/src/INTERP_KERNEL/Geometric2DIntersector.txx b/src/INTERP_KERNEL/Geometric2DIntersector.txx index 786f41c56..38c7c8d81 100644 --- a/src/INTERP_KERNEL/Geometric2DIntersector.txx +++ b/src/INTERP_KERNEL/Geometric2DIntersector.txx @@ -44,9 +44,9 @@ namespace INTERP_KERNEL GEO2D_INTERSECTOR::Geometric2DIntersector(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double md3DSurf, double minDot3DSurf, double medianPlane, double precision, int orientation): - InterpType(meshT,meshS,dimCaracteristic, precision, md3DSurf, minDot3DSurf, medianPlane, true, orientation, 0) + InterpType(meshT,meshS,dimCaracteristic, precision, md3DSurf, minDot3DSurf, medianPlane, true, orientation, 0), + _precision(precision) { - QUADRATIC_PLANAR::_precision=precision; } INTERSECTOR_TEMPLATE diff --git a/src/INTERP_KERNEL/InterpolationOptions.cxx b/src/INTERP_KERNEL/InterpolationOptions.cxx index 23c2e353d..d66ffce13 100644 --- a/src/INTERP_KERNEL/InterpolationOptions.cxx +++ b/src/INTERP_KERNEL/InterpolationOptions.cxx @@ -96,12 +96,12 @@ void INTERP_KERNEL::InterpolationOptions::init() double INTERP_KERNEL::InterpolationOptions::getArcDetectionPrecision() const { - return INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision; + return INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::getArcDetectionPrecision(); } void INTERP_KERNEL::InterpolationOptions::setArcDetectionPrecision(double p) { - INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=p; + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(p); } std::string INTERP_KERNEL::InterpolationOptions::getIntersectionTypeRepr() const diff --git a/src/INTERP_KERNELTest/QuadraticPlanarInterpTest2.cxx b/src/INTERP_KERNELTest/QuadraticPlanarInterpTest2.cxx index 50e2c4cc3..4f78ab384 100644 --- a/src/INTERP_KERNELTest/QuadraticPlanarInterpTest2.cxx +++ b/src/INTERP_KERNELTest/QuadraticPlanarInterpTest2.cxx @@ -349,7 +349,7 @@ void QuadraticPlanarInterpTest::IntersectArcCircleBase() delete intersector; e2->decrRef(); e1->decrRef(); } // Tangent intersection - QUADRATIC_PLANAR::setPrecision(1e-5); + QuadraticPlanarPrecision::setPrecision(1e-5); for(unsigned k=0;k<8;k++) { double center2[2]; center[0]=0.; center[1]=0.; @@ -370,7 +370,7 @@ void QuadraticPlanarInterpTest::IntersectArcCircleBase() v4.clear(); v4.clear(); delete intersector; e2->decrRef(); e1->decrRef(); } - QUADRATIC_PLANAR::setPrecision(1e-14); + QuadraticPlanarPrecision::setPrecision(1e-14); // Extremities # 1 for(unsigned k=0;k<8;k++) { diff --git a/src/INTERP_KERNELTest/QuadraticPlanarInterpTest4.cxx b/src/INTERP_KERNELTest/QuadraticPlanarInterpTest4.cxx index c31c999de..019eeb84e 100644 --- a/src/INTERP_KERNELTest/QuadraticPlanarInterpTest4.cxx +++ b/src/INTERP_KERNELTest/QuadraticPlanarInterpTest4.cxx @@ -495,8 +495,8 @@ void QuadraticPlanarInterpTest::checkBarycenterCalculations() */ void QuadraticPlanarInterpTest::checkHighLevelFunctionTest1() { - QUADRATIC_PLANAR::setPrecision(1e-12); - QUADRATIC_PLANAR::setArcDetectionPrecision(1e-9); + QuadraticPlanarPrecision::setPrecision(1e-12); + QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-9); double coords[]={ 8.8334591186000004, 5.0999999999999996, 7.1014083111000001, 6.0999999999999996, @@ -581,13 +581,13 @@ void QuadraticPlanarInterpTest::checkHighLevelFunctionTest1() pol=QuadraticPolygon::BuildArcCirclePolygon(nodes); pol->getBarycenter(tmp,tmp2); delete pol; - QUADRATIC_PLANAR::setPrecision(1e-14); + QuadraticPlanarPrecision::setPrecision(1e-14); } void QuadraticPlanarInterpTest::check1DInterpLin() { - QUADRATIC_PLANAR::setPrecision(1e-7); - QUADRATIC_PLANAR::setArcDetectionPrecision(1e-9); + QuadraticPlanarPrecision::setPrecision(1e-7); + QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-9); const int NB_OF_CELL_AXIAL_1=30; static const double Z_VALS_1[NB_OF_CELL_AXIAL_1+1]= { -0.1550 , -0.1356, -0.1162, -0.0969, -0.0775 ,-0.0581, -0.0387, -0.0194, 0.0000 , 0.0500, @@ -631,7 +631,7 @@ void QuadraticPlanarInterpTest::check1DInterpLin() CPPUNIT_ASSERT_EQUAL(1,(int)m[i+2].size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,m[i+2][i+9],1e-12); } - QUADRATIC_PLANAR::setPrecision(1e-14); + QuadraticPlanarPrecision::setPrecision(1e-14); } /*! @@ -639,8 +639,8 @@ void QuadraticPlanarInterpTest::check1DInterpLin() */ void QuadraticPlanarInterpTest::checkEpsilonCoherency1() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-12); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-5); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-12); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-5); const double pol1[]={ -2.1083388455000001, 1.2172499999999999, @@ -709,8 +709,8 @@ void QuadraticPlanarInterpTest::checkNonRegression1() void QuadraticPlanarInterpTest::checkNonRegression2() { - QUADRATIC_PLANAR::setPrecision(1e-12); - QUADRATIC_PLANAR::setArcDetectionPrecision(1e-9); + QuadraticPlanarPrecision::setPrecision(1e-12); + QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-9); double coords1[]= { 15.141499999899999, -26.226033271399999, @@ -801,8 +801,8 @@ void QuadraticPlanarInterpTest::checkNonRegression3() void QuadraticPlanarInterpTest::checkNonRegression4() { - QUADRATIC_PLANAR::setPrecision(1e-12); - QUADRATIC_PLANAR::setArcDetectionPrecision(1e-9); + QuadraticPlanarPrecision::setPrecision(1e-12); + QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-9); double coords1[]= { 10.962340811000001, -22.417749999000002, @@ -857,8 +857,8 @@ void QuadraticPlanarInterpTest::checkNonRegression4() void QuadraticPlanarInterpTest::checkNonRegression5() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-12); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-5); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-12); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-5); double coords1[]= { -1.7320508075000001, 1, @@ -913,8 +913,8 @@ void QuadraticPlanarInterpTest::checkNonRegression5() void QuadraticPlanarInterpTest::checkNonRegression6() { - QUADRATIC_PLANAR::setPrecision(1e-12); - QUADRATIC_PLANAR::setArcDetectionPrecision(1e-5); + QuadraticPlanarPrecision::setPrecision(1e-12); + QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-5); double coords1[]= { 10.962340811000001, -22.417749999000002, @@ -965,8 +965,8 @@ void QuadraticPlanarInterpTest::checkNonRegression6() void QuadraticPlanarInterpTest::checkNonRegression7() { - QUADRATIC_PLANAR::setPrecision(1e-5); - QUADRATIC_PLANAR::setArcDetectionPrecision(1e-5); + QuadraticPlanarPrecision::setPrecision(1e-5); + QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-5); double coords1[]= { -2., 0, @@ -1017,8 +1017,8 @@ void QuadraticPlanarInterpTest::checkNonRegression7() void QuadraticPlanarInterpTest::checkNonRegression8() { - QUADRATIC_PLANAR::setPrecision(1e-3); - QUADRATIC_PLANAR::setArcDetectionPrecision(1e-5); + QuadraticPlanarPrecision::setPrecision(1e-3); + QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-5); double coords1[]= { -13.933240959000001, -28.559499999, @@ -1068,8 +1068,8 @@ void QuadraticPlanarInterpTest::checkNonRegression8() void QuadraticPlanarInterpTest::checkNonRegression9() { - QUADRATIC_PLANAR::setPrecision(1e-7); - QUADRATIC_PLANAR::setArcDetectionPrecision(1e-8); + QuadraticPlanarPrecision::setPrecision(1e-7); + QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-8); double coords1[]= { -0.04476229252902969, -0.085118027765365603, @@ -1119,8 +1119,8 @@ void QuadraticPlanarInterpTest::checkNonRegression9() void QuadraticPlanarInterpTest::checkNonRegression10() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords1[]= { -0.002269581957210453, -0.09851030343724453, -0.004268022334182935, -0.1059685844580936, @@ -1149,8 +1149,8 @@ void QuadraticPlanarInterpTest::checkNonRegression10() void QuadraticPlanarInterpTest::checkNonRegression11() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords1[]= { -0.002269581957210453, -0.09851030343724453, -0.004268022334182935, -0.1059685844580936, @@ -1200,8 +1200,8 @@ void QuadraticPlanarInterpTest::checkNonRegression11() void QuadraticPlanarInterpTest::checkNonRegression12() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-6); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-6); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords1[]= { -0.5032251558760915, -0.8716087994449138, -0.4695268343089433, -0.8806382374805872, @@ -1252,8 +1252,8 @@ void QuadraticPlanarInterpTest::checkNonRegression12() void QuadraticPlanarInterpTest::checkNonRegression13() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-6); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-6); double coords_1[194]={ 0, 0, 0.304375, -7.454791178893722e-17, 0.2152256265236553, -0.2152256265236555, -5.591093384170291e-17, -0.304375, @@ -1348,8 +1348,8 @@ void QuadraticPlanarInterpTest::checkNonRegression13() */ void QuadraticPlanarInterpTest::checkNonRegression14() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-6); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-6); double coords[72]={ 1.,0.,1.3,0.,-1.3,0.,-1.,0.,1.15,0.,0.,1.3,-1.15,0.,0.,1., @@ -1418,8 +1418,8 @@ void QuadraticPlanarInterpTest::checkNonRegression14() */ void QuadraticPlanarInterpTest::checkNonRegression15() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-6); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-6); double coords[72]={ 1.,0.,1.3,0.,-1.3,0.,-1.,0.,1.15,0.,0.,1.3,-1.15,0.,0.,1., @@ -1494,8 +1494,8 @@ private: */ void QuadraticPlanarInterpTest::checkNonRegression16() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords1[194]={ 0, 0, 0.304375, 0, 0.2152256265236554, 0.2152256265236554, 1.86369779472343e-17, 0.304375, -0.2152256265236554, 0.2152256265236554, -0.304375, 3.727395589446861e-17, -0.2152256265236555, -0.2152256265236554, -5.591093384170291e-17, -0.304375, @@ -1574,8 +1574,8 @@ void QuadraticPlanarInterpTest::checkNonRegression16() */ void QuadraticPlanarInterpTest::checkNonRegression17() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -1., 0., 1., 0. , 1.5, 0., -1.5, 0., 0. , 1., 1.25, 0., 0., 1.5, -1.25, 0.}; @@ -1614,7 +1614,7 @@ void QuadraticPlanarInterpTest::checkNonRegression17() void QuadraticPlanarInterpTest::checkNormalize() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-14); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-14); Node *n1=new Node(0.,0.); Node *n4=new Node(0.,-3.); Node *n2=new Node(10.,0.); Node *n5=new Node(10.,-3.); Node *n3=new Node(5.,10.); Node *n6=new Node(5.,7.); @@ -1665,7 +1665,7 @@ void QuadraticPlanarInterpTest::checkNormalize() void QuadraticPlanarInterpTest::checkMakePartitionAbs1() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-14); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-14); Node *n0=new Node(0.,0.); Node *n4=new Node(0.5,0.25); Node *n1=new Node(0.,0.5); Node *n5=new Node(0.3,1.2); Node *n2=new Node(1.,0.5); Node *n6=new Node(1.1,1.3); diff --git a/src/INTERP_KERNELTest/QuadraticPlanarInterpTest5.cxx b/src/INTERP_KERNELTest/QuadraticPlanarInterpTest5.cxx index 494e9530a..bdb9c15bb 100644 --- a/src/INTERP_KERNELTest/QuadraticPlanarInterpTest5.cxx +++ b/src/INTERP_KERNELTest/QuadraticPlanarInterpTest5.cxx @@ -45,8 +45,8 @@ private: void QuadraticPlanarInterpTest::checkNonRegressionOmar0000() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -0.383022221559489, 0.3213938048432697, -0.5745333323392334, 0.4820907072649046, 0.5745333323392335, 0.4820907072649044, 0.383022221559489, 0.3213938048432696, -0.4787777769493612, 0.4017422560540872, 4.592273826833915e-17, 0.75, 0.4787777769493612, 0.401742256054087, 3.061515884555943e-17, 0.5 }; @@ -71,8 +71,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0000() void QuadraticPlanarInterpTest::checkNonRegressionOmar0001() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -0.383022221559489, 0.3213938048432697, -0.5745333323392334, 0.4820907072649046, 0.5745333323392335, 0.4820907072649044, 0.383022221559489, 0.3213938048432696, -0.4787777769493612, 0.4017422560540872, 4.592273826833915e-17, 0.75, 0.4787777769493612, 0.401742256054087, 3.061515884555943e-17, 0.5 }; @@ -97,8 +97,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0001() void QuadraticPlanarInterpTest::checkNonRegressionOmar0002() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -0.383022221559489, 0.3213938048432697, -0.5745333323392334, 0.4820907072649046, 0.5745333323392335, 0.4820907072649044, 0.383022221559489, 0.3213938048432696, -0.4787777769493612, 0.4017422560540872, 4.592273826833915e-17, 0.75, 0.4787777769493612, 0.401742256054087, 3.061515884555943e-17, 0.5 }; @@ -123,8 +123,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0002() void QuadraticPlanarInterpTest::checkNonRegressionOmar0003() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -0.3535533905932737, 0.3535533905932738, -0.5303300858899106, 0.5303300858899107, 0.5303300858899107, 0.5303300858899106, 0.3535533905932738, 0.3535533905932737, -0.4419417382415922, 0.4419417382415922, 4.592273826833915e-17, 0.75, 0.4419417382415922, 0.4419417382415922, 3.061515884555943e-17, 0.5 }; @@ -149,8 +149,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0003() void QuadraticPlanarInterpTest::checkNonRegressionOmar0004() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -0.4596194077712559, 0.4596194077712559, -0.5303300858899106, 0.5303300858899107, 0.5303300858899107, 0.5303300858899106, 0.4596194077712559, 0.4596194077712559, -0.4949747468305832, 0.4949747468305833, 4.592273826833915e-17, 0.75, 0.4949747468305833, 0.4949747468305832, 3.979970649922726e-17, 0.65 }; @@ -175,8 +175,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0004() void QuadraticPlanarInterpTest::checkNonRegressionOmar0005() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -0.383022221559489, 0.3213938048432697, -0.6128355544951823, 0.5142300877492316, 0.6128355544951825, 0.5142300877492314, 0.383022221559489, 0.3213938048432696, -0.4979288880273356, 0.4178119462962507, 4.898425415289509e-17, 0.8, 0.4979288880273357, 0.4178119462962505, 3.061515884555943e-17, 0.5 }; @@ -201,8 +201,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0005() void QuadraticPlanarInterpTest::checkNonRegressionOmar0006() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -0.383022221559489, 0.3213938048432697, -0.5362311101832845, 0.4499513267805776, 0.5362311101832846, 0.4499513267805774, 0.383022221559489, 0.3213938048432696, -0.4596266658713867, 0.3856725658119237, 4.28612223837832e-17, 0.7, 0.4596266658713868, 0.3856725658119236, 3.061515884555943e-17, 0.5 }; @@ -227,8 +227,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0006() void QuadraticPlanarInterpTest::checkNonRegressionOmar0007() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -0.383022221559489, 0.3213938048432697, -0.5362311101832845, 0.4499513267805776, 0.5362311101832846, 0.4499513267805774, 0.383022221559489, 0.3213938048432696, -0.4596266658713867, 0.3856725658119237, 4.28612223837832e-17, 0.7, 0.4596266658713868, 0.3856725658119236, 3.061515884555943e-17, 0.5 }; @@ -253,8 +253,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0007() void QuadraticPlanarInterpTest::checkNonRegressionOmar0008() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -0.383022221559489, 0.3213938048432697, -0.5362311101832845, 0.4499513267805776, 0.5362311101832846, 0.4499513267805774, 0.383022221559489, 0.3213938048432696, -0.4596266658713867, 0.3856725658119237, 4.28612223837832e-17, 0.7, 0.4596266658713868, 0.3856725658119236, 3.061515884555943e-17, 0.5 }; @@ -279,8 +279,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0008() void QuadraticPlanarInterpTest::checkNonRegressionOmar0009() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -0.3863703305156274, -0.1035276180410081, -0.4829629131445342, -0.1294095225512602, 0.4829629131445342, -0.1294095225512604, 0.3863703305156274, -0.1035276180410083, -0.4346666218300808, -0.1164685702961342, 1.416374613080751e-16, 0.5, 0.4346666218300808, -0.1164685702961343, 1.133099690464601e-16, 0.4 }; @@ -304,8 +304,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0009() void QuadraticPlanarInterpTest::checkNonRegressionOmar0010() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -0.3863703305156274, -0.1035276180410081, -0.4829629131445342, -0.1294095225512602, 0.4829629131445342, -0.1294095225512604, 0.3863703305156274, -0.1035276180410083, -0.4346666218300808, -0.1164685702961342, 1.416374613080751e-16, 0.5, 0.4346666218300808, -0.1164685702961343, 1.133099690464601e-16, 0.4 }; @@ -329,8 +329,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0010() void QuadraticPlanarInterpTest::checkNonRegressionOmar0011() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -0.3863703305156274, -0.1035276180410081, -0.4829629131445342, -0.1294095225512602, 0.4829629131445342, -0.1294095225512604, 0.3863703305156274, -0.1035276180410083, -0.4346666218300808, -0.1164685702961342, 1.416374613080751e-16, 0.5, 0.4346666218300808, -0.1164685702961343, 1.133099690464601e-16, 0.4 }; @@ -372,8 +372,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0011() void QuadraticPlanarInterpTest::checkNonRegressionOmar2511() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -0.3863703305156274, -0.1035276180410081, -0.4829629131445342, -0.1294095225512602, 0.4829629131445342, -0.1294095225512604, 0.3863703305156274, -0.1035276180410083, -0.4346666218300808, -0.1164685702961342, 1.416374613080751e-16, 0.5, 0.4346666218300808, -0.1164685702961343, 1.133099690464601e-16, 0.4, }; @@ -416,8 +416,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar2511() void QuadraticPlanarInterpTest::checkNonRegressionOmar0012() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -1, 1.224606353822377e-16, -1.6, 1.959370166115804e-16, 9.796850830579018e-17, 1.6, 6.123031769111886e-17, 1, -1.3, 1.591988259969091e-16, -1.131370849898476, 1.131370849898476, 7.959941299845453e-17, 1.3, -0.7071067811865475, 0.7071067811865476 }; @@ -450,8 +450,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0012() void QuadraticPlanarInterpTest::checkNonRegressionOmar0013() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -1, 1.224606353822377e-16, -1.6, 1.959370166115804e-16, 9.796850830579018e-17, 1.6, 6.123031769111886e-17, 1, -1.3, 1.591988259969091e-16, -1.131370849898476, 1.131370849898476, 7.959941299845453e-17, 1.3, -0.7071067811865475, 0.7071067811865476 }; @@ -484,8 +484,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0013() void QuadraticPlanarInterpTest::checkNonRegressionOmar0014() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -1, 1.224606353822377e-16, -1.6, 1.959370166115804e-16, 9.796850830579018e-17, 1.6, 6.123031769111886e-17, 1, -1.3, 1.591988259969091e-16, -1.131370849898476, 1.131370849898476, 7.959941299845453e-17, 1.3, -0.7071067811865475, 0.7071067811865476 }; @@ -528,8 +528,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0014() void QuadraticPlanarInterpTest::checkNonRegressionOmar0015() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -1, 1.224606353822377e-16, -1.6, 1.959370166115804e-16, 9.796850830579018e-17, 1.6, 6.123031769111886e-17, 1, -1.3, 1.591988259969091e-16, -1.131370849898476, 1.131370849898476, 7.959941299845453e-17, 1.3, -0.7071067811865475, 0.7071067811865476 }; @@ -572,8 +572,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0015() void QuadraticPlanarInterpTest::checkNonRegressionOmar0016() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -1, 1.224606353822377e-16, -1.6, 1.959370166115804e-16, 9.796850830579018e-17, 1.6, 6.123031769111886e-17, 1, -1.3, 1.591988259969091e-16, -1.131370849898476, 1.131370849898476, 7.959941299845453e-17, 1.3, -0.7071067811865475, 0.7071067811865476 }; @@ -616,8 +616,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0016() void QuadraticPlanarInterpTest::checkNonRegressionOmar0017() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -1, 1.224606353822377e-16, -1.6, 1.959370166115804e-16, 9.796850830579018e-17, 1.6, 6.123031769111886e-17, 1, -1.3, 1.591988259969091e-16, -1.131370849898476, 1.131370849898476, 7.959941299845453e-17, 1.3, -0.7071067811865475, 0.7071067811865476 }; @@ -661,8 +661,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0017() void QuadraticPlanarInterpTest::checkNonRegressionOmar0018() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -1, 1.224606353822377e-16, -1.6, 1.959370166115804e-16, 9.796850830579018e-17, 1.6, 6.123031769111886e-17, 1, -1.3, 1.591988259969091e-16, -1.131370849898476, 1.131370849898476, 7.959941299845453e-17, 1.3, -0.7071067811865475, 0.7071067811865476 }; @@ -706,8 +706,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0018() void QuadraticPlanarInterpTest::checkNonRegressionOmar0019() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -0.5, 6.123031769111886e-17, -0.8, 9.796850830579018e-17, 0.8, 0, 0.5, 0, -0.65, 7.959941299845453e-17, 4.898425415289509e-17, 0.8, 0.65, 0, 3.061515884555943e-17, 0.5 }; @@ -732,8 +732,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0019() void QuadraticPlanarInterpTest::checkNonRegressionOmar0020() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -0.5, 6.123031769111886e-17, -0.8, 9.796850830579018e-17, 0.8, 0, 0.5, 0, -0.65, 7.959941299845453e-17, 4.898425415289509e-17, 0.8, 0.65, 0, 3.061515884555943e-17, 0.5 }; @@ -777,8 +777,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0020() void QuadraticPlanarInterpTest::checkNonRegressionOmar0021() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -0.5, 6.123031769111886e-17, -0.8, 9.796850830579018e-17, 0.8, 0, 0.5, 0, -0.65, 7.959941299845453e-17, 4.898425415289509e-17, 0.8, 0.65, 0, 3.061515884555943e-17, 0.5 }; @@ -821,8 +821,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0021() } void QuadraticPlanarInterpTest::checkNonRegressionOmar0022() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -0.5, 6.123031769111886e-17, -0.8, 9.796850830579018e-17, 0.8, 0, 0.5, 0, -0.65, 7.959941299845453e-17, 4.898425415289509e-17, 0.8, 0.65, 0, 3.061515884555943e-17, 0.5 }; @@ -847,8 +847,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0022() void QuadraticPlanarInterpTest::checkNonRegressionOmar0023() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -0.5, 6.123031769111886e-17, -0.8, 9.796850830579018e-17, 0.8, 0, 0.5, 0, -0.65, 7.959941299845453e-17, 4.898425415289509e-17, 0.8, 0.65, 0, 3.061515884555943e-17, 0.5, }; @@ -873,8 +873,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0023() void QuadraticPlanarInterpTest::checkNonRegressionOmar0024() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -0.5, 6.123031769111886e-17, -0.8, 9.796850830579018e-17, 0.8, 0, 0.5, 0, -0.65, 7.959941299845453e-17, 4.898425415289509e-17, 0.8, 0.65, 0, 3.061515884555943e-17, 0.5 }; @@ -898,8 +898,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0024() void QuadraticPlanarInterpTest::checkNonRegressionOmar2524() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -0.5, 6.123031769111886e-17, -0.8, 9.796850830579018e-17, 0.8, 0, 0.5, 0, -0.65, 7.959941299845453e-17, 4.898425415289509e-17, 0.8, 0.65, 0, 3.061515884555943e-17, 0.5 }; @@ -923,8 +923,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar2524() void QuadraticPlanarInterpTest::checkNonRegressionOmar0025() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -0.5, 6.123031769111886e-17, -0.8, 9.796850830579018e-17, 0.8, 0, 0.5, 0, -0.65, 7.959941299845453e-17, 4.898425415289509e-17, 0.8, 0.65, 0, 3.061515884555943e-17, 0.5 }; @@ -958,8 +958,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0025() void QuadraticPlanarInterpTest::checkNonRegressionOmar0026() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -0.4, 4.898425415289509e-17, -0.75, 9.184547653667829e-17, 0.75, 0, 0.4, 0, -0.575, 7.041486534478669e-17, 4.592273826833915e-17, 0.75, 0.575, 0, 2.449212707644755e-17, 0.4 }; @@ -993,8 +993,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0026() void QuadraticPlanarInterpTest::checkNonRegressionOmar0027() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -0.4, 4.898425415289509e-17, -0.75, 9.184547653667829e-17, 0.75, 0, 0.4, 0, -0.575, 7.041486534478669e-17, 4.592273826833915e-17, 0.75, 0.575, 0, 2.449212707644755e-17, 0.4 }; @@ -1038,8 +1038,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0027() void QuadraticPlanarInterpTest::checkNonRegressionOmar0028() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -0.4, 4.898425415289509e-17, -0.75, 9.184547653667829e-17, 0.75, 0, 0.4, 0, -0.575, 7.041486534478669e-17, 4.592273826833915e-17, 0.75, 0.575, 0, 2.449212707644755e-17, 0.4 }; @@ -1083,8 +1083,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0028() void QuadraticPlanarInterpTest::checkNonRegressionOmar0029() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -0.4, 4.898425415289509e-17, -0.75, 9.184547653667829e-17, 0.75, 0, 0.4, 0, -0.575, 7.041486534478669e-17, 4.592273826833915e-17, 0.75, 0.575, 0, 2.449212707644755e-17, 0.4 }; @@ -1128,8 +1128,8 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0029() void QuadraticPlanarInterpTest::checkNonRegressionOmar0030() { - INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7); - INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7); double coords[16]={ -0.4, 4.898425415289509e-17, -0.75, 9.184547653667829e-17, 0.75, 0, 0.4, 0, -0.575, 7.041486534478669e-17, 4.592273826833915e-17, 0.75, 0.575, 0, 2.449212707644755e-17, 0.4 }; diff --git a/src/MEDCoupling/MEDCouplingPointSet.cxx b/src/MEDCoupling/MEDCouplingPointSet.cxx index b373b3cfd..c52028de6 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.cxx +++ b/src/MEDCoupling/MEDCouplingPointSet.cxx @@ -1181,6 +1181,9 @@ void MEDCouplingPointSet::project2DCellOnXY(const int *startConn, const int *end */ bool MEDCouplingPointSet::isButterfly2DCell(const std::vector& res, bool isQuad, double eps) { + INTERP_KERNEL::QuadraticPlanarPrecision prec(eps); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision arcPrec(eps); + std::size_t nbOfNodes(res.size()/2); std::vector nodes(nbOfNodes); for(std::size_t i=0;i& res, bool INTERP_KERNEL::Node *tmp=new INTERP_KERNEL::Node(res[2*i],res[2*i+1]); nodes[i]=tmp; } - INTERP_KERNEL::QUADRATIC_PLANAR::_precision=eps; - INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=eps; INTERP_KERNEL::QuadraticPolygon *pol=0; if(isQuad) pol=INTERP_KERNEL::QuadraticPolygon::BuildArcCirclePolygon(nodes); diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 8848ab8c2..c20930714 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -5417,6 +5417,8 @@ DataArrayDouble *MEDCouplingUMesh::getBoundingBoxForBBTreeFast() const DataArrayDouble *MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic(double arcDetEps) const { checkFullyDefined(); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision arcPrec(arcDetEps); + int spaceDim(getSpaceDimension()),mDim(getMeshDimension()),nbOfCells(getNumberOfCells()); if(spaceDim!=2 || mDim!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic : This method should be applied on mesh with mesh dimension equal to 2 and space dimension also equal to 2!"); @@ -5428,7 +5430,6 @@ DataArrayDouble *MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic(double arc { const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[*connI])); int sz(connI[1]-connI[0]-1); - INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=arcDetEps; std::vector nodes(sz); INTERP_KERNEL::QuadraticPolygon *pol(0); for(int j=0;j ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim); double *bbox(ret->getPointer()); const double *coords(_coords->begin()); @@ -5473,7 +5475,6 @@ DataArrayDouble *MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic(double arc { const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[*connI])); int sz(connI[1]-connI[0]-1); - INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=arcDetEps; std::vector nodes(sz); INTERP_KERNEL::Edge *edge(0); for(int j=0;j::min()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::tessellate2DCurveInternal : epsilon is null ! Please specify a higher epsilon. If too tiny it can lead to a huge amount of nodes and memory !"); - INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=1.e-10; + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision arcPrec(1.e-10); // RAII int nbCells=getNumberOfCells(); int nbNodes=getNumberOfNodes(); const int *conn=_nodal_connec->begin(); diff --git a/src/MEDCoupling/MEDCouplingUMesh_internal.hxx b/src/MEDCoupling/MEDCouplingUMesh_internal.hxx index a1be4e636..dfb6b5977 100644 --- a/src/MEDCoupling/MEDCouplingUMesh_internal.hxx +++ b/src/MEDCoupling/MEDCouplingUMesh_internal.hxx @@ -102,6 +102,10 @@ template void MEDCouplingUMesh::getCellsContainingPointsAlg(const double *coords, const double *pos, int nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const { + // Override precision for this method only: + INTERP_KERNEL::QuadraticPlanarPrecision prec(eps); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision arcPrec(eps); + elts=DataArrayInt::New(); eltsIndex=DataArrayInt::New(); eltsIndex->alloc(nbOfPoints+1,1); eltsIndex->setIJ(0,0,0); elts->alloc(0,1); int *eltsIndexPtr(eltsIndex->getPointer()); MCAuto bboxArr(getBoundingBoxForBBTree(eps)); @@ -132,8 +136,6 @@ void MEDCouplingUMesh::getCellsContainingPointsAlg(const double *coords, const d { if(SPACEDIM!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getCellsContainingPointsAlg : not implemented yet for POLYGON and QPOLYGON in spaceDim 3 !"); - INTERP_KERNEL::QUADRATIC_PLANAR::_precision=eps; - INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=eps; std::vector nodes(sz); INTERP_KERNEL::QuadraticPolygon *pol(0); for(int j=0;j >& intersectEdge1, std::vector< std::vector >& colinear2, std::vector< std::vector >& subDiv2, std::vector& addCoo, std::map& mergedNodes) { static const int SPACEDIM=2; - INTERP_KERNEL::QUADRATIC_PLANAR::_precision=eps; - INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=eps; + INTERP_KERNEL::QuadraticPlanarPrecision prec(eps); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision arcPrec(eps); const int *c1(m1Desc->getNodalConnectivity()->begin()),*ci1(m1Desc->getNodalConnectivityIndex()->begin()); // Build BB tree of all edges in the tool mesh (second mesh) MCAuto bbox1Arr(m1Desc->getBoundingBoxForBBTree()),bbox2Arr(m2Desc->getBoundingBoxForBBTree()); @@ -1567,6 +1567,8 @@ MEDCouplingUMesh *MEDCouplingUMesh::Intersect2DMeshes(const MEDCouplingUMesh *m1 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Intersect2DMeshes : input meshes must be not NULL !"); m1->checkFullyDefined(); m2->checkFullyDefined(); + INTERP_KERNEL::QuadraticPlanarPrecision prec(eps); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision arcPrec(eps); if(m1->getMeshDimension()!=2 || m1->getSpaceDimension()!=2 || m2->getMeshDimension()!=2 || m2->getSpaceDimension()!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Intersect2DMeshes works on umeshes m1 AND m2 with meshdim equal to 2 and spaceDim equal to 2 too!"); @@ -1647,8 +1649,8 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, // Step 1: compute all edge intersections (new nodes) std::vector< std::vector > intersectEdge1, colinear2, subDiv2; std::vector addCoo,addCoordsQuadratic; // coordinates of newly created nodes - INTERP_KERNEL::QUADRATIC_PLANAR::_precision=eps; - INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=eps; + INTERP_KERNEL::QuadraticPlanarPrecision prec(eps); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision arcPrec(eps); // // Build desc connectivity DataArrayInt *desc1(DataArrayInt::New()),*descIndx1(DataArrayInt::New()),*revDesc1(DataArrayInt::New()),*revDescIndx1(DataArrayInt::New()); @@ -1842,8 +1844,8 @@ DataArrayInt *MEDCouplingUMesh::conformize2D(double eps) std::vector< std::vector > intersectEdge(nDescCell),overlapEdge(nDescCell); std::vector addCoo; BBTree myTree(bbox,0,0,nDescCell,-eps); - INTERP_KERNEL::QUADRATIC_PLANAR::_precision=eps; - INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=eps; + INTERP_KERNEL::QuadraticPlanarPrecision prec(eps); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision arcPrec(eps); for(int i=0;i candidates; @@ -1970,8 +1972,8 @@ DataArrayInt *MEDCouplingUMesh::colinearize2D(double eps) checkConsistencyLight(); if(getSpaceDimension()!=2 || getMeshDimension()!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::colinearize2D : This method only works for meshes with spaceDim=2 and meshDim=2 !"); - INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=eps; - INTERP_KERNEL::QUADRATIC_PLANAR::_precision=eps; + INTERP_KERNEL::QuadraticPlanarPrecision prec(eps); + INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision arcPrec(eps); int nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes()); const int *cptr(_nodal_connec->begin()),*ciptr(_nodal_connec_index->begin()); MCAuto newc(DataArrayInt::New()),newci(DataArrayInt::New()); newci->alloc(nbOfCells+1,1); newc->alloc(0,1); newci->setIJ(0,0,0); diff --git a/src/MEDCoupling_Swig/MEDCouplingIntersectTest.py b/src/MEDCoupling_Swig/MEDCouplingIntersectTest.py index 786ee271d..f57891881 100644 --- a/src/MEDCoupling_Swig/MEDCouplingIntersectTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingIntersectTest.py @@ -312,6 +312,68 @@ class MEDCouplingIntersectTest(unittest.TestCase): self.assertTrue(f.getArray().isEqual(valuesExpected,1e-12)) pass + def testIntersect2DMeshes7(self): + """ Quadratic precision values were improperly reset before testing colinearities """ + eps = 1.0e-08 + mesh1 = MEDCouplingUMesh('assemblyGrid_Pij', 2) + coo = DataArrayDouble([(10.80630000000000,10.80630000000000),(9.48750000000000,10.80630000000000),(10.75250000000000,10.80630000000000),(9.48750000000000,9.48750000000000),(10.75250000000000,9.48750000000000),(10.80630000000000,9.48750000000000),(9.48750000000000,10.75250000000000),(10.75250000000000,10.75250000000000),(10.80630000000000,10.75250000000000)]) + mesh1.setCoords(coo) + c = DataArrayInt([5, 4, 3, 6, 7, 5, 5, 4, 7, 8, 5, 1, 2, 7, 6, 5, 2, 0, 8, 7]) + cI = DataArrayInt([0, 5, 10, 15, 20]) + mesh1.setConnectivity(c, cI) + mesh1.checkConsistency() + + mesh2 = MEDCouplingUMesh('merge', 2) + coo = DataArrayDouble([(9.48750000000001,9.48750000000001),(10.75249999999975,9.48749999999955),(10.12000000000001,9.48750000000001),(10.80629999999976,9.48749999999955),(8.22250000000029,10.75250000000028),(9.48749999999961,10.75249999999971),(8.85500000000029,10.75250000000028),(9.48750000000001,10.12000000000001),(10.75249999999338,10.75249999999338),(10.41000000000001,10.12000000000001),(10.32506096654411,10.32506096654411),(10.12000000000001,10.41000000000001),(9.91493903345591,10.32506096654411),(9.83000000000001,10.12000000000001),(9.91493903345591,9.91493903345591),(10.12000000000001,9.83000000000001),(10.32506096654411,9.91493903345591),(10.11999999999961,10.75249999999971),(10.75249999999975,10.11999999999958),(10.49000000000001,10.12000000000001),(10.38162950903903,10.38162950903903),(10.12000000000001,10.49000000000001),(9.85837049096099,10.38162950903903),(9.75000000000001,10.12000000000001),(9.85837049096099,9.85837049096099),(10.12000000000001,9.75000000000001),(10.38162950903903,9.85837049096099),(9.88665476220845,10.35334523779157),(9.88665476220845,9.88665476220845),(9.67293524548050,9.67293524548050),(9.67293524548050,10.56706475451952),(10.80629999999339,10.75249999999338),(8.22250000000029,10.80630000000028),(9.48749999999961,10.80629999999971),(10.75249999999338,10.80629999999339),(10.80629999999339,10.80629999999339),(10.77939999999976,9.48749999999955),(10.77939999999339,10.75249999999338),(10.80629999999976,10.11999999999958),(8.22250000000029,10.77940000000028),(8.85500000000029,10.80630000000028),(9.48749999999961,10.77939999999971),(10.11999999999961,10.80629999999971),(10.75249999999338,10.77939999999339),(10.77939999999339,10.80629999999339),(10.80629999999339,10.77939999999339)]) + mesh2.setCoords(coo) + c = DataArrayInt([32, 4, 32, 33, 5, 39, 40, 41, 6, 32, 5, 33, 34, 8, 41, 42, 43, 17, 32, 8, 34, 35, 31, 43, 44, 45, 37, 32, 14, 12, 10, 16, 13, 11, 9, 15, 32, 22, 12, 14, 24, 27, 13, 28, 23, 32, 24, 0, 5, 22, 29, 7, 30, 23, 32, 24, 14, 16, 10, 12, 22, 20, 26, 28, 15, 9, 11, 27, 21, 19, 25, 32, 22, 5, 8, 1, 0, 24, 26, 20, 30, 17, 18, 2, 29, 25, 19, 21, 32, 1, 8, 31, 3, 18, 37, 38, 36]) + cI = DataArrayInt([0, 9, 18, 27, 36, 45, 54, 71, 88, 97]) + mesh2.setConnectivity(c, cI) + mesh2.checkConsistency() + + result, mapResToInit, mapResToRef = MEDCouplingUMesh.Intersect2DMeshes(mesh1, mesh2, eps) + + def testIntersect2DMeshes8(self): + """ Quadratic precision values were improperly reset before testing colinearities """ + eps = 1.0e-08 + mesh1 = MEDCouplingUMesh('assemblyGrid_Pij', 2) + coo = DataArrayDouble([(10.80630000000000,10.80630000000000),(9.48750000000000,10.80630000000000),(10.75250000000000,10.80630000000000),(9.48750000000000,9.48750000000000),(10.75250000000000,9.48750000000000),(10.80630000000000,9.48750000000000),(9.48750000000000,10.75250000000000),(10.75250000000000,10.75250000000000),(10.80630000000000,10.75250000000000),(10.12000000000000,9.48750000000000),(10.77940000000000,9.48750000000000),(9.48750000000000,10.12000000000000),(10.12000000000000,10.75250000000000),(10.75250000000000,10.12000000000000),(10.77940000000000,10.75250000000000),(10.80630000000000,10.12000000000000),(9.48750000000000,10.77940000000000),(10.12000000000000,10.80630000000000),(10.75250000000000,10.77940000000000),(10.77940000000000,10.80630000000000),(10.80630000000000,10.77940000000000)]) + mesh1.setCoords(coo) + c = DataArrayInt([32, 4, 3, 6, 7, 9, 11, 12, 13, 32, 5, 4, 7, 8, 10, 13, 14, 15, 32, 1, 2, 7, 6, 17, 18, 12, 16, 32, 2, 0, 8, 7, 19, 20, 14, 18]) + cI = DataArrayInt([0, 9, 18, 27, 36]) + mesh1.setConnectivity(c, cI) + mesh1.checkConsistency() + + mesh2 = MEDCouplingUMesh('merge', 2) + coo = DataArrayDouble([(9.48750000000001,9.48750000000001),(10.75249999999975,9.48749999999955),(10.12000000000001,9.48750000000001),(10.80629999999976,9.48749999999955),(8.22250000000029,10.75250000000028),(9.48749999999961,10.75249999999971),(8.85500000000029,10.75250000000028),(9.48750000000001,10.12000000000001),(10.75249999999338,10.75249999999338),(10.41000000000001,10.12000000000001),(10.32506096654411,10.32506096654411),(10.12000000000001,10.41000000000001),(9.91493903345591,10.32506096654411),(9.83000000000001,10.12000000000001),(9.91493903345591,9.91493903345591),(10.12000000000001,9.83000000000001),(10.32506096654411,9.91493903345591),(10.11999999999961,10.75249999999971),(10.75249999999975,10.11999999999958),(10.49000000000001,10.12000000000001),(10.38162950903903,10.38162950903903),(10.12000000000001,10.49000000000001),(9.85837049096099,10.38162950903903),(9.75000000000001,10.12000000000001),(9.85837049096099,9.85837049096099),(10.12000000000001,9.75000000000001),(10.38162950903903,9.85837049096099),(9.88665476220845,10.35334523779157),(9.88665476220845,9.88665476220845),(9.67293524548050,9.67293524548050),(9.67293524548050,10.56706475451952),(10.80629999999339,10.75249999999338),(8.22250000000029,10.80630000000028),(9.48749999999961,10.80629999999971),(10.75249999999338,10.80629999999339),(10.80629999999339,10.80629999999339),(10.77939999999976,9.48749999999955),(10.77939999999339,10.75249999999338),(10.80629999999976,10.11999999999958),(8.22250000000029,10.77940000000028),(8.85500000000029,10.80630000000028),(9.48749999999961,10.77939999999971),(10.11999999999961,10.80629999999971),(10.75249999999338,10.77939999999339),(10.77939999999339,10.80629999999339),(10.80629999999339,10.77939999999339)]) + mesh2.setCoords(coo) + c = DataArrayInt([32, 4, 32, 33, 5, 39, 40, 41, 6, 32, 5, 33, 34, 8, 41, 42, 43, 17, 32, 8, 34, 35, 31, 43, 44, 45, 37, 32, 14, 12, 10, 16, 13, 11, 9, 15, 32, 22, 12, 14, 24, 27, 13, 28, 23, 32, 24, 0, 5, 22, 29, 7, 30, 23, 32, 24, 14, 16, 10, 12, 22, 20, 26, 28, 15, 9, 11, 27, 21, 19, 25, 32, 22, 5, 8, 1, 0, 24, 26, 20, 30, 17, 18, 2, 29, 25, 19, 21, 32, 1, 8, 31, 3, 18, 37, 38, 36]) + cI = DataArrayInt([0, 9, 18, 27, 36, 45, 54, 71, 88, 97]) + mesh2.setConnectivity(c, cI) + mesh2.checkConsistency() + + result, mapResToInit, mapResToRef = MEDCouplingUMesh.Intersect2DMeshes(mesh1, mesh2, eps) + + def testIntersect2DMeshes9(self): + """ Quadratic precision values were improperly reset before testing colinearities """ + eps = 1.0e-08 + mesh1 = MEDCouplingUMesh('merge', 2) + coo = DataArrayDouble([(10.80629999999339,10.80629999999339),(9.48749999999961,10.80629999999971),(10.75249999999338,10.80629999999339),(9.48750000000001,9.48750000000001),(10.75249999999975,9.48749999999955),(10.80629999999976,9.48749999999955),(9.48749999999961,10.75249999999971),(10.75249999999338,10.75249999999338),(10.80629999999339,10.75249999999338)]) + mesh1.setCoords(coo) + c = DataArrayInt([5, 4, 3, 6, 7, 5, 5, 4, 7, 8, 5, 1, 2, 7, 6, 5, 2, 0, 8, 7]) + cI = DataArrayInt([0, 5, 10, 15, 20]) + mesh1.setConnectivity(c, cI) + mesh1.checkConsistency() + + mesh2 = MEDCouplingUMesh('merge', 2) + coo = DataArrayDouble([(9.48749999999998,8.22249999999998),(10.75250000000034,8.22250000000030),(10.80630000000034,8.22250000000030),(9.48750000000001,9.48750000000001),(10.75249999999975,9.48749999999955),(10.80629999999976,9.48749999999955),(9.48749999999961,10.75249999999971),(10.75249999999338,10.75249999999338),(10.80629999999339,10.75249999999338),(10.11999999999999,8.22249999999998),(9.48749999999998,8.85499999999998),(10.40999999999999,8.85499999999998),(10.32506096654408,9.06006096654408),(10.11999999999999,9.14499999999998),(9.91493903345589,9.06006096654408),(9.82999999999998,8.85499999999998),(9.91493903345589,8.64993903345588),(10.11999999999999,8.56499999999998),(10.32506096654408,8.64993903345588),(10.12000000000001,9.48750000000001),(10.75250000000034,8.85500000000035),(10.48999999999999,8.85499999999998),(10.38162950903901,9.11662950903900),(10.11999999999999,9.22499999999998),(9.85837049096096,9.11662950903900),(9.74999999999998,8.85499999999998),(9.85837049096096,8.59337049096096),(10.11999999999999,8.48499999999998),(10.38162950903901,8.59337049096096),(9.88665476220842,9.08834523779154),(9.88665476220842,8.62165476220842),(9.67293524548047,8.40793524548047),(9.67293524548047,9.30206475451949),(9.48750000000001,10.12000000000001),(10.41000000000001,10.12000000000001),(10.32506096654411,10.32506096654411),(10.12000000000001,10.41000000000001),(9.91493903345591,10.32506096654411),(9.83000000000001,10.12000000000001),(9.91493903345591,9.91493903345591),(10.12000000000001,9.83000000000001),(10.32506096654411,9.91493903345591),(10.11999999999961,10.75249999999971),(10.75249999999975,10.11999999999958),(10.49000000000001,10.12000000000001),(10.38162950903903,10.38162950903903),(10.12000000000001,10.49000000000001),(9.85837049096099,10.38162950903903),(9.75000000000001,10.12000000000001),(9.85837049096099,9.85837049096099),(10.12000000000001,9.75000000000001),(10.38162950903903,9.85837049096099),(9.88665476220845,10.35334523779157),(9.88665476220845,9.88665476220845),(9.67293524548050,9.67293524548050),(9.67293524548050,10.56706475451952),(10.77940000000034,8.22250000000030),(10.77939999999976,9.48749999999955),(10.80630000000034,8.85500000000035),(10.77939999999339,10.75249999999338),(10.80629999999976,10.11999999999958)]) + mesh2.setCoords(coo) + c = DataArrayInt([32, 16, 14, 12, 18, 15, 13, 11, 17, 32, 24, 14, 16, 26, 29, 15, 30, 25, 32, 26, 0, 3, 24, 31, 10, 32, 25, 32, 26, 16, 18, 12, 14, 24, 22, 28, 30, 17, 11, 13, 29, 23, 21, 27, 32, 24, 3, 4, 1, 0, 26, 28, 22, 32, 19, 20, 9, 31, 27, 21, 23, 32, 1, 4, 5, 2, 20, 57, 58, 56, 32, 39, 37, 35, 41, 38, 36, 34, 40, 32, 47, 37, 39, 49, 52, 38, 53, 48, 32, 49, 3, 6, 47, 54, 33, 55, 48, 32, 49, 39, 41, 35, 37, 47, 45, 51, 53, 40, 34, 36, 52, 46, 44, 50, 32, 47, 6, 7, 4, 3, 49, 51, 45, 55, 42, 43, 19, 54, 50, 44, 46, 32, 4, 7, 8, 5, 43, 59, 60, 57]) + cI = DataArrayInt([0, 9, 18, 27, 44, 61, 70, 79, 88, 97, 114, 131, 140]) + mesh2.setConnectivity(c, cI) + mesh2.checkConsistency() + + result, mapResToInit, mapResToRef = MEDCouplingUMesh.Intersect2DMeshes(mesh1, mesh2, eps) def testSwig2Intersect2DMeshesQuadra1(self): import cmath -- 2.39.2