X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FINTERP_KERNELTest%2FQuadraticPlanarInterpTest2.cxx;h=320130acb7c142b40a70620ae219207a6b7ce4e6;hb=2a3bcb5df3bea7510a76f2819dc261f65e4ef650;hp=026ce84ea4cc97ce5971f073da7d007b1f337a26;hpb=48782c06022ca2caa36f849cb5a29ea4fe2aaa83;p=tools%2Fmedcoupling.git diff --git a/src/INTERP_KERNELTest/QuadraticPlanarInterpTest2.cxx b/src/INTERP_KERNELTest/QuadraticPlanarInterpTest2.cxx index 026ce84ea..320130acb 100644 --- a/src/INTERP_KERNELTest/QuadraticPlanarInterpTest2.cxx +++ b/src/INTERP_KERNELTest/QuadraticPlanarInterpTest2.cxx @@ -1,33 +1,37 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// Author : Anthony Geay (CEA/DEN) + #include "QuadraticPlanarInterpTest.hxx" -#include "QuadraticPolygon.hxx" -#include "EdgeArcCircle.hxx" -#include "EdgeLin.hxx" +#include "InterpKernelGeo2DQuadraticPolygon.hxx" +#include "InterpKernelGeo2DEdgeArcCircle.hxx" +#include "InterpKernelGeo2DEdgeLin.hxx" #include #include #include -using namespace std; using namespace INTERP_KERNEL; +namespace INTERP_TEST +{ + static const double ADMISSIBLE_ERROR = 1.e-14; void QuadraticPlanarInterpTest::IntersectArcCircleBase() @@ -100,7 +104,7 @@ void QuadraticPlanarInterpTest::IntersectArcCircleBase() // ArcCArcCIntersector // TypeOfLocInEdge where1,where2; - vector v4; + std::vector v4; MergePoints v3; EdgeArcCircle *e2; ArcCArcCIntersector *intersector=0; @@ -164,7 +168,7 @@ void QuadraticPlanarInterpTest::IntersectArcCircleBase() CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1])); CPPUNIT_ASSERT_DOUBLES_EQUAL(btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),0.35587863972199624,1e-10); - for(vector::iterator iter=v4.begin();iter!=v4.end();iter++) + for(std::vector::iterator iter=v4.begin();iter!=v4.end();iter++) (*iter)->decrRef(); v4.clear(); v3.clear(); delete intersector; e2->decrRef(); e1->decrRef(); @@ -189,7 +193,7 @@ void QuadraticPlanarInterpTest::IntersectArcCircleBase() CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1])); CPPUNIT_ASSERT_DOUBLES_EQUAL(btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),0.35587863972199624,1e-10); - for(vector::iterator iter=v4.begin();iter!=v4.end();iter++) + for(std::vector::iterator iter=v4.begin();iter!=v4.end();iter++) (*iter)->decrRef(); v4.clear(); v3.clear(); delete intersector; e2->decrRef(); e1->decrRef(); @@ -214,7 +218,7 @@ void QuadraticPlanarInterpTest::IntersectArcCircleBase() CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1])); CPPUNIT_ASSERT_DOUBLES_EQUAL(btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),0.6793851523346941,1e-10); - for(vector::iterator iter=v4.begin();iter!=v4.end();iter++) + for(std::vector::iterator iter=v4.begin();iter!=v4.end();iter++) (*iter)->decrRef(); v4.clear(); v3.clear(); delete intersector; e2->decrRef(); e1->decrRef(); @@ -239,7 +243,7 @@ void QuadraticPlanarInterpTest::IntersectArcCircleBase() CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1])); CPPUNIT_ASSERT_DOUBLES_EQUAL(btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),0.6793851523346941,1e-10); - for(vector::iterator iter=v4.begin();iter!=v4.end();iter++) + for(std::vector::iterator iter=v4.begin();iter!=v4.end();iter++) (*iter)->decrRef(); v4.clear(); v3.clear(); delete intersector; e2->decrRef(); e1->decrRef(); @@ -264,7 +268,7 @@ void QuadraticPlanarInterpTest::IntersectArcCircleBase() CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1])); CPPUNIT_ASSERT_DOUBLES_EQUAL(1.1195732971845034,btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),1e-10); - for(vector::iterator iter=v4.begin();iter!=v4.end();iter++) + for(std::vector::iterator iter=v4.begin();iter!=v4.end();iter++) (*iter)->decrRef(); v4.clear(); v3.clear(); delete intersector; e2->decrRef(); e1->decrRef(); @@ -289,7 +293,7 @@ void QuadraticPlanarInterpTest::IntersectArcCircleBase() CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1])); CPPUNIT_ASSERT_DOUBLES_EQUAL(-1.1195732971845034,btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),1e-10); - for(vector::iterator iter=v4.begin();iter!=v4.end();iter++) + for(std::vector::iterator iter=v4.begin();iter!=v4.end();iter++) (*iter)->decrRef(); v4.clear(); v3.clear(); delete intersector; e2->decrRef(); e1->decrRef(); @@ -314,7 +318,7 @@ void QuadraticPlanarInterpTest::IntersectArcCircleBase() CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1])); CPPUNIT_ASSERT_DOUBLES_EQUAL(-3.0844420190512074,btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),1e-10); - for(vector::iterator iter=v4.begin();iter!=v4.end();iter++) + for(std::vector::iterator iter=v4.begin();iter!=v4.end();iter++) (*iter)->decrRef(); v4.clear(); v3.clear(); delete intersector; e2->decrRef(); e1->decrRef(); @@ -339,13 +343,13 @@ void QuadraticPlanarInterpTest::IntersectArcCircleBase() CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR); CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1])); CPPUNIT_ASSERT_DOUBLES_EQUAL(-3.0844420190512074,btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),1e-10); - for(vector::iterator iter=v4.begin();iter!=v4.end();iter++) + for(std::vector::iterator iter=v4.begin();iter!=v4.end();iter++) (*iter)->decrRef(); v4.clear(); v3.clear(); 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.; @@ -357,16 +361,16 @@ void QuadraticPlanarInterpTest::IntersectArcCircleBase() bool obvious,areOverlapped; intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped); CPPUNIT_ASSERT(!obvious && !areOverlapped); - CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(order); // order has no sence here because v4.size() expected to 1 but for valgrind serenity test. + CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(order); // order has no sense here because v4.size() expected to 1 but for valgrind serenity test. CPPUNIT_ASSERT_EQUAL(1,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR); CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR); - for(vector::iterator iter=v4.begin();iter!=v4.end();iter++) + for(std::vector::iterator iter=v4.begin();iter!=v4.end();iter++) (*iter)->decrRef(); 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++) { @@ -607,7 +611,7 @@ void QuadraticPlanarInterpTest::IntersectArcCircleSegumentBase() bool obvious,areOverlapped; intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped); CPPUNIT_ASSERT(!obvious && !areOverlapped); - vector v4; + std::vector v4; MergePoints v3; CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(!order); CPPUNIT_ASSERT_EQUAL(2,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations()); CPPUNIT_ASSERT_DOUBLES_EQUAL(2.,(*v4[0])[0],1e-10); CPPUNIT_ASSERT_DOUBLES_EQUAL(4.3,(*v4[0])[1],1e-10); @@ -639,10 +643,10 @@ void QuadraticPlanarInterpTest::IntersectArcCircleSegumentBase() QuadraticPolygon *QuadraticPlanarInterpTest::buildQuadraticPolygonCoarseInfo(const double *coords, const int *conn, int lgth) { - vector nodes; + std::vector nodes; for(int i=0;i