]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
Separating unit test for imported geometries and canonical shapes. Small modif on...
authorcconopoima <cesar.conopoima@gmail.com>
Fri, 12 Jul 2024 12:29:04 +0000 (13:29 +0100)
committercconopoima <cesar.conopoima@gmail.com>
Fri, 12 Jul 2024 12:29:04 +0000 (13:29 +0100)
.vscode/settings.json [deleted file]
src/StdMeshers.test/CMakeLists.txt
src/StdMeshers.test/HexahedronCanonicalShapesTest.cxx [new file with mode: 0644]
src/StdMeshers.test/HexahedronTest.cxx
src/StdMeshers.test/tests.set
test/data/HexahedronTest/NRTMJ4.brep [new file with mode: 0644]
test/data/HexahedronTest/Sphere.brep [deleted file]
test/tests.set

diff --git a/.vscode/settings.json b/.vscode/settings.json
deleted file mode 100644 (file)
index d373bc1..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-{
-    "C_Cpp.dimInactiveRegions": false,
-    "files.associations": {
-        "cctype": "cpp",
-        "clocale": "cpp",
-        "cmath": "cpp",
-        "csignal": "cpp",
-        "cstdarg": "cpp",
-        "cstddef": "cpp",
-        "cstdio": "cpp",
-        "cstdlib": "cpp",
-        "cstring": "cpp",
-        "ctime": "cpp",
-        "cwchar": "cpp",
-        "cwctype": "cpp",
-        "array": "cpp",
-        "atomic": "cpp",
-        "strstream": "cpp",
-        "bit": "cpp",
-        "*.tcc": "cpp",
-        "bitset": "cpp",
-        "chrono": "cpp",
-        "codecvt": "cpp",
-        "complex": "cpp",
-        "condition_variable": "cpp",
-        "cstdint": "cpp",
-        "deque": "cpp",
-        "list": "cpp",
-        "map": "cpp",
-        "set": "cpp",
-        "unordered_map": "cpp",
-        "vector": "cpp",
-        "exception": "cpp",
-        "algorithm": "cpp",
-        "functional": "cpp",
-        "iterator": "cpp",
-        "memory": "cpp",
-        "memory_resource": "cpp",
-        "numeric": "cpp",
-        "optional": "cpp",
-        "random": "cpp",
-        "ratio": "cpp",
-        "string": "cpp",
-        "string_view": "cpp",
-        "system_error": "cpp",
-        "tuple": "cpp",
-        "type_traits": "cpp",
-        "utility": "cpp",
-        "fstream": "cpp",
-        "future": "cpp",
-        "initializer_list": "cpp",
-        "iomanip": "cpp",
-        "iosfwd": "cpp",
-        "iostream": "cpp",
-        "istream": "cpp",
-        "limits": "cpp",
-        "mutex": "cpp",
-        "new": "cpp",
-        "ostream": "cpp",
-        "shared_mutex": "cpp",
-        "sstream": "cpp",
-        "stdexcept": "cpp",
-        "streambuf": "cpp",
-        "thread": "cpp",
-        "cfenv": "cpp",
-        "cinttypes": "cpp",
-        "typeindex": "cpp",
-        "typeinfo": "cpp",
-        "valarray": "cpp",
-        "variant": "cpp",
-        "*.ipp": "cpp"
-    }
-}
\ No newline at end of file
index ee9e01335f930ba8276bf698bed2d2d9f9f1c09e..bda437fc79a3467c8c12562b82150dedacc87e2a 100644 (file)
@@ -58,16 +58,13 @@ FOREACH(_test ${UNIT_TESTS})
   SET_TESTS_PROPERTIES(${testname} PROPERTIES ENVIRONMENT "${tests_env}" LABELS "tests")
 ENDFOREACH()
 
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${UNIT_TESTS} PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ DESTINATION ${TEST_INSTALL_DIRECTORY})
-
-# IF(WIN32)
-#   FOREACH(_test ${UNIT_TESTS})
-#     INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${_test}${CMAKE_EXECUTABLE_SUFFIX} PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ DESTINATION ${TEST_INSTALL_DIRECTORY})
-#   ENDFOREACH()
-# ELSE()
-#   FOREACH(_test ${CPP_TESTS})
-#     INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_test} PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ DESTINATION ${TEST_INSTALL_DIRECTORY})
-#   ENDFOREACH()
-# ENDIF(WIN32)
-
+IF(WIN32)
+  FOREACH(_test ${UNIT_TESTS})
+    INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${_test}${CMAKE_EXECUTABLE_SUFFIX} PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ DESTINATION ${TEST_INSTALL_DIRECTORY})
+  ENDFOREACH()
+ELSE()
+  FOREACH(_test ${UNIT_TESTS})
+    INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_test} PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ DESTINATION ${TEST_INSTALL_DIRECTORY})
+  ENDFOREACH()
+ENDIF(WIN32)
 
diff --git a/src/StdMeshers.test/HexahedronCanonicalShapesTest.cxx b/src/StdMeshers.test/HexahedronCanonicalShapesTest.cxx
new file mode 100644 (file)
index 0000000..fe3ab4c
--- /dev/null
@@ -0,0 +1,276 @@
+// Copyright (C) 2016-2024  CEA, EDF
+//
+// 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.
+//
+// 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
+//
+//  File   : HexahedronCanonicalShapesTest.cxx
+//  Module : SMESH
+//  Purpose: Implement unit tests for StdMeshers_Cartesian_3D_Hexahedron class to reproduce bugs that manifest in integration tests.
+//            The main difference between this unit test and integration tests is the fine grained control we have over the class methods and the hability to diagnose/solve bugs before the code goes into production enviroment. 
+//            This test class can be used as reference for the development of future tests in other stdMesh algorithms
+
+#include "StdMeshers_Cartesian_3D_Hexahedron.hxx"
+#include "StdMeshers_CartesianParameters3D.hxx"
+
+// CPP TEST
+#include <cppunit/TestAssert.h>
+
+// OCC 
+#include <BRep_Builder.hxx>
+#include <BRepTools.hxx>
+#include <BRepPrimAPI_MakeBox.hxx>
+#include <BRepPrimAPI_MakeCylinder.hxx>
+#include <BRepPrimAPI_MakeSphere.hxx>
+#include <BRepPrimAPI_MakeCone.hxx>
+
+#include <iostream>
+#include <memory>
+
+// Helper functions!
+// Build Grid
+//      Require building mesh
+//      Require building shape. For test load shapes from memory in .brep files seems the simplest
+//      
+
+/*!
+  * \brief Mock mesh
+  */
+struct SMESH_Mesh_Test: public SMESH_Mesh
+{
+  SMESH_Mesh_Test() {
+    _isShapeToMesh = (_id = 0);
+    _meshDS  = new SMESHDS_Mesh( _id, true );
+  }
+};
+
+/*!
+  * \brief Mock Hypothesis
+  */
+struct CartesianHypo: public StdMeshers_CartesianParameters3D
+{
+  CartesianHypo() : StdMeshers_CartesianParameters3D(0/*zero hypoId*/, nullptr/*NULL generator*/) 
+  {
+  }
+}; 
+
+/*!
+  * \brief Initialize the grid and intesersectors of grid with the geometry
+  */
+void GridInitAndIntersectWithShape( Grid& grid,
+                                    double gridSpacing,
+                                    double theSizeThreshold,
+                                    const TopoDS_Shape theShape, 
+                                    std::map< TGeomID, vector< TGeomID > >& edge2faceIDsMap,
+                                    const int /*numOfThreads*/ )
+{
+  std::vector< TopoDS_Shape > faceVec;
+  TopTools_MapOfShape faceMap;
+  TopExp_Explorer fExp;
+  for ( fExp.Init( theShape, TopAbs_FACE ); fExp.More(); fExp.Next() )
+  {
+    bool isNewFace = faceMap.Add( fExp.Current() );
+    if ( !grid._toConsiderInternalFaces )
+      if ( !isNewFace || fExp.Current().Orientation() == TopAbs_INTERNAL )
+        // remove an internal face
+        faceMap.Remove( fExp.Current() );
+  }
+  faceVec.reserve( faceMap.Extent() );
+  faceVec.assign( faceMap.cbegin(), faceMap.cend() );
+  
+  vector<FaceGridIntersector> facesItersectors( faceVec.size() );
+
+  Bnd_Box shapeBox;
+  for ( size_t i = 0; i < faceVec.size(); ++i )
+  {
+    facesItersectors[i]._face   = TopoDS::Face( faceVec[i] );
+    facesItersectors[i]._faceID = grid.ShapeID( faceVec[i] );
+    facesItersectors[i]._grid   = &grid;
+    shapeBox.Add( facesItersectors[i].GetFaceBndBox() );
+  }
+  // Canonical axes(i,j,k)
+  double axisDirs[9] = {1.,0.,0.,0.,1.,0.,0.,0.,1.};
+
+  Tools::GetExactBndBox( faceVec, axisDirs, shapeBox );
+  vector<double> xCoords, yCoords, zCoords;  
+  std::unique_ptr<CartesianHypo> myHypo( new CartesianHypo() );  
+  std::vector<std::string> grdSpace = { std::to_string(gridSpacing) };
+  std::vector<double> intPnts;
+  myHypo->SetGridSpacing(grdSpace, intPnts, 0 ); // Spacing in dir 0
+  myHypo->SetGridSpacing(grdSpace, intPnts, 1 ); // Spacing in dir 1
+  myHypo->SetGridSpacing(grdSpace, intPnts, 2 ); // Spacing in dir 2
+  myHypo->SetSizeThreshold(theSizeThreshold);    // set threshold
+  myHypo->GetCoordinates(xCoords, yCoords, zCoords, shapeBox);
+  grid.SetCoordinates( xCoords, yCoords, zCoords, axisDirs, shapeBox );
+
+  for ( size_t i = 0; i < facesItersectors.size(); ++i )
+    facesItersectors[i].Intersect();
+  
+  for ( size_t i = 0; i < facesItersectors.size(); ++i )
+    facesItersectors[i].StoreIntersections();
+
+  grid.ComputeNodes( *grid._helper );
+  grid.GetEdgesToImplement( edge2faceIDsMap, theShape, faceVec );
+}
+
+
+/*!
+  * \brief Test runner
+  */
+bool testShape (const TopoDS_Shape theShape,
+                const bool toAddEdges,
+                const bool toCreateFaces,
+                const double theGridSpacing,
+                const double theSizeThreshold,
+                const int theNbCreatedExpected)
+{
+  std::unique_ptr<SMESH_Mesh> aMesh( new SMESH_Mesh_Test() );
+  aMesh->ShapeToMesh( theShape );
+  SMESH_MesherHelper helper( *aMesh );
+  Grid grid;
+  grid._helper = &helper;
+  grid._toAddEdges = toAddEdges;
+  grid._toCreateFaces = toCreateFaces;
+  grid._toConsiderInternalFaces = false;
+  grid._toUseThresholdForInternalFaces = false;
+  grid._toUseQuanta = false;
+  grid._sizeThreshold = theSizeThreshold;
+  grid.InitGeometry( theShape );
+
+  std::map< TGeomID, vector< TGeomID > > edge2faceIDsMap;
+  GridInitAndIntersectWithShape( grid, theGridSpacing, theSizeThreshold,
+                                 theShape, edge2faceIDsMap, 1 );
+  Hexahedron hex( &grid );
+  int nbAdded = hex.MakeElements( helper, edge2faceIDsMap, 1 );
+  if (nbAdded != theNbCreatedExpected) {
+    std::stringstream buffer;
+    buffer << "Number of computed elements does not match: obtained " << nbAdded << " != expected " << theNbCreatedExpected;
+    //CPPUNIT_ASSERT_MESSAGE(buffer.str().c_str(), nbAdded == theNbCreatedExpected );
+    //MESSAGE(buffer.str().c_str());
+    //CppUnitTestFramework::Logger::WriteMessage(buffer.str().c_str());
+    std::cerr << buffer.str() << std::endl;
+    return false;
+  }
+
+  return true;
+}
+
+/*!
+  * \brief Test some primitive shapes
+  */
+bool testPrimitives()
+{
+  bool isOK = true;
+
+  // Test fitting of a box
+  BRepPrimAPI_MakeBox aMakeBox (10, 20, 30);
+  aMakeBox.Build();
+  CPPUNIT_ASSERT_MESSAGE( "Could not create the box!", aMakeBox.IsDone() );      
+  TopoDS_Shape aShape = aMakeBox.Shape();
+
+  // Test exact fitting of a box
+  if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/false,
+                  /*gridSpacing*/10, /*theSizeThreshold*/4, /*theNbCreatedExpected*/6))
+    isOK = false;
+  if (!testShape (aShape, /*toAddEdges*/true, /*toCreateFaces*/false,
+                  /*gridSpacing*/10, /*theSizeThreshold*/4, /*theNbCreatedExpected*/6))
+    isOK = false;
+
+  // TODO: debug this case
+  //if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/true,
+  //                /*gridSpacing*/10, /*theSizeThreshold*/4, /*theNbCreatedExpected*/8))
+  //  isOK = false;
+
+  if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/false,
+                  /*gridSpacing*/5, /*theSizeThreshold*/4, /*theNbCreatedExpected*/48))
+    isOK = false;
+
+  // Test not exact fitting of a box
+  if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/false,
+                  /*gridSpacing*/7, /*theSizeThreshold*/4, /*theNbCreatedExpected*/12))
+    isOK = false;
+
+  // Test fitting of a cylinder
+  gp_Ax2 anAxes (gp::Origin(), gp::DZ());
+  BRepPrimAPI_MakeCylinder aMakeCyl (anAxes, 20., 30.);
+  aMakeCyl.Build();
+  CPPUNIT_ASSERT_MESSAGE( "Could not create the cylinder!", aMakeCyl.IsDone() );      
+  aShape = aMakeCyl.Shape();
+
+  // test for different threshold values
+  if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/false,
+                  /*gridSpacing*/10, /*theSizeThreshold*/4, /*theNbCreatedExpected*/48))
+    isOK = false;
+  if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/false,
+                  /*gridSpacing*/10, /*theSizeThreshold*/2, /*theNbCreatedExpected*/36))
+    isOK = false;
+
+  // Test fitting of a sphere
+  BRepPrimAPI_MakeSphere aMakeSph (anAxes, 30.);
+  aMakeSph.Build();
+  CPPUNIT_ASSERT_MESSAGE( "Could not create the sphere!", aMakeSph.IsDone() );      
+  aShape = aMakeSph.Shape();
+
+  // test for different threshold values
+  if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/false,
+                  /*gridSpacing*/10, /*theSizeThreshold*/4, /*theNbCreatedExpected*/136))
+    isOK = false;
+  if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/false,
+                  /*gridSpacing*/10, /*theSizeThreshold*/2, /*theNbCreatedExpected*/88))
+    isOK = false;
+
+  // Test fitting of a cone
+  BRepPrimAPI_MakeCone aMakeCon (anAxes, 30., 0., 40.);
+  aMakeCon.Build();
+  CPPUNIT_ASSERT_MESSAGE( "Could not create the cone!", aMakeCon.IsDone() );      
+  aShape = aMakeCon.Shape();
+
+  // test for different threshold values
+  if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/false,
+                  /*gridSpacing*/10, /*theSizeThreshold*/100, /*theNbCreatedExpected*/72))
+    isOK = false;
+  if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/false,
+                  /*gridSpacing*/10, /*theSizeThreshold*/4, /*theNbCreatedExpected*/40))
+    isOK = false;
+  if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/false,
+                  /*gridSpacing*/10, /*theSizeThreshold*/1.5, /*theNbCreatedExpected*/32))
+    isOK = false;
+
+  // truncated cone
+  aMakeCon = BRepPrimAPI_MakeCone(anAxes, 30., 15., 20.);
+  aMakeCon.Build();
+  CPPUNIT_ASSERT_MESSAGE( "Could not create the cone!", aMakeCon.IsDone() );      
+  aShape = aMakeCon.Shape();
+
+  // test for different threshold values
+  if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/false,
+                  /*gridSpacing*/10, /*theSizeThreshold*/100, /*theNbCreatedExpected*/56))
+    isOK = false;
+  if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/false,
+                  /*gridSpacing*/10, /*theSizeThreshold*/4, /*theNbCreatedExpected*/36))
+    isOK = false;
+  if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/false,
+                  /*gridSpacing*/10, /*theSizeThreshold*/1.5, /*theNbCreatedExpected*/28))
+    isOK = false;
+
+  return isOK;
+}
+
+// Entry point for test
+int main()
+{
+  bool isOK = testPrimitives();
+  return isOK ? 0 : 1;
+}
index e5037897fda70afebacf6ee59ce641b9ba13a71f..e993a96f58d75a22fa091edaff41218292496149 100644 (file)
@@ -75,7 +75,9 @@ void loadBrepShape( std::string shapeName, TopoDS_Shape & shape )
   BRepTools::Read(shape, shapeName.c_str(), b);  
 }
 
-// Initialize the grid and intesersectors of grid with the geometry
+/*!
+  * \brief Initialize the grid and intesersectors of grid with the geometry
+  */
 void GridInitAndIntersectWithShape( Grid& grid,
                                     double gridSpacing,
                                     double theSizeThreshold,
@@ -132,14 +134,18 @@ void GridInitAndIntersectWithShape( Grid& grid,
   grid.GetEdgesToImplement( edge2faceIDsMap, theShape, faceVec );
 }
 
-// ADD test for parallel intersection of grid with solid
-
-// Reproduce conditions of TBPERF_GRIDS_PERF_SMESH_M1 test to detect and solve segfault in unit test.
+/*!
+  * \brief Reproduce conditions of TBPERF_GRIDS_PERF_SMESH_M1 test to detect and solve segfault in unit test.
+  */
 bool testNRTM1()
 {
-  for (auto numOfThreads : {1, 2, 12, 16} )
+  const auto numOfCores = std::thread::hardware_concurrency() == 0 ? 1 : std::thread::hardware_concurrency();
+  std::vector<int> numberOfThreads(numOfCores);
+  std::iota (std::begin(numberOfThreads), std::end(numberOfThreads), 1);
+
+  for (auto nThreads : numberOfThreads )
   {
-    for (size_t i = 0; i < 10; i++)
+    for (size_t i = 0; i < 10 /*trials*/; i++)
     {
       TopoDS_Shape myShape;
       loadBrepShape( "data/HexahedronTest/NRTM1.brep", myShape );
@@ -154,160 +160,56 @@ bool testNRTM1()
       grid.InitGeometry( myShape );
       
       std::map< TGeomID, vector< TGeomID > > edge2faceIDsMap;
-      GridInitAndIntersectWithShape( grid, 1.0, 4.0, myShape, edge2faceIDsMap, numOfThreads );
+      GridInitAndIntersectWithShape( grid, 1.0, 4.0, myShape, edge2faceIDsMap, nThreads );
       Hexahedron hex( &grid );
-      int nbAdded = hex.MakeElements( helper, edge2faceIDsMap, numOfThreads );
+      int nbAdded = hex.MakeElements( helper, edge2faceIDsMap, nThreads );
       CPPUNIT_ASSERT_MESSAGE( "Number of computed elements does not match", nbAdded == 1024 );
     }
   }  
   return true;
 }
 
-// Test fitting of the given shape
-bool testShape (const TopoDS_Shape theShape,
-                const bool toAddEdges,
-                const bool toCreateFaces,
-                const double theGridSpacing,
-                const double theSizeThreshold,
-                const int theNbCreatedExpected)
+/*!
+  * \brief Reproduce conditions of TBPERF_GRIDS_PERF_SMESH_J4 test to detect and solve segfault in unit test.
+  */
+bool testNRTJ4()
 {
-  std::unique_ptr<SMESH_Mesh> aMesh( new SMESH_Mesh_Test() );
-  aMesh->ShapeToMesh( theShape );
-  SMESH_MesherHelper helper( *aMesh );
-  Grid grid;
-  grid._helper = &helper;
-  grid._toAddEdges = toAddEdges;
-  grid._toCreateFaces = toCreateFaces;
-  grid._toConsiderInternalFaces = false;
-  grid._toUseThresholdForInternalFaces = false;
-  grid._toUseQuanta = false;
-  grid._sizeThreshold = theSizeThreshold;
-  grid.InitGeometry( theShape );
-
-  std::map< TGeomID, vector< TGeomID > > edge2faceIDsMap;
-  GridInitAndIntersectWithShape( grid, theGridSpacing, theSizeThreshold,
-                                 theShape, edge2faceIDsMap, 1 );
-  Hexahedron hex( &grid );
-  int nbAdded = hex.MakeElements( helper, edge2faceIDsMap, 1 );
-  if (nbAdded != theNbCreatedExpected) {
-    std::stringstream buffer;
-    buffer << "Number of computed elements does not match: obtained " << nbAdded << " != expected " << theNbCreatedExpected;
-    //CPPUNIT_ASSERT_MESSAGE(buffer.str().c_str(), nbAdded == theNbCreatedExpected );
-    //MESSAGE(buffer.str().c_str());
-    //CppUnitTestFramework::Logger::WriteMessage(buffer.str().c_str());
-    std::cerr << buffer.str() << std::endl;
-    return false;
-  }
+  const auto numOfCores = std::thread::hardware_concurrency() == 0 ? 1 : std::thread::hardware_concurrency()/2;
+  std::vector<int> numberOfThreads(numOfCores);
+  std::iota (std::begin(numberOfThreads), std::end(numberOfThreads), 1);
 
+  // Test with face creation
+  for (auto nThreads : numberOfThreads )
+  {
+    for (size_t i = 0; i < 10 /*trials*/; i++)
+    {
+      TopoDS_Shape myShape;
+      loadBrepShape( "data/HexahedronTest/NRTMJ4.brep", myShape );
+      CPPUNIT_ASSERT_MESSAGE( "Could not load the brep shape!", !myShape.IsNull() );      
+      std::unique_ptr<SMESH_Mesh> myMesh( new SMESH_Mesh_Test() );
+      myMesh->ShapeToMesh( myShape );
+      SMESH_MesherHelper helper( *myMesh );
+      Grid grid;
+      grid._helper = &helper;
+      grid._toAddEdges = false; grid._toConsiderInternalFaces = false; grid._toUseThresholdForInternalFaces = false; grid._toUseQuanta = false;
+      double testThreshold = 1.000001;
+      grid._toCreateFaces = true;
+      grid._sizeThreshold = testThreshold;
+      grid.InitGeometry( myShape );
+      
+      std::map< TGeomID, vector< TGeomID > > edge2faceIDsMap;
+      GridInitAndIntersectWithShape( grid, 2.0, testThreshold, myShape, edge2faceIDsMap, nThreads );
+      Hexahedron hex( &grid );
+      int nbAdded = hex.MakeElements( helper, edge2faceIDsMap, nThreads );
+      CPPUNIT_ASSERT_MESSAGE( "Number of computed elements does not match", nbAdded == 35150 );
+    }
+  }  
   return true;
 }
 
-// Test some primitive shapes
-bool testPrimitives()
-{
-  bool isOK = true;
-
-  // Test fitting of a box
-  BRepPrimAPI_MakeBox aMakeBox (10, 20, 30);
-  aMakeBox.Build();
-  CPPUNIT_ASSERT_MESSAGE( "Could not create the box!", aMakeBox.IsDone() );      
-  TopoDS_Shape aShape = aMakeBox.Shape();
-
-  // Test exact fitting of a box
-  if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/false,
-                  /*gridSpacing*/10, /*theSizeThreshold*/4, /*theNbCreatedExpected*/6))
-    isOK = false;
-  if (!testShape (aShape, /*toAddEdges*/true, /*toCreateFaces*/false,
-                  /*gridSpacing*/10, /*theSizeThreshold*/4, /*theNbCreatedExpected*/6))
-    isOK = false;
-
-  // TODO: debug this case
-  //if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/true,
-  //                /*gridSpacing*/10, /*theSizeThreshold*/4, /*theNbCreatedExpected*/8))
-  //  isOK = false;
-
-  if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/false,
-                  /*gridSpacing*/5, /*theSizeThreshold*/4, /*theNbCreatedExpected*/48))
-    isOK = false;
-
-  // Test not exact fitting of a box
-  if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/false,
-                  /*gridSpacing*/7, /*theSizeThreshold*/4, /*theNbCreatedExpected*/12))
-    isOK = false;
-
-  // Test fitting of a cylinder
-  gp_Ax2 anAxes (gp::Origin(), gp::DZ());
-  BRepPrimAPI_MakeCylinder aMakeCyl (anAxes, 20., 30.);
-  aMakeCyl.Build();
-  CPPUNIT_ASSERT_MESSAGE( "Could not create the cylinder!", aMakeCyl.IsDone() );      
-  aShape = aMakeCyl.Shape();
-
-  // test for different threshold values
-  if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/false,
-                  /*gridSpacing*/10, /*theSizeThreshold*/4, /*theNbCreatedExpected*/48))
-    isOK = false;
-  if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/false,
-                  /*gridSpacing*/10, /*theSizeThreshold*/2, /*theNbCreatedExpected*/36))
-    isOK = false;
-
-  // Test fitting of a sphere
-  BRepPrimAPI_MakeSphere aMakeSph (anAxes, 30.);
-  aMakeSph.Build();
-  CPPUNIT_ASSERT_MESSAGE( "Could not create the sphere!", aMakeSph.IsDone() );      
-  aShape = aMakeSph.Shape();
-
-  // test for different threshold values
-  if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/false,
-                  /*gridSpacing*/10, /*theSizeThreshold*/4, /*theNbCreatedExpected*/136))
-    isOK = false;
-  if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/false,
-                  /*gridSpacing*/10, /*theSizeThreshold*/2, /*theNbCreatedExpected*/88))
-    isOK = false;
-
-  // Test fitting of a cone
-  BRepPrimAPI_MakeCone aMakeCon (anAxes, 30., 0., 40.);
-  aMakeCon.Build();
-  CPPUNIT_ASSERT_MESSAGE( "Could not create the cone!", aMakeCon.IsDone() );      
-  aShape = aMakeCon.Shape();
-
-  // test for different threshold values
-  if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/false,
-                  /*gridSpacing*/10, /*theSizeThreshold*/100, /*theNbCreatedExpected*/72))
-    isOK = false;
-  if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/false,
-                  /*gridSpacing*/10, /*theSizeThreshold*/4, /*theNbCreatedExpected*/40))
-    isOK = false;
-  if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/false,
-                  /*gridSpacing*/10, /*theSizeThreshold*/1.5, /*theNbCreatedExpected*/32))
-    isOK = false;
-
-  // truncated cone
-  aMakeCon = BRepPrimAPI_MakeCone(anAxes, 30., 15., 20.);
-  aMakeCon.Build();
-  CPPUNIT_ASSERT_MESSAGE( "Could not create the cone!", aMakeCon.IsDone() );      
-  aShape = aMakeCon.Shape();
-
-  // test for different threshold values
-  if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/false,
-                  /*gridSpacing*/10, /*theSizeThreshold*/100, /*theNbCreatedExpected*/56))
-    isOK = false;
-  if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/false,
-                  /*gridSpacing*/10, /*theSizeThreshold*/4, /*theNbCreatedExpected*/36))
-    isOK = false;
-  if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/false,
-                  /*gridSpacing*/10, /*theSizeThreshold*/1.5, /*theNbCreatedExpected*/28))
-    isOK = false;
-
-  return isOK;
-}
-
 // Entry point for test
 int main()
 {
-  bool isOK = testNRTM1();
-
-  if (!testPrimitives())
-    isOK = false;
-
+  bool isOK = testNRTM1() && testNRTJ4();
   return isOK ? 0 : 1;
 }
index 26e79035d7d3ebd2ed0688a1356c41142cf6bb06..df1ddaa09f9826f6f5e31757ab61948ebfa6dfae 100644 (file)
@@ -24,4 +24,5 @@
 
 SET(UNIT_TESTS
   HexahedronTest
+  HexahedronCanonicalShapesTest
   )
\ No newline at end of file
diff --git a/test/data/HexahedronTest/NRTMJ4.brep b/test/data/HexahedronTest/NRTMJ4.brep
new file mode 100644 (file)
index 0000000..3ed6ccc
--- /dev/null
@@ -0,0 +1,796 @@
+DBRep_DrawableShape
+
+CASCADE Topology V3, (c) Open Cascade
+Locations 0
+Curve2ds 59
+1 0 0 1 0 
+1 0 0 1 0 
+1 100 0 0 -1 
+1 0 0 0 1 
+1 0 -50 1 0 
+1 0 0 1 0 
+1 0 0 0 -1 
+1 0 0 0 1 
+1 0 0 1 0 
+1 0 60 1 0 
+1 0 0 0 1 
+1 0 0 1 0 
+1 16.899999999999999 50 0 1 
+1 0 0 1 0 
+1 0 0 1 0 
+1 16.899999999999999 50 1 0 
+1 59.899999999999999 0 0 1 
+1 0 0 1 0 
+1 76.799999999999997 50 0 1 
+1 100 0 0 1 
+1 0 0 1 0 
+1 0 0 0 1 
+1 0 0 1 0 
+1 100 0 0 1 
+1 0 50 1 0 
+1 100 0 0 -1 
+1 60 0 0 1 
+1 0 -50 1 0 
+1 0 60 1 0 
+1 0 0 0 1 
+1 0 50 1 0 
+1 16.899999999999999 50 0 1 
+1 0 -50 1 0 
+1 0 0 1 0 
+1 16.899999999999999 50 1 0 
+1 59.899999999999999 0 0 1 
+1 0 50 1 0 
+1 76.799999999999997 50 0 1 
+1 0 0 0 1 
+1 0 50 1 0 
+1 0 0 0 -1 
+1 60 0 0 1 
+1 0 0 1 0 
+2 0 0 1 0 -0 1 10
+2 25 25 -1 0 0 1 10
+1 0 0 0 -1 
+1 10 0 0 1 
+1 16.899999999999999 0 0 -1 
+1 0 0 0 -1 
+1 0 0 0 1 
+1 59.899999999999999 0 0 -1 
+1 0 0 0 1 
+1 59.899999999999999 0 0 -1 
+1 10 0 0 1 
+1 76.799999999999997 0 0 -1 
+1 0 50 1 0 
+2 0 0 1 0 -0 1 10
+1 6.2831853071795862 -0 0 1 
+1 0 -0 0 1 
+Curves 25
+1 0 0 0 0 0 1 
+1 0 0 100 -0 1 0 
+1 0 50 0 0 0 1 
+1 0 0 0 -0 1 0 
+1 60 0 0 0 0 1 
+1 50 0 16.899999999999999 1 0 -0 
+1 50 0 16.899999999999999 0 0 1 
+1 50 0 76.799999999999997 1 0 -0 
+1 0 0 100 1 0 -0 
+1 0 0 0 1 0 -0 
+1 0 50 100 1 0 -0 
+1 60 0 100 -0 1 0 
+1 60 50 0 0 0 1 
+1 50 50 16.899999999999999 1 0 -0 
+1 50 50 16.899999999999999 0 0 1 
+1 50 50 76.799999999999997 1 0 -0 
+1 0 50 0 1 0 -0 
+1 60 0 0 -0 1 0 
+2 25 25 0 0 0 -1 -1 0 -0 0 1 0 10
+1 60 0 16.899999999999999 -0 1 0 
+1 50 0 16.899999999999999 -0 1 0 
+1 50 0 76.799999999999997 -0 1 0 
+1 60 0 76.799999999999997 -0 1 0 
+2 25 25 -50 0 0 -1 -1 0 -0 0 1 0 10
+1 15.000000000000002 24.999999999999996 0 0 0 -1 
+Polygon3D 0
+PolygonOnTriangulations 54
+2 1 2 
+p 0.6000000008 1 0 100 
+2 3 4 
+p 0.6000000008 1 0 100 
+2 2 4 
+p 0.6000000008 1 0 50 
+2 1 2 
+p 0.6000000008 1 0 50 
+2 3 4 
+p 0.6000000008 1 0 100 
+2 3 4 
+p 0.6000000008 1 0 100 
+2 1 3 
+p 0.6000000008 1 0 50 
+2 1 2 
+p 0.6000000008 1 0 50 
+2 1 2 
+p 0.6000000008 1 0 16.9 
+2 1 2 
+p 0.6000000008 1 0 16.9 
+2 8 2 
+p 0.6000000008 1 0 10 
+2 1 3 
+p 0.6000000008 1 0 10 
+2 8 7 
+p 0.6000000008 1 0 59.9 
+2 1 2 
+p 0.6000000008 1 0 59.9 
+2 7 6 
+p 0.6000000008 1 0 10 
+2 1 3 
+p 0.6000000008 1 0 10 
+2 6 5 
+p 0.6000000008 1 76.8 100 
+2 1 2 
+p 0.6000000008 1 76.8 100 
+2 4 5 
+p 0.6000000008 1 0 60 
+2 1 3 
+p 0.6000000008 1 0 60 
+2 3 1 
+p 0.6000000008 1 0 60 
+2 1 3 
+p 0.6000000008 1 0 60 
+2 2 4 
+p 0.6000000008 1 0 60 
+2 4 5 
+p 0.6000000008 1 0 60 
+2 3 4 
+p 0.6000000008 1 0 50 
+2 2 4 
+p 0.6000000008 1 0 50 
+2 1 2 
+p 0.6000000008 1 0 16.9 
+2 3 4 
+p 0.6000000008 1 0 16.9 
+2 8 2 
+p 0.6000000008 1 0 10 
+2 2 4 
+p 0.6000000008 1 0 10 
+2 8 7 
+p 0.6000000008 1 0 59.9 
+2 3 4 
+p 0.6000000008 1 0 59.9 
+2 7 6 
+p 0.6000000008 1 0 10 
+2 2 4 
+p 0.6000000008 1 0 10 
+2 6 5 
+p 0.6000000008 1 76.8 100 
+2 3 4 
+p 0.6000000008 1 76.8 100 
+2 3 1 
+p 0.6000000008 1 0 60 
+2 2 4 
+p 0.6000000008 1 0 60 
+2 3 4 
+p 0.6000000008 1 0 50 
+2 1 3 
+p 0.6000000008 1 0 50 
+37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 
+p 0.6000000008 1 0 0.174532925199433 0.349065850398866 0.523598775598299 0.698131700797732 0.872664625997165 1.0471975511966 1.22173047639603 1.39626340159546 1.5707963267949 1.74532925199433 1.91986217719376 2.0943951023932 2.26892802759263 2.44346095279206 2.61799387799149 2.79252680319093 2.96705972839036 3.14159265358979 3.31612557878922 3.49065850398866 3.66519142918809 3.83972435438752 4.01425727958696 4.18879020478639 4.36332312998582 4.53785605518525 4.71238898038469 4.88692190558412 5.06145483078355 5.23598775598299 5.41052068118242 5.58505360638185 5.75958653158128 5.93411945678072 6.10865238198015 6.28318530717959 
+37 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 5 
+p 0.6000000008 1 0 0.174532925199433 0.349065850398866 0.523598775598299 0.698131700797732 0.872664625997165 1.0471975511966 1.22173047639603 1.39626340159546 1.5707963267949 1.74532925199433 1.91986217719376 2.0943951023932 2.26892802759263 2.44346095279206 2.61799387799149 2.79252680319093 2.96705972839036 3.14159265358979 3.31612557878922 3.49065850398866 3.66519142918809 3.83972435438752 4.01425727958696 4.18879020478639 4.36332312998582 4.53785605518525 4.71238898038469 4.88692190558412 5.06145483078355 5.23598775598299 5.41052068118242 5.58505360638185 5.75958653158128 5.93411945678072 6.10865238198015 6.28318530717959 
+2 2 4 
+p 0.6000000008 1 0 50 
+2 3 4 
+p 0.6000000008 1 0 50 
+2 1 2 
+p 0.6000000008 1 0 50 
+2 1 3 
+p 0.6000000008 1 0 50 
+2 2 4 
+p 0.6000000008 1 0 50 
+2 1 2 
+p 0.6000000008 1 0 50 
+2 3 4 
+p 0.6000000008 1 0 50 
+2 1 3 
+p 0.6000000008 1 0 50 
+37 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 
+p 0.6000000008 1 0 0.174532925199433 0.349065850398866 0.523598775598299 0.698131700797732 0.872664625997165 1.0471975511966 1.22173047639603 1.39626340159546 1.5707963267949 1.74532925199433 1.91986217719376 2.0943951023932 2.26892802759263 2.44346095279206 2.61799387799149 2.79252680319093 2.96705972839036 3.14159265358979 3.31612557878922 3.49065850398866 3.66519142918809 3.83972435438752 4.01425727958696 4.18879020478639 4.36332312998582 4.53785605518525 4.71238898038469 4.88692190558412 5.06145483078355 5.23598775598299 5.41052068118242 5.58505360638185 5.75958653158128 5.93411945678072 6.10865238198015 6.28318530717959 
+37 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 1 
+p 0.6000000008 1 0 0.174532925199433 0.349065850398866 0.523598775598299 0.698131700797732 0.872664625997165 1.0471975511966 1.22173047639603 1.39626340159546 1.5707963267949 1.74532925199433 1.91986217719376 2.0943951023932 2.26892802759263 2.44346095279206 2.61799387799149 2.79252680319093 2.96705972839036 3.14159265358979 3.31612557878922 3.49065850398866 3.66519142918809 3.83972435438752 4.01425727958696 4.18879020478639 4.36332312998582 4.53785605518525 4.71238898038469 4.88692190558412 5.06145483078355 5.23598775598299 5.41052068118242 5.58505360638185 5.75958653158128 5.93411945678072 6.10865238198015 6.28318530717959 
+2 38 1 
+p 0.6000000008 1 0 50 
+2 74 37 
+p 0.6000000008 1 0 50 
+Surfaces 15
+1 0 0 0 1 0 -0 0 0 1 0 -1 0 
+1 0 0 0 -0 1 0 0 0 1 1 0 -0 
+1 0 0 100 0 0 1 1 0 -0 -0 1 0 
+1 0 50 0 -0 1 0 0 0 1 1 0 -0 
+1 0 0 0 0 0 1 1 0 -0 -0 1 0 
+1 60 0 0 1 0 -0 0 0 1 0 -1 0 
+1 50 0 16.899999999999999 -0 1 0 0 0 1 1 0 -0 
+1 50 0 16.899999999999999 0 0 1 1 0 -0 -0 1 0 
+1 50 0 16.899999999999999 1 0 -0 0 0 1 0 -1 0 
+1 50 0 76.799999999999997 0 0 1 1 0 -0 -0 1 0 
+1 50 50 16.899999999999999 -0 1 0 0 0 1 1 0 -0 
+2 25 25 0 0 0 -1 -1 0 -0 0 1 0 10
+1 25 25 0 0 0 -1 -1 0 -0 0 1 0 
+1 60 0 16.899999999999999 1 0 -0 0 0 1 0 -1 0 
+1 25 25 -50 0 0 -1 -1 0 -0 0 1 0 
+Triangulations 12
+4 2 1 0 0
+0 0 0 0 0 100 0 50 0 0 50 100 0 0 100 0 0 -50 100 -50 2 1 3 2 3 4 
+8 6 1 0 0
+60 0 0 60 0 16.9 0 0 0 0 0 100 60 0 100 60 0 76.8 50 0 76.8 50 0 16.9 0 60 16.9 60 0 0 100 0 100 60 76.8 60 76.8 50 16.9 50 8 1 3 2 1 8 7 3 4 7 8 3 5 6 7 5 7 4 
+4 2 1 0 0
+0 0 100 0 50 100 60 0 100 60 50 100 0 0 0 50 60 0 60 50 3 2 1 4 2 3 
+8 6 1 0 0
+60 50 0 60 50 16.9 0 50 0 0 50 100 60 50 100 60 50 76.8 50 50 76.8 50 50 16.9 0 60 16.9 60 0 0 100 0 100 60 76.8 60 76.8 50 16.9 50 8 1 3 2 1 8 7 3 4 7 8 3 5 6 7 5 7 4 
+40 40 1 0 1.77635683940025e-15
+0 0 0 0 50 0 60 0 0 60 50 0 15 25 0 15.1519224698779 26.7364817766693 0 15.6030737921409 28.4202014332567 0 16.3397459621556 30 0 17.3395555688102 31.4278760968654 0 18.5721239031346 32.6604444311898 0 20 33.6602540378444 0 21.5797985667433 34.3969262078591 0 23.2635182233307 34.8480775301221 0 25 35 0 26.7364817766693 34.8480775301221 0 28.4202014332567 34.3969262078591 0 30 33.6602540378444 0 31.4278760968654 32.6604444311898 0 32.6604444311898 31.4278760968654 0 33.6602540378444 30 0 34.3969262078591 28.4202014332567 0 34.8480775301221 26.7364817766693 0 35 25 0 34.8480775301221 23.2635182233307 0 34.3969262078591 21.5797985667433 0 33.6602540378444 20 0 32.6604444311898 18.5721239031346 0 31.4278760968654 17.3395555688102 0 30 16.3397459621556 0 28.4202014332567 15.6030737921409 0 26.7364817766693 15.1519224698779 0 25 15 0 23.2635182233307 15.1519224698779 0 21.5797985667433 15.6030737921409 0 20 16.3397459621556 0 18.5721239031346 17.3395555688102 0 17.3395555688102 18.5721239031346 0 16.3397459621556 20 0 15.6030737921409 21.5797985667433 0 15.1519224698779 23.2635182233307 0 0 0 0 50 60 0 60 50 15 25 15.1519224698779 26.7364817766693 15.6030737921409 28.4202014332567 16.3397459621556 30 17.3395555688102 31.4278760968654 18.5721239031346 32.6604444311898 20 33.6602540378444 21.5797985667433 34.3969262078591 23.2635182233307 34.8480775301221 25 35 26.7364817766693 34.8480775301221 28.4202014332567 34.3969262078591 30 33.6602540378444 31.4278760968654 32.6604444311898 32.6604444311898 31.4278760968654 33.6602540378444 30 34.3969262078591 28.4202014332567 34.8480775301221 26.7364817766693 35 25 34.8480775301221 23.2635182233307 34.3969262078591 21.5797985667433 33.6602540378444 20 32.6604444311898 18.5721239031346 31.4278760968654 17.3395555688102 30 16.3397459621556 28.4202014332567 15.6030737921409 26.7364817766693 15.1519224698779 25 15 23.2635182233307 15.1519224698779 21.5797985667433 15.6030737921409 20 16.3397459621556 18.5721239031346 17.3395555688102 17.3395555688102 18.5721239031346 16.3397459621556 20 15.6030737921409 21.5797985667433 15.1519224698779 23.2635182233307 36 37 1 38 1 37 35 36 1 39 1 38 34 35 1 40 1 39 33 34 1 5 1 40 32 33 1 31 32 1 2 5 6 2 6 7 2 7 8 2 8 9 2 1 5 10 2 9 11 2 10 12 2 11 13 2 12 3 24 25 3 25 26 3 26 27 3 27 28 3 28 29 3 29 30 3 30 31 3 31 1 14 2 13 23 24 3 15 2 14 4 2 15 4 15 16 4 16 17 4 17 18 4 18 19 4 19 20 4 20 21 4 21 22 4 22 23 4 23 3 
+4 2 1 0 0
+60 0 0 60 0 16.9 60 50 0 60 50 16.9 0 0 16.9 0 0 -50 16.9 -50 1 3 4 2 1 4 
+4 2 1 0 0
+50 0 16.9 50 50 16.9 60 0 16.9 60 50 16.9 0 0 0 50 10 0 10 50 4 2 1 4 1 3 
+4 2 1 0 7.105427357601e-15
+50 0 16.9 50 0 76.8 50 50 16.9 50 50 76.8 0 0 59.9 0 0 -50 59.9 -50 2 1 3 2 3 4 
+4 2 1 0 0
+50 0 76.8 50 50 76.8 60 0 76.8 60 50 76.8 0 0 0 50 10 0 10 50 4 2 1 4 1 3 
+4 2 1 0 0
+60 0 76.8 60 0 100 60 50 76.8 60 50 100 76.8 0 100 0 76.8 -50 100 -50 1 3 4 2 1 4 
+74 72 1 0 0.0380530190825497
+15 25 -50 15.1519224698779 26.7364817766693 -50 15.6030737921409 28.4202014332567 -50 16.3397459621556 30 -50 17.3395555688102 31.4278760968654 -50 18.5721239031346 32.6604444311898 -50 20 33.6602540378444 -50 21.5797985667433 34.3969262078591 -50 23.2635182233307 34.8480775301221 -50 25 35 -50 26.7364817766693 34.8480775301221 -50 28.4202014332567 34.3969262078591 -50 30 33.6602540378444 -50 31.4278760968654 32.6604444311898 -50 32.6604444311898 31.4278760968654 -50 33.6602540378444 30 -50 34.3969262078591 28.4202014332567 -50 34.8480775301221 26.7364817766693 -50 35 25 -50 34.8480775301221 23.2635182233307 -50 34.3969262078591 21.5797985667433 -50 33.6602540378444 20 -50 32.6604444311898 18.5721239031346 -50 31.4278760968654 17.3395555688102 -50 30 16.3397459621556 -50 28.4202014332567 15.6030737921409 -50 26.7364817766693 15.1519224698779 -50 25 15 -50 23.2635182233307 15.1519224698779 -50 21.5797985667433 15.6030737921409 -50 20 16.3397459621556 -50 18.5721239031346 17.3395555688102 -50 17.3395555688102 18.5721239031346 -50 16.3397459621556 20 -50 15.6030737921409 21.5797985667433 -50 15.1519224698779 23.2635182233307 -50 15 25 -50 15 25 0 15.1519224698779 26.7364817766693 0 15.6030737921409 28.4202014332567 0 16.3397459621556 30 0 17.3395555688102 31.4278760968654 0 18.5721239031346 32.6604444311898 0 20 33.6602540378444 0 21.5797985667433 34.3969262078591 0 23.2635182233307 34.8480775301221 0 25 35 0 26.7364817766693 34.8480775301221 0 28.4202014332567 34.3969262078591 0 30 33.6602540378444 0 31.4278760968654 32.6604444311898 0 32.6604444311898 31.4278760968654 0 33.6602540378444 30 0 34.3969262078591 28.4202014332567 0 34.8480775301221 26.7364817766693 0 35 25 0 34.8480775301221 23.2635182233307 0 34.3969262078591 21.5797985667433 0 33.6602540378444 20 0 32.6604444311898 18.5721239031346 0 31.4278760968654 17.3395555688102 0 30 16.3397459621556 0 28.4202014332567 15.6030737921409 0 26.7364817766693 15.1519224698779 0 25 15 0 23.2635182233307 15.1519224698779 0 21.5797985667433 15.6030737921409 0 20 16.3397459621556 0 18.5721239031346 17.3395555688102 0 17.3395555688102 18.5721239031346 0 16.3397459621556 20 0 15.6030737921409 21.5797985667433 0 15.1519224698779 23.2635182233307 0 15 25 0 0 50 0.174532925199433 50 0.349065850398866 50 0.523598775598299 50 0.698131700797732 50 0.872664625997165 50 1.0471975511966 50 1.22173047639603 50 1.39626340159546 50 1.5707963267949 50 1.74532925199433 50 1.91986217719376 50 2.0943951023932 50 2.26892802759263 50 2.44346095279206 50 2.61799387799149 50 2.79252680319093 50 2.96705972839036 50 3.14159265358979 50 3.31612557878922 50 3.49065850398866 50 3.66519142918809 50 3.83972435438752 50 4.01425727958696 50 4.18879020478639 50 4.36332312998582 50 4.53785605518525 50 4.71238898038469 50 4.88692190558412 50 5.06145483078355 50 5.23598775598299 50 5.41052068118242 50 5.58505360638185 50 5.75958653158128 50 5.93411945678072 50 6.10865238198015 50 6.28318530717959 50 0 0 0.174532925199433 0 0.349065850398866 0 0.523598775598299 0 0.698131700797732 0 0.872664625997165 0 1.0471975511966 0 1.22173047639603 0 1.39626340159546 0 1.5707963267949 0 1.74532925199433 0 1.91986217719376 0 2.0943951023932 0 2.26892802759263 0 2.44346095279206 0 2.61799387799149 0 2.79252680319093 0 2.96705972839036 0 3.14159265358979 0 3.31612557878922 0 3.49065850398866 0 3.66519142918809 0 3.83972435438752 0 4.01425727958696 0 4.18879020478639 0 4.36332312998582 0 4.53785605518525 0 4.71238898038469 0 4.88692190558412 0 5.06145483078355 0 5.23598775598299 0 5.41052068118242 0 5.58505360638185 0 5.75958653158128 0 5.93411945678072 0 6.10865238198015 0 6.28318530717959 0 2 1 38 2 38 39 3 39 40 3 2 39 4 40 41 4 3 40 5 41 42 5 42 43 5 4 41 6 43 44 6 5 43 7 6 44 8 7 44 8 44 45 9 8 45 9 45 46 10 9 46 10 46 47 11 10 47 11 47 48 12 11 48 12 48 49 13 12 49 13 49 50 14 13 50 14 50 51 15 14 51 15 51 52 16 15 52 16 52 53 17 16 53 17 53 54 18 17 54 18 54 55 18 55 56 19 18 56 20 56 57 20 19 56 21 57 58 21 20 57 22 58 59 22 21 58 23 59 60 23 22 59 24 60 61 24 23 60 25 61 62 25 24 61 26 62 63 26 25 62 27 63 64 27 64 65 27 26 63 28 27 65 29 65 66 29 28 65 30 66 67 30 29 66 31 67 68 31 30 67 32 31 68 32 68 69 33 32 69 33 69 70 34 33 70 34 70 71 35 34 71 35 71 72 36 35 72 36 72 73 37 36 73 37 73 74 
+36 34 1 0 7.94410929039127e-15
+15 25 -50 15.1519224698779 26.7364817766693 -50 15.6030737921409 28.4202014332567 -50 16.3397459621556 30 -50 17.3395555688102 31.4278760968654 -50 18.5721239031346 32.6604444311898 -50 20 33.6602540378444 -50 21.5797985667433 34.3969262078591 -50 23.2635182233307 34.8480775301221 -50 25 35 -50 26.7364817766693 34.8480775301221 -50 28.4202014332567 34.3969262078591 -50 30 33.6602540378444 -50 31.4278760968654 32.6604444311898 -50 32.6604444311898 31.4278760968654 -50 33.6602540378444 30 -50 34.3969262078591 28.4202014332567 -50 34.8480775301221 26.7364817766693 -50 35 25 -50 34.8480775301221 23.2635182233307 -50 34.3969262078591 21.5797985667433 -50 33.6602540378444 20 -50 32.6604444311898 18.5721239031346 -50 31.4278760968654 17.3395555688102 -50 30 16.3397459621556 -50 28.4202014332567 15.6030737921409 -50 26.7364817766693 15.1519224698779 -50 25 15 -50 23.2635182233307 15.1519224698779 -50 21.5797985667433 15.6030737921409 -50 20 16.3397459621556 -50 18.5721239031346 17.3395555688102 -50 17.3395555688102 18.5721239031346 -50 16.3397459621556 20 -50 15.6030737921409 21.5797985667433 -50 15.1519224698779 23.2635182233307 -50 10 -1.77635683940025e-15 9.84807753012208 1.7364817766693 9.39692620785909 3.42020143325669 8.66025403784439 5 7.66044443118978 6.42787609686539 6.42787609686539 7.66044443118978 5 8.66025403784439 3.42020143325669 9.39692620785908 1.7364817766693 9.84807753012208 0 10 -1.7364817766693 9.84807753012208 -3.42020143325669 9.39692620785909 -5 8.66025403784439 -6.42787609686539 7.66044443118978 -7.66044443118978 6.4278760968654 -8.66025403784438 5.00000000000001 -9.39692620785908 3.4202014332567 -9.84807753012208 1.73648177666932 -10 1.4210854715202e-14 -9.84807753012208 -1.73648177666929 -9.39692620785909 -3.42020143325667 -8.6602540378444 -4.99999999999998 -7.6604444311898 -6.42787609686538 -6.42787609686541 -7.66044443118977 -5.00000000000002 -8.66025403784437 -3.42020143325671 -9.39692620785907 -1.73648177666933 -9.84807753012208 -2.8421709430404e-14 -10 1.73648177666927 -9.84807753012209 3.42020143325666 -9.3969262078591 4.99999999999997 -8.6602540378444 6.42787609686536 -7.6604444311898 7.66044443118976 -6.42787609686542 8.66025403784437 -5.00000000000004 9.39692620785907 -3.42020143325673 9.84807753012207 -1.73648177666935 22 23 24 20 21 22 28 26 27 18 19 20 18 24 25 18 22 24 18 20 22 30 28 29 31 25 26 31 26 28 31 28 30 33 31 32 13 14 15 13 15 16 13 16 17 13 17 18 35 33 34 35 31 33 36 18 25 36 25 31 36 31 35 11 12 13 11 13 18 9 10 11 2 36 1 8 9 11 8 11 18 3 36 2 4 36 3 4 7 8 4 18 36 4 8 18 6 7 4 6 4 5 
+
+TShapes 72
+Ve
+1e-07
+0 0 100
+0 0
+
+0101101
+*
+Ve
+1e-07
+0 0 0
+0 0
+
+0101101
+*
+Ed
+ 1e-07 1 1 0
+1  1 0 0 100
+2  1 1 0 0 100
+2  2 2 0 0 100
+6  1 1 0
+6  2 2 0
+0
+
+0101000
+-72 0 +71 0 *
+Ve
+1e-07
+0 50 100
+0 0
+
+0101101
+*
+Ed
+ 1e-07 1 1 0
+1  2 0 0 50
+2  3 1 0 0 50
+2  4 3 0 0 50
+6  3 1 0
+6  4 3 0
+0
+
+0101000
+-69 0 +72 0 *
+Ve
+1e-07
+0 50 0
+0 0
+
+0101101
+*
+Ed
+ 1e-07 1 1 0
+1  3 0 0 100
+2  5 1 0 0 100
+2  6 4 0 0 100
+6  5 1 0
+6  6 4 0
+0
+
+0101000
+-69 0 +67 0 *
+Ed
+ 1e-07 1 1 0
+1  4 0 0 50
+2  7 1 0 0 50
+2  8 5 0 0 50
+6  7 1 0
+6  8 5 0
+0
+
+0101000
+-67 0 +71 0 *
+Wi
+
+0101100
+-70 0 -68 0 +66 0 +65 0 *
+Fa
+0  1e-07 1 0
+2  1
+0101000
++64 0 *
+Ve
+1e-07
+60 0 0
+0 0
+
+0101101
+*
+Ve
+1e-07
+60 0 16.9
+0 0
+
+0101101
+*
+Ed
+ 1e-07 1 1 0
+1  5 0 0 16.9
+2  9 6 0 0 16.9
+2  10 2 0 0 16.9
+6  9 2 0
+6  10 6 0
+0
+
+0101000
++62 0 -61 0 *
+Ve
+1e-07
+50 0 16.9
+0 0
+
+0101101
+*
+Ed
+ 1e-07 1 1 0
+1  6 0 0 10
+2  11 7 0 0 10
+2  12 8 0 0 10
+2  13 2 0 0 10
+6  11 2 0
+6  12 7 0
+0
+
+0101000
+-61 0 +59 0 *
+Ve
+1e-07
+50 0 76.8
+0 0
+
+0101101
+*
+Ed
+ 1e-07 1 1 0
+1  7 0 0 59.9
+2  14 9 0 0 59.9
+2  15 7 0 0 59.9
+2  16 2 0 0 59.9
+6  13 2 0
+6  14 8 0
+0
+
+0101000
+-57 0 +59 0 *
+Ve
+1e-07
+60 0 76.8
+0 0
+
+0101101
+*
+Ed
+ 1e-07 1 1 0
+1  8 0 0 10
+2  17 7 0 0 10
+2  18 10 0 0 10
+2  19 2 0 0 10
+6  15 2 0
+6  16 9 0
+0
+
+0101000
+-55 0 +57 0 *
+Ve
+1e-07
+60 0 100
+0 0
+
+0101101
+*
+Ed
+ 1e-07 1 1 0
+1  5 0 76.8 100
+2  9 6 0 76.8 100
+2  10 2 0 76.8 100
+6  17 2 0
+6  18 10 0
+0
+
+0101000
++55 0 -53 0 *
+Ed
+ 1e-07 1 1 0
+1  9 0 0 60
+2  20 2 0 0 60
+2  21 3 0 0 60
+6  19 2 0
+6  20 3 0
+0
+
+0101000
+-53 0 +72 0 *
+Ed
+ 1e-07 1 1 0
+1  10 0 0 60
+2  22 2 0 0 60
+2  23 5 0 0 60
+6  21 2 0
+6  22 5 0
+0
+
+0101000
+-62 0 +71 0 *
+Wi
+
+0101100
+-60 0 +58 0 -56 0 -54 0 -52 0 +51 0 +70 0 -50 0 *
+Fa
+0  1e-07 2 0
+2  2
+0101000
++49 0 *
+Ve
+1e-07
+60 50 100
+0 0
+
+0101101
+*
+Ed
+ 1e-07 1 1 0
+1  11 0 0 60
+2  24 4 0 0 60
+2  25 3 0 0 60
+6  23 3 0
+6  24 4 0
+0
+
+0101000
+-47 0 +69 0 *
+Ed
+ 1e-07 1 1 0
+1  12 0 0 50
+2  26 6 0 0 50
+2  27 3 0 0 50
+6  25 3 0
+6  26 10 0
+0
+
+0101000
+-47 0 +53 0 *
+Wi
+
+0101100
+-68 0 -46 0 +45 0 +51 0 *
+Fa
+0  1e-07 3 0
+2  3
+0101000
++44 0 *
+Ve
+1e-07
+60 50 0
+0 0
+
+0101101
+*
+Ve
+1e-07
+60 50 16.9
+0 0
+
+0101101
+*
+Ed
+ 1e-07 1 1 0
+1  13 0 0 16.9
+2  28 6 0 0 16.9
+2  29 4 0 0 16.9
+6  27 4 0
+6  28 6 0
+0
+
+0101000
++42 0 -41 0 *
+Ve
+1e-07
+50 50 16.9
+0 0
+
+0101101
+*
+Ed
+ 1e-07 1 1 0
+1  14 0 0 10
+2  30 11 0 0 10
+2  31 8 0 0 10
+2  32 4 0 0 10
+6  29 4 0
+6  30 7 0
+0
+
+0101000
+-41 0 +39 0 *
+Ve
+1e-07
+50 50 76.8
+0 0
+
+0101101
+*
+Ed
+ 1e-07 1 1 0
+1  15 0 0 59.9
+2  33 9 0 0 59.9
+2  34 11 0 0 59.9
+2  35 4 0 0 59.9
+6  31 4 0
+6  32 8 0
+0
+
+0101000
+-37 0 +39 0 *
+Ve
+1e-07
+60 50 76.8
+0 0
+
+0101101
+*
+Ed
+ 1e-07 1 1 0
+1  16 0 0 10
+2  36 11 0 0 10
+2  37 10 0 0 10
+2  38 4 0 0 10
+6  33 4 0
+6  34 9 0
+0
+
+0101000
+-35 0 +37 0 *
+Ed
+ 1e-07 1 1 0
+1  13 0 76.8 100
+2  28 6 0 76.8 100
+2  29 4 0 76.8 100
+6  35 4 0
+6  36 10 0
+0
+
+0101000
++35 0 -47 0 *
+Ed
+ 1e-07 1 1 0
+1  17 0 0 60
+2  39 4 0 0 60
+2  40 5 0 0 60
+6  37 4 0
+6  38 5 0
+0
+
+0101000
+-42 0 +67 0 *
+Wi
+
+0101100
+-40 0 +38 0 -36 0 -34 0 -33 0 +46 0 +66 0 -32 0 *
+Fa
+0  1e-07 4 0
+2  4
+0101000
++31 0 *
+Ed
+ 1e-07 1 1 0
+1  18 0 0 50
+2  41 6 0 0 50
+2  42 5 0 0 50
+6  39 5 0
+6  40 6 0
+0
+
+0101000
+-42 0 +62 0 *
+Wi
+
+0101100
+-65 0 -32 0 +50 0 +29 0 *
+Ve
+1e-07
+15 25 0
+0 0
+
+0101101
+*
+Ed
+ 1e-07 1 1 0
+1  19 0 0 6.28318530717959
+2  43 12 0 0 6.28318530717959
+2  44 13 0 0 6.28318530717959
+2  45 5 0 0 6.28318530717959
+6  41 11 0
+6  42 5 0
+0
+
+0101000
++27 0 -27 0 *
+Wi
+
+0101100
++26 0 *
+Fa
+0  1e-07 5 0
+2  5
+0101000
++28 0 +25 0 *
+Ed
+ 1e-07 1 1 0
+1  20 0 0 50
+2  46 14 0 0 50
+2  47 8 0 0 50
+2  48 6 0 0 50
+6  43 6 0
+6  44 7 0
+0
+
+0101000
+-41 0 +61 0 *
+Wi
+
+0101100
+-60 0 -23 0 +40 0 +29 0 *
+Fa
+0  1e-07 6 0
+2  6
+0101000
++22 0 *
+Ed
+ 1e-07 1 1 0
+1  21 0 0 50
+2  49 9 0 0 50
+2  50 8 0 0 50
+6  45 7 0
+6  46 8 0
+0
+
+0101000
+-39 0 +59 0 *
+Wi
+
+0101100
+-20 0 -38 0 +23 0 +58 0 *
+Fa
+0  1e-07 8 0
+2  7
+0101000
++19 0 *
+Ed
+ 1e-07 1 1 0
+1  22 0 0 50
+2  51 9 0 0 50
+2  52 10 0 0 50
+6  47 8 0
+6  48 9 0
+0
+
+0101000
+-37 0 +57 0 *
+Wi
+
+0101100
+-56 0 -17 0 +36 0 +20 0 *
+Fa
+0  1e-07 9 0
+2  8
+0101000
++16 0 *
+Ed
+ 1e-07 1 1 0
+1  23 0 0 50
+2  53 14 0 0 50
+2  54 10 0 0 50
+2  55 6 0 0 50
+6  49 9 0
+6  50 10 0
+0
+
+0101000
+-35 0 +55 0 *
+Wi
+
+0101100
+-17 0 -34 0 +14 0 +54 0 *
+Fa
+0  1e-07 10 0
+2  9
+0101000
++13 0 *
+Wi
+
+0101100
+-52 0 -45 0 +33 0 +14 0 *
+Fa
+0  1e-07 6 0
+2  10
+0101000
++11 0 *
+Ve
+1e-07
+15 25 -50
+0 0
+
+0101101
+*
+Ed
+ 1e-07 1 1 0
+1  24 0 0 6.28318530717959
+2  56 12 0 0 6.28318530717959
+2  57 15 0 0 6.28318530717959
+6  51 11 0
+6  52 12 0
+0
+
+0101000
++9 0 -9 0 *
+Ed
+ 1e-07 1 1 0
+1  25 0 0 50
+3  58 59CN 12 0 0 50
+7  53 54 11 0
+0
+
+0101000
+-9 0 +27 0 *
+Wi
+
+0101100
+-8 0 +7 0 +26 0 -7 0 *
+Fa
+0  1e-07 12 0
+2  11
+0101000
++6 0 *
+Wi
+
+0101100
++8 0 *
+Fa
+0  1e-07 15 0
+2  12
+0101000
++4 0 *
+Sh
+
+0101100
+-63 0 -48 0 +43 0 +30 0 -24 0 +21 0 +18 0 +15 0 -12 0 +10 0 
++5 0 +3 0 *
+So
+
+0100000
++2 0 *
+
++1 0 
\ No newline at end of file
diff --git a/test/data/HexahedronTest/Sphere.brep b/test/data/HexahedronTest/Sphere.brep
deleted file mode 100644 (file)
index e404f6d..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-DBRep_DrawableShape
-
-CASCADE Topology V3, (c) Open Cascade
-Locations 0
-Curve2ds 4
-1 0 1.5707963267948966 1 0 
-1 6.2831853071795862 -6.2831853071795862 0 1 
-1 0 -6.2831853071795862 0 1 
-1 0 -1.5707963267948966 1 0 
-Curves 1
-2 0 0 0 -2.4492935982947064e-16 -1 0 1 -2.4492935982947064e-16 0 0 0 1 100
-Polygon3D 0
-PolygonOnTriangulations 0
-Surfaces 1
-4 0 0 0 0 0 1 1 0 -0 -0 1 0 100
-Triangulations 0
-
-TShapes 9
-Ve
-1e-07
-6.12323399573677e-15 -1.49975978266186e-30 100
-0 0
-
-0101101
-*
-Ed
- 1e-07 1 1 1
-2  1 1 0 0 6.28318530717959
-0
-
-0101000
-+9 0 -9 0 *
-Ve
-1e-07
-6.12323399573677e-15 -1.49975978266186e-30 -100
-0 0
-
-0101101
-*
-Ed
- 1e-07 1 1 0
-1  1 0 4.71238898038469 7.85398163397448
-3  2 3CN 1 0 4.71238898038469 7.85398163397448
-0
-
-0101000
--9 0 +7 0 *
-Ed
- 1e-07 1 1 1
-2  4 1 0 0 6.28318530717959
-0
-
-0101000
-+7 0 -7 0 *
-Wi
-
-0101100
--8 0 +6 0 +5 0 -6 0 *
-Fa
-0  1e-07 1 0
-
-0111000
-+4 0 *
-Sh
-
-0101100
-+3 0 *
-So
-
-1100000
-+2 0 *
-
-+1 0 
\ No newline at end of file
index 185fe644a4cca077139fe2089d3202c1cb8eab94..a3af40ace0c790e3f5b7404baf49c9c2ea50032d 100644 (file)
@@ -129,6 +129,7 @@ SET(CPP_TESTS
 
 SET(UNIT_TESTS # Any unit test add in src names space should be added here 
   HexahedronTest
+  HexahedronCanonicalShapesTest
 )
 
 # The following tests can be executed without driver, just by python.