Merge branch 'occ_7.8_compatibility' into 'master'

Compatibility with Opencascade 7.8

See merge request ngsolve/netgen!619
This commit is contained in:
Lackner, Christopher 2024-03-06 16:29:11 +01:00
commit 486c7d9bcb
10 changed files with 7 additions and 41 deletions

View File

@ -559,12 +559,13 @@ namespace netgen
auto & identifications = mesh.GetIdentifications(); auto & identifications = mesh.GetIdentifications();
std::map<size_t, PointIndex> vert2meshpt; Array<PointIndex> vert2meshpt(vertices.Size());
vert2meshpt = PointIndex::INVALID;
for(auto & vert : vertices) for(auto & vert : vertices)
{ {
auto pi = mesh.AddPoint(vert->GetPoint(), vert->properties.layer); auto pi = mesh.AddPoint(vert->GetPoint(), vert->properties.layer);
tree.Insert(mesh[pi], pi); tree.Insert(mesh[pi], pi);
vert2meshpt[vert->GetHash()] = pi; vert2meshpt[vert->nr] = pi;
mesh[pi].Singularity(vert->properties.hpref); mesh[pi].Singularity(vert->properties.hpref);
mesh[pi].SetType(FIXEDPOINT); mesh[pi].SetType(FIXEDPOINT);
@ -576,8 +577,8 @@ namespace netgen
for(auto & vert : vertices) for(auto & vert : vertices)
for(auto & ident : vert->identifications) for(auto & ident : vert->identifications)
identifications.Add(vert2meshpt[ident.from->GetHash()], identifications.Add(vert2meshpt[ident.from->nr],
vert2meshpt[ident.to->GetHash()], vert2meshpt[ident.to->nr],
ident.name, ident.name,
ident.type); ident.type);
@ -591,8 +592,8 @@ namespace netgen
auto edge = edges[edgenr].get(); auto edge = edges[edgenr].get();
PointIndex startp, endp; PointIndex startp, endp;
// throws if points are not found // throws if points are not found
startp = vert2meshpt.at(edge->GetStartVertex().GetHash()); startp = vert2meshpt[edge->GetStartVertex().nr];
endp = vert2meshpt.at(edge->GetEndVertex().GetHash()); endp = vert2meshpt[edge->GetEndVertex().nr];
// ignore collapsed edges // ignore collapsed edges
if(startp == endp && edge->GetLength() < 1e-10 * bounding_box.Diam()) if(startp == endp && edge->GetLength() < 1e-10 * bounding_box.Diam())

View File

@ -68,7 +68,6 @@ namespace netgen
Transformation<3> primary_to_me; Transformation<3> primary_to_me;
virtual ~GeometryShape() {} virtual ~GeometryShape() {}
virtual size_t GetHash() const = 0;
virtual bool IsMappedShape( const GeometryShape & other, const Transformation<3> & trafo, double tolerance ) const; virtual bool IsMappedShape( const GeometryShape & other, const Transformation<3> & trafo, double tolerance ) const;
}; };
@ -320,13 +319,6 @@ namespace netgen
throw Exception("Base geometry get tangent called"); throw Exception("Base geometry get tangent called");
} }
virtual size_t GetEdgeIndex(const GeometryEdge& edge) const
{
for(auto i : Range(edges))
if(edge.GetHash() == edges[i]->GetHash())
return i;
throw Exception("Couldn't find edge index");
}
virtual void Save (const filesystem::path & filename) const; virtual void Save (const filesystem::path & filename) const;
virtual void SaveToMeshFile (ostream & /* ost */) const { ; } virtual void SaveToMeshFile (ostream & /* ost */) const { ; }
}; };

View File

@ -53,11 +53,6 @@ namespace netgen
throw Exception(ToString("not implemented") + __FILE__ + ":" + ToString(__LINE__)); throw Exception(ToString("not implemented") + __FILE__ + ":" + ToString(__LINE__));
} }
size_t OCCEdge::GetHash() const
{
return edge.HashCode(std::numeric_limits<Standard_Integer>::max());
}
void OCCEdge::ProjectPoint(Point<3>& p, EdgePointGeomInfo* gi) const void OCCEdge::ProjectPoint(Point<3>& p, EdgePointGeomInfo* gi) const
{ {
auto pnt = ng2occ(p); auto pnt = ng2occ(p);

View File

@ -36,7 +36,6 @@ namespace netgen
Point<3> GetCenter() const override; Point<3> GetCenter() const override;
Point<3> GetPoint(double t) const override; Point<3> GetPoint(double t) const override;
double CalcStep(double t, double sag) const override; double CalcStep(double t, double sag) const override;
size_t GetHash() const override;
void ProjectPoint(Point<3>& p, EdgePointGeomInfo* gi) const override; void ProjectPoint(Point<3>& p, EdgePointGeomInfo* gi) const override;
Vec<3> GetTangent(double t) const override; Vec<3> GetTangent(double t) const override;
bool IsDegenerated(double) const override { bool IsDegenerated(double) const override {

View File

@ -30,11 +30,6 @@ namespace netgen
return 0; return 0;
} }
size_t OCCFace::GetHash() const
{
return face.HashCode(std::numeric_limits<Standard_Integer>::max());
}
Point<3> OCCFace::GetCenter() const Point<3> OCCFace::GetCenter() const
{ {
return occ2ng( props.CentreOfMass() ); return occ2ng( props.CentreOfMass() );

View File

@ -31,7 +31,6 @@ namespace netgen
const TopoDS_Face Shape() const { return face; } const TopoDS_Face Shape() const { return face; }
size_t GetHash() const override;
Point<3> GetCenter() const override; Point<3> GetCenter() const override;
virtual size_t GetNBoundaries() const override; virtual size_t GetNBoundaries() const override;
virtual Array<Segment> GetBoundary(const Mesh& mesh) const override; virtual Array<Segment> GetBoundary(const Mesh& mesh) const override;

View File

@ -16,8 +16,6 @@ namespace netgen
OCCSolid(TopoDS_Shape dshape) OCCSolid(TopoDS_Shape dshape)
: solid(TopoDS::Solid(dshape)) : solid(TopoDS::Solid(dshape))
{ } { }
size_t GetHash() const override { return solid.HashCode(std::numeric_limits<Standard_Integer>::max()); }
}; };
} }

View File

@ -16,9 +16,4 @@ namespace netgen
{ {
return p; return p;
} }
size_t OCCVertex::GetHash() const
{
return vertex.HashCode(std::numeric_limits<Standard_Integer>::max());
}
} }

View File

@ -24,7 +24,6 @@ namespace netgen
OCCVertex( TopoDS_Shape s ); OCCVertex( TopoDS_Shape s );
~OCCVertex() {} ~OCCVertex() {}
Point<3> GetPoint() const override; Point<3> GetPoint() const override;
size_t GetHash() const override;
}; };
} }

View File

@ -1710,13 +1710,6 @@ namespace netgen
BRepTools::Read(shape, ss, builder); BRepTools::Read(shape, ss, builder);
} }
/*
// enumerate shapes and archive only integers
auto my_hash = [](const TopoDS_Shape & key) {
auto occ_hash = key.HashCode(1<<31UL);
return std::hash<decltype(occ_hash)>()(occ_hash);
};
*/
TopTools_IndexedMapOfShape shape_map; TopTools_IndexedMapOfShape shape_map;
Array<TopoDS_Shape> shape_list; Array<TopoDS_Shape> shape_list;