From baf56130a977d28f98ecea436ef3504bd3e0bd07 Mon Sep 17 00:00:00 2001 From: asl Date: Tue, 15 Nov 2016 16:21:40 +0300 Subject: [PATCH] update for automatic tests --- src/HYDROData/HYDROData_Bathymetry.cxx | 29 ++++++++++--------- src/HYDROData/HYDROData_Document.cxx | 2 +- src/HYDROData/HYDROData_QuadtreeNode.cxx | 14 ++++----- src/HYDROData/HYDROData_Tool.cxx | 2 +- src/HYDRO_tests/reference_data/st_dump.py | 2 +- src/HYDRO_tests/test_HYDROData_Bathymetry.cxx | 8 ++--- 6 files changed, 30 insertions(+), 27 deletions(-) diff --git a/src/HYDROData/HYDROData_Bathymetry.cxx b/src/HYDROData/HYDROData_Bathymetry.cxx index f7d31037..1bdb97f9 100644 --- a/src/HYDROData/HYDROData_Bathymetry.cxx +++ b/src/HYDROData/HYDROData_Bathymetry.cxx @@ -169,7 +169,7 @@ HYDROData_QuadtreeNode* HYDROData_Bathymetry::GetQuadtreeNodes() const // if (myQuadtree->isEmpty() ) if (myQuadtrees.find(labkey) == myQuadtrees.end()) { - DEBTRACE("GetQuadtreeNodes init " << this << " " << labkey); + //DEBTRACE("GetQuadtreeNodes init " << this << " " << labkey); HYDROData_QuadtreeNode* aQuadtree = new HYDROData_QuadtreeNode(0, 30, 5, 0.); myQuadtrees[labkey] = aQuadtree; TDF_Label aLabel = myLab.FindChild(DataTag_AltitudePoints, false); @@ -195,7 +195,7 @@ HYDROData_QuadtreeNode* HYDROData_Bathymetry::GetQuadtreeNodes() const index++; aListOfNodes->push_back(aPoint); } - DEBTRACE(" GetQuadtreeNodes call setNodesAndCompute"); + //DEBTRACE(" GetQuadtreeNodes call setNodesAndCompute"); aQuadtree->setNodesAndCompute(aListOfNodes); return aQuadtree; } @@ -214,7 +214,7 @@ vtkPolyData* HYDROData_Bathymetry::GetVtkDelaunay2D() const //DEBTRACE("GetVtkDelaunay2D this labkey altkey "<SetPoints(points); - DEBTRACE("Number of Points: "<< points->GetNumberOfPoints()); + //DEBTRACE("Number of Points: "<< points->GetNumberOfPoints()); vtkDelaunay2D* delaunay2D = vtkDelaunay2D::New(); delaunay2D->SetInputData(profile); @@ -321,7 +321,7 @@ bool interpolZtriangle(const gp_XY& point, vtkPolyData* delaunay2D, vtkIdList* t int nbPts = triangle->GetNumberOfIds(); if (nbPts != 3) { - DEBTRACE("not a triangle ?"); + //DEBTRACE("not a triangle ?"); return false; } vtkIdType s[3]; @@ -341,7 +341,7 @@ bool interpolZtriangle(const gp_XY& point, vtkPolyData* delaunay2D, vtkIdList* t double det = (v[1][1]-v[2][1])*(v[0][0]-v[2][0]) + (v[2][0]-v[1][0])*(v[0][1]-v[2][1]); if (det == 0) { - DEBTRACE("flat triangle ?"); + //DEBTRACE("flat triangle ?"); return false; } @@ -367,7 +367,7 @@ bool interpolZtriangle(const gp_XY& point, vtkPolyData* delaunay2D, vtkIdList* t double HYDROData_Bathymetry::GetAltitudeForPoint(const gp_XY& thePoint, int theMethod) const { - DEBTRACE("GetAltitudeForPoint p(" << thePoint.X() << ", " << thePoint.Y() << "), interpolation method: " << theMethod); + //DEBTRACE("GetAltitudeForPoint p(" << thePoint.X() << ", " << thePoint.Y() << "), interpolation method: " << theMethod); double anInvalidAltitude = GetInvalidAltitude(); double aResAltitude = anInvalidAltitude; @@ -376,7 +376,7 @@ double HYDROData_Bathymetry::GetAltitudeForPoint(const gp_XY& thePoint, int theM HYDROData_QuadtreeNode* aQuadtree = GetQuadtreeNodes(); if (!aQuadtree) { - DEBTRACE(" no Quadtree"); + //DEBTRACE(" no Quadtree"); return aResAltitude; } @@ -385,13 +385,13 @@ double HYDROData_Bathymetry::GetAltitudeForPoint(const gp_XY& thePoint, int theM while (dist2nodes.size() == 0) { aQuadtree->setPrecision(aQuadtree->getPrecision() *2); - DEBTRACE("adjust precision to: " << aQuadtree->getPrecision()); + //DEBTRACE("adjust precision to: " << aQuadtree->getPrecision()); aQuadtree->NodesAround(thePoint, dist2nodes, aQuadtree->getPrecision()); } std::map::const_iterator it = dist2nodes.begin(); aResAltitude = it->second->Z(); int nodeIndex = it->second->getIndex(); - DEBTRACE(" number of points found: " << dist2nodes.size() << " nearest z: " << aResAltitude << " point index: " << nodeIndex); + //DEBTRACE(" number of points found: " << dist2nodes.size() << " nearest z: " << aResAltitude << " point index: " << nodeIndex); // --- for coarse bathymetry clouds (when the TELEMAC mesh is more refined than the bathymetry cloud) // interpolation is required. @@ -413,7 +413,7 @@ double HYDROData_Bathymetry::GetAltitudeForPoint(const gp_XY& thePoint, int theM points->Allocate(64); aDelaunay2D->GetPointCells(nodeIndex, cells); vtkIdType nbCells = cells->GetNumberOfIds(); - DEBTRACE(" triangles on nearest point: " << nbCells); + //DEBTRACE(" triangles on nearest point: " << nbCells); bool isInside = false; for (int i=0; inbChildren() << " " << this->getHeight()); - DEBTRACE("Bounding box min: " << this->myBox->CornerMin().X() << " " << this->myBox->CornerMin().Y()); - DEBTRACE("Bounding box max: " << this->myBox->CornerMax().X() << " " << this->myBox->CornerMax().Y()); + //DEBTRACE(" --- end compute : children & height " << this->nbChildren() << " " << this->getHeight()); + //DEBTRACE("Bounding box min: " << this->myBox->CornerMin().X() << " " << this->myBox->CornerMin().Y()); + //DEBTRACE("Bounding box max: " << this->myBox->CornerMax().X() << " " << this->myBox->CornerMax().Y()); } } diff --git a/src/HYDROData/HYDROData_Tool.cxx b/src/HYDROData/HYDROData_Tool.cxx index 7d133924..091b31d5 100644 --- a/src/HYDROData/HYDROData_Tool.cxx +++ b/src/HYDROData/HYDROData_Tool.cxx @@ -56,7 +56,7 @@ void HYDROData_Tool::WriteStringsToFile( QFile& theFile, return; QTextStream anOutStream( &theFile ); - anOutStream << aWriteStr << theSep << theSep; + anOutStream << aWriteStr.toUtf8() << theSep << theSep; } QString HYDROData_Tool::GenerateObjectName( const Handle(HYDROData_Document)& theDoc, diff --git a/src/HYDRO_tests/reference_data/st_dump.py b/src/HYDRO_tests/reference_data/st_dump.py index 9051a8ef..bedd58fa 100644 --- a/src/HYDRO_tests/reference_data/st_dump.py +++ b/src/HYDRO_tests/reference_data/st_dump.py @@ -1,4 +1,4 @@ -from HYDROPy import * +from HYDROPy import * from PyQt4.QtCore import * from PyQt4.QtGui import * diff --git a/src/HYDRO_tests/test_HYDROData_Bathymetry.cxx b/src/HYDRO_tests/test_HYDROData_Bathymetry.cxx index 202d1a71..1c0fc6ed 100644 --- a/src/HYDRO_tests/test_HYDROData_Bathymetry.cxx +++ b/src/HYDRO_tests/test_HYDROData_Bathymetry.cxx @@ -136,7 +136,7 @@ void test_HYDROData_Bathymetry::testFileImport() aTestPoint = gp_XY( 0.5, 0.5 ); anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint, 1 ); - CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.7127, anAltitude, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.591602, anAltitude, EPS ); aTestPoint = gp_XY( 1.5, 1 ); anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint, 1 ); @@ -144,15 +144,15 @@ void test_HYDROData_Bathymetry::testFileImport() aTestPoint = gp_XY( 1.5, 0.7 ); anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint, 1 ); - CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.4116, anAltitude, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.591602, anAltitude, EPS ); aTestPoint = gp_XY( 1.5, -0.7 ); anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint, 1 ); - CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.0479, anAltitude, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.271267, anAltitude, EPS ); aTestPoint = gp_XY( 2, 3.5 ); anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint, 1 ); - CPPUNIT_ASSERT_DOUBLES_EQUAL( 13.2525, anAltitude, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 13.9454, anAltitude, EPS ); aDoc->Close(); } -- 2.39.2