Compatibility with OCCT 7.8.0

Hi,
I am trying to build netgen with the recently released OCCT 7.8.0.

I am getting the following errors

[  1%] Built target makerls
-- Found Git: /usr/bin/git (found version "2.40.1") 
[  1%] Built target ng_generate_version_file
[  8%] Built target ngcore
[ 10%] Built target pyngcore
[ 10%] Building CXX object CMakeFiles/nglib.dir/libsrc/occ/Partition_Spliter.cxx.o
[ 11%] Building CXX object CMakeFiles/nglib.dir/libsrc/occ/Partition_Loop3d.cxx.o
[ 11%] Building CXX object CMakeFiles/nglib.dir/libsrc/occ/occgeom.cpp.o
[ 11%] Building CXX object CMakeFiles/nglib.dir/libsrc/occ/occ_face.cpp.o
In file included from /tmp/shared-occ/netgen/libsrc/occ/Partition_Loop3d.jxx:29,
                 from /tmp/shared-occ/netgen/libsrc/occ/Partition_Loop3d.ixx:10,
                 from /tmp/shared-occ/netgen/libsrc/occ/Partition_Loop3d.cxx:14:
/tmp/shared-occ/netgen/libsrc/occ/Partition_Loop3d.hxx:32:13: fatal error: TopTools_OrientedShapeMapHasher.hxx: No such file or directory
   32 |    #include <TopTools_OrientedShapeMapHasher.hxx>
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from /tmp/shared-occ/netgen/libsrc/occ/Partition_Spliter.cxx:36:
/tmp/shared-occ/netgen/libsrc/occ/Partition_Loop3d.hxx:32:13: fatal error: TopTools_OrientedShapeMapHasher.hxx: No such file or directory
   32 |    #include <TopTools_OrientedShapeMapHasher.hxx>
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/nglib.dir/build.make:1273: CMakeFiles/nglib.dir/libsrc/occ/Partition_Spliter.cxx.o] Error 1
make[2]: *** [CMakeFiles/nglib.dir/build.make:1259: CMakeFiles/nglib.dir/libsrc/occ/Partition_Loop3d.cxx.o] Error 1
[ 12%] Building CXX object CMakeFiles/nglib.dir/libsrc/occ/occ_vertex.cpp.o
[ 12%] Building CXX object CMakeFiles/nglib.dir/libsrc/occ/occ_edge.cpp.o
/tmp/shared-occ/netgen/libsrc/occ/occ_vertex.cpp: In member function 'virtual size_t netgen::OCCVertex::GetHash() const':
/tmp/shared-occ/netgen/libsrc/occ/occ_vertex.cpp:22:21: error: 'const class TopoDS_Vertex' has no member named 'HashCode'
   22 |       return vertex.HashCode(std::numeric_limits<Standard_Integer>::max());
      |                     ^~~~~~~~
/tmp/shared-occ/netgen/libsrc/occ/occ_edge.cpp: In member function 'virtual size_t netgen::OCCEdge::GetHash() const':
/tmp/shared-occ/netgen/libsrc/occ/occ_edge.cpp:58:19: error: 'const class TopoDS_Edge' has no member named 'HashCode'
   58 |       return edge.HashCode(std::numeric_limits<Standard_Integer>::max());
      |                   ^~~~~~~~
/tmp/shared-occ/netgen/libsrc/occ/occ_face.cpp: In member function 'virtual size_t netgen::OCCFace::GetHash() const':
/tmp/shared-occ/netgen/libsrc/occ/occ_face.cpp:35:19: error: 'const class TopoDS_Face' has no member named 'HashCode'
   35 |       return face.HashCode(std::numeric_limits<Standard_Integer>::max());
      |                   ^~~~~~~~
make[2]: *** [CMakeFiles/nglib.dir/build.make:1399: CMakeFiles/nglib.dir/libsrc/occ/occ_vertex.cpp.o] Error 1
make[2]: *** [CMakeFiles/nglib.dir/build.make:1385: CMakeFiles/nglib.dir/libsrc/occ/occ_edge.cpp.o] Error 1
In file included from /tmp/shared-occ/netgen/libsrc/occ/occgeom.cpp:13:
/tmp/shared-occ/netgen/libsrc/occ/occ_solid.hpp: In member function 'virtual size_t netgen::OCCSolid::GetHash() const':
/tmp/shared-occ/netgen/libsrc/occ/occ_solid.hpp:20:56: error: 'const class TopoDS_Solid' has no member named 'HashCode'
   20 |         size_t GetHash() const override { return solid.HashCode(std::numeric_limits<Standard_Integer>::max()); }
      |                                                        ^~~~~~~~
make[2]: *** [CMakeFiles/nglib.dir/build.make:1371: CMakeFiles/nglib.dir/libsrc/occ/occ_face.cpp.o] Error 1
/tmp/shared-occ/netgen/libsrc/occ/occgeom.cpp: In lambda function:
/tmp/shared-occ/netgen/libsrc/occ/occgeom.cpp:1719:29: error: 'const class TopoDS_Shape' has no member named 'HashCode'
 1719 |         auto occ_hash = key.HashCode(1<<31UL);
      |                             ^~~~~~~~
/tmp/shared-occ/netgen/libsrc/occ/occgeom.cpp:1720:44: error: template argument 1 is invalid
 1720 |         return std::hash<decltype(occ_hash)>()(occ_hash);
      |                                            ^
make[2]: *** [CMakeFiles/nglib.dir/build.make:1301: CMakeFiles/nglib.dir/libsrc/occ/occgeom.cpp.o] Error 1
make[2]: Target 'CMakeFiles/nglib.dir/build' not remade because of errors.
make[1]: *** [CMakeFiles/Makefile2:526: CMakeFiles/nglib.dir/all] Error 2
make[1]: Target 'all' not remade because of errors.
make: *** [Makefile:166: all] Error 2
make: Target 'default_target' not remade because of errors.

Cross posted from compatibility with OCCT 7.8.0 · Issue #170 · NGSolve/netgen · GitHub : please let me know which platform (github? this forum? anything else? you’d prefer me to use to report (once in a while, typically) this sort of issues.

Cheers,
Francesco

Phu occ changed the hashing structure… And it seems in a breaking manner. I think we will need to introduce some wrapper code to stay compatible to 7.8 and older versions…

Thanks for your reply :wink: Yes, I am afraid this will need some wrapper or at least checking which version of OCCT is being included. When your team gets around to to work on this I am willing to test it through my workflows :wink:

Cheers,
Francesco