use Shape hash instead of TShape

This commit is contained in:
Christopher Lackner 2022-08-19 12:51:39 +02:00
parent 82a59defc2
commit b7e0288a34
15 changed files with 188 additions and 205 deletions

View File

@ -9,7 +9,6 @@ namespace netgen
{
OCCEdge::OCCEdge(TopoDS_Shape edge_, GeometryVertex & start_, GeometryVertex & end_)
: GeometryEdge(start_, end_),
tedge(edge_.TShape()),
edge(TopoDS::Edge(edge_))
{
curve = BRep_Tool::Curve(edge, s0, s1);
@ -51,7 +50,7 @@ namespace netgen
size_t OCCEdge::GetHash() const
{
return reinterpret_cast<size_t>(tedge.get());
return edge.HashCode(std::numeric_limits<Standard_Integer>::max());
}
void OCCEdge::ProjectPoint(Point<3>& p, EdgePointGeomInfo* gi) const

View File

@ -15,7 +15,6 @@ namespace netgen
class OCCEdge : public GeometryEdge
{
public:
T_Shape tedge;
TopoDS_Edge edge;
Handle(Geom_Curve) curve;
double s0, s1;
@ -25,7 +24,6 @@ namespace netgen
OCCEdge(TopoDS_Shape edge_, GeometryVertex & start_, GeometryVertex & end_);
auto Shape() const { return edge; }
T_Shape TShape() const { return tedge; }
double GetLength() const override;
Point<3> GetCenter() const override;

View File

@ -9,8 +9,7 @@
namespace netgen
{
OCCFace::OCCFace(TopoDS_Shape dshape)
: tface(dshape.TShape()),
face(TopoDS::Face(dshape))
: face(TopoDS::Face(dshape))
{
BRepGProp::SurfaceProperties (dshape, props);
bbox = ::netgen::GetBoundingBox(face);
@ -27,7 +26,7 @@ namespace netgen
size_t OCCFace::GetHash() const
{
return reinterpret_cast<size_t>(tface.get());
return face.HashCode(std::numeric_limits<Standard_Integer>::max());
}
Point<3> OCCFace::GetCenter() const
@ -59,9 +58,9 @@ namespace netgen
for(auto edge_ : GetEdges(face))
{
auto edge = TopoDS::Edge(edge_);
if(geom.edge_map.count(edge.TShape())==0)
if(geom.edge_map.count(edge)==0)
continue;
auto edgenr = geom.edge_map[edge.TShape()];
auto edgenr = geom.edge_map[edge];
auto & orientation = edge_orientation[edgenr];
double s0, s1;
auto cof = BRep_Tool::CurveOnSurface (edge, face, s0, s1);

View File

@ -13,7 +13,6 @@ namespace netgen
{
class OCCFace : public GeometryFace
{
T_Shape tface;
TopoDS_Face face;
GProp_GProps props;
Box<3> bbox;
@ -26,7 +25,6 @@ namespace netgen
OCCFace(TopoDS_Shape dshape);
const TopoDS_Face Shape() const { return face; }
T_Shape TShape() { return tface; }
size_t GetHash() const override;
Point<3> GetCenter() const override;

View File

@ -10,17 +10,14 @@ namespace netgen
{
class OCCSolid : public GeometrySolid
{
T_Shape tsolid;
TopoDS_Solid solid;
public:
OCCSolid(TopoDS_Shape dshape)
: tsolid(dshape.TShape()),
solid(TopoDS::Solid(dshape))
: solid(TopoDS::Solid(dshape))
{ }
T_Shape TShape() { return tsolid; }
size_t GetHash() const override { return reinterpret_cast<size_t>(tsolid.get()); }
size_t GetHash() const override { return solid.HashCode(std::numeric_limits<Standard_Integer>::max()); }
};
}

View File

@ -6,9 +6,11 @@
namespace netgen
{
Point<3> occ2ng (Handle(TopoDS_TShape) shape)
Point<3> occ2ng (const TopoDS_Shape& shape)
{
return occ2ng( Handle(BRep_TVertex)::DownCast(shape)->Pnt() );
if(shape.ShapeType() != TopAbs_VERTEX)
throw Exception("Try to convert non vertex to point!");
return occ2ng( BRep_Tool::Pnt(TopoDS::Vertex(shape)) );
}
Transformation<3> occ2ng (const gp_Trsf & occ_trafo)

View File

@ -22,8 +22,6 @@
namespace netgen
{
typedef Handle(TopoDS_TShape) T_Shape;
inline Point<3> occ2ng (const gp_Pnt & p)
{
return Point<3> (p.X(), p.Y(), p.Z());
@ -39,12 +37,7 @@ namespace netgen
return Vec<3> (v.X(), v.Y(), v.Z());
}
DLL_HEADER Point<3> occ2ng (T_Shape shape);
inline Point<3> occ2ng (const TopoDS_Shape & s)
{
return occ2ng(s.TShape());
}
DLL_HEADER Point<3> occ2ng (const TopoDS_Shape & s);
inline Point<3> occ2ng (const TopoDS_Vertex & v)
{
@ -70,8 +63,8 @@ namespace netgen
class OCCIdentification
{
public:
T_Shape from;
T_Shape to;
TopoDS_Shape from;
TopoDS_Shape to;
Transformation<3> trafo;
string name;
Identifications::ID_TYPE type;
@ -134,14 +127,6 @@ namespace netgen
return IndexMapIterator(indmap);
}
struct ShapeLess
{
bool operator() (const TopoDS_Shape& s1, const TopoDS_Shape& s2) const
{
return s1.TShape() < s2.TShape();
}
};
class ListOfShapes : public std::vector<TopoDS_Shape>
{
public:

View File

@ -7,8 +7,7 @@ namespace netgen
{
OCCVertex::OCCVertex( TopoDS_Shape s )
: vertex(TopoDS::Vertex(s)),
tvertex(s.TShape())
: vertex(TopoDS::Vertex(s))
{
p = occ2ng(vertex);
}
@ -20,6 +19,6 @@ namespace netgen
size_t OCCVertex::GetHash() const
{
return reinterpret_cast<size_t>(tvertex.get());
return vertex.HashCode(std::numeric_limits<Standard_Integer>::max());
}
}

View File

@ -12,7 +12,6 @@ namespace netgen
class OCCVertex : public GeometryVertex
{
TopoDS_Vertex vertex;
T_Shape tvertex;
Point<3> p;
public:
@ -21,7 +20,6 @@ namespace netgen
~OCCVertex() {}
Point<3> GetPoint() const override;
size_t GetHash() const override;
T_Shape TShape() { return tvertex; }
};
}

View File

@ -252,7 +252,6 @@ namespace netgen
FaceDescriptor & fd = mesh.GetFaceDescriptor(k);
auto face = TopoDS::Face(geom.fmap(k));
const auto& occface = dynamic_cast<const OCCFace&>(geom.GetFace(k-1));
auto fshape = face.TShape();
int oldnf = mesh.GetNSE();
@ -403,11 +402,11 @@ namespace netgen
// Philippose - 15/01/2009
double maxh = min2(geom.face_maxh[k-1], OCCGeometry::global_shape_properties[TopoDS::Face(geom.fmap(k)).TShape()].maxh);
double maxh = min2(geom.face_maxh[k-1], OCCGeometry::global_shape_properties[geom.fmap(k)].maxh);
//double maxh = mparam.maxh;
// int noldpoints = mesh->GetNP();
int noldsurfel = mesh.GetNSE();
int layer = OCCGeometry::global_shape_properties[TopoDS::Face(geom.fmap(k)).TShape()].layer;
int layer = OCCGeometry::global_shape_properties[geom.fmap(k)].layer;
static Timer tsurfprop("surfprop");
tsurfprop.Start();
@ -475,8 +474,8 @@ namespace netgen
int dom = 0;
for (TopExp_Explorer e(geom.GetShape(), TopAbs_SOLID); e.More(); e.Next(), dom++)
{
maxhdom[dom] = min2(maxhdom[dom], OCCGeometry::global_shape_properties[e.Current().TShape()].maxh);
maxlayer = max2(maxlayer, OCCGeometry::global_shape_properties[e.Current().TShape()].layer);
maxhdom[dom] = min2(maxhdom[dom], OCCGeometry::global_shape_properties[e.Current()].maxh);
maxlayer = max2(maxlayer, OCCGeometry::global_shape_properties[e.Current()].layer);
}
@ -519,7 +518,7 @@ namespace netgen
for (int i = 1; i <= nedges && !multithread.terminate; i++)
{
TopoDS_Edge e = TopoDS::Edge (geom.emap(i));
int layer = OCCGeometry::global_shape_properties[e.TShape()].layer;
int layer = OCCGeometry::global_shape_properties[e].layer;
multithread.percent = 100 * (i-1)/double(nedges);
if (BRep_Tool::Degenerated(e)) continue;
@ -535,7 +534,7 @@ namespace netgen
bool is_identified_edge = false;
// TODO: change to use hash value
const auto& gedge = geom.GetEdge(geom.edge_map.at(e.TShape()));
const auto& gedge = geom.GetEdge(geom.edge_map.at(e));
auto& v0 = gedge.GetStartVertex();
auto& v1 = gedge.GetEndVertex();
for(auto & ident : v0.identifications)
@ -565,12 +564,12 @@ namespace netgen
int face_index = geom.fmap.FindIndex(parent_face);
if(face_index >= 1) localh = min(localh,geom.face_maxh[face_index - 1]);
localh = min2(localh, OCCGeometry::global_shape_properties[parent_face.TShape()].maxh);
localh = min2(localh, OCCGeometry::global_shape_properties[parent_face].maxh);
}
Handle(Geom_Curve) c = BRep_Tool::Curve(e, s0, s1);
localh = min2(localh, OCCGeometry::global_shape_properties[e.TShape()].maxh);
localh = min2(localh, OCCGeometry::global_shape_properties[e].maxh);
maxedgelen = max (maxedgelen, len);
minedgelen = min (minedgelen, len);
int maxj = max((int) ceil(len/localh), 2);
@ -593,7 +592,7 @@ namespace netgen
double maxcur = 0;
multithread.percent = 100 * (i-1)/double(nedges);
TopoDS_Edge edge = TopoDS::Edge (geom.emap(i));
int layer = OCCGeometry::global_shape_properties[edge.TShape()].layer;
int layer = OCCGeometry::global_shape_properties[edge].layer;
if (BRep_Tool::Degenerated(edge)) continue;
double s0, s1;
Handle(Geom_Curve) c = BRep_Tool::Curve(edge, s0, s1);
@ -628,7 +627,7 @@ namespace netgen
{
multithread.percent = 100 * (i-1)/double(nfaces);
TopoDS_Face face = TopoDS::Face(geom.fmap(i));
int layer = OCCGeometry::global_shape_properties[face.TShape()].layer;
int layer = OCCGeometry::global_shape_properties[face].layer;
TopLoc_Location loc;
Handle(Geom_Surface) surf = BRep_Tool::Surface (face);
Handle(Poly_Triangulation) triangulation = BRep_Tool::Triangulation (face, loc);
@ -694,7 +693,7 @@ namespace netgen
for (int i = 1; i <= nedges && !multithread.terminate; i++)
{
TopoDS_Edge edge = TopoDS::Edge (geom.emap(i));
int layer = OCCGeometry::global_shape_properties[edge.TShape()].layer;
int layer = OCCGeometry::global_shape_properties[edge].layer;
if (BRep_Tool::Degenerated(edge)) continue;
double s0, s1;

View File

@ -71,8 +71,8 @@ namespace netgen
void LoadOCCInto(OCCGeometry* occgeo, const filesystem::path & filename);
void PrintContents (OCCGeometry * geom);
std::map<Handle(TopoDS_TShape), ShapeProperties> OCCGeometry::global_shape_properties;
std::map<Handle(TopoDS_TShape), std::vector<OCCIdentification>> OCCGeometry::identifications;
std::map<TopoDS_Shape, ShapeProperties> OCCGeometry::global_shape_properties;
std::map<TopoDS_Shape, std::vector<OCCIdentification>> OCCGeometry::identifications;
TopoDS_Shape ListOfShapes::Max(gp_Vec dir)
{
@ -125,7 +125,7 @@ namespace netgen
ListOfShapes ListOfShapes::SubShapes(TopAbs_ShapeEnum type) const
{
std::set<TopoDS_Shape, ShapeLess> unique_shapes;
std::set<TopoDS_Shape> unique_shapes;
for(const auto& shape : *this)
for(TopExp_Explorer e(shape, type); e.More(); e.Next())
unique_shapes.insert(e.Current());
@ -200,7 +200,7 @@ namespace netgen
{
MeshingParameters local_mp = mparam;
auto face = TopoDS::Face(fmap(nr+1));
if(auto quad_dominated = OCCGeometry::global_shape_properties[face.TShape()].quad_dominated; quad_dominated.has_value())
if(auto quad_dominated = OCCGeometry::global_shape_properties[face].quad_dominated; quad_dominated.has_value())
local_mp.quad = *quad_dominated;
bool failed = OCCMeshFace(*this, mesh, glob2loc, local_mp, nr, PARAMETERSPACE, true);
@ -376,9 +376,9 @@ namespace netgen
for (TopExp_Explorer e(shape, TopAbs_SOLID); e.More(); e.Next())
{
if (auto name = OCCGeometry::global_shape_properties[e.Current().TShape()].name)
if (auto name = OCCGeometry::global_shape_properties[e.Current()].name)
for (auto mods : history->Modified(e.Current()))
OCCGeometry::global_shape_properties[mods.TShape()].name = *name;
OCCGeometry::global_shape_properties[mods].name = *name;
}
#endif // OCC_HAVE_HISTORY
@ -444,7 +444,7 @@ namespace netgen
for (exp0.Init (shape, TopAbs_FACE); exp0.More(); exp0.Next())
{
TopoDS_Face face = TopoDS::Face (exp0.Current());
auto props = global_shape_properties[face.TShape()];
auto props = global_shape_properties[face];
sff = new ShapeFix_Face (face);
sff->FixAddNaturalBoundMode() = Standard_True;
@ -475,7 +475,7 @@ namespace netgen
// Set the original properties of the face to the newly created
// face (after the healing process)
global_shape_properties[face.TShape()];
global_shape_properties[face];
}
shape = rebuild->Apply(shape);
}
@ -1122,54 +1122,51 @@ namespace netgen
for(auto i1 : Range(1, vmap.Extent()+1))
{
auto v = vmap(i1);
auto tshape = v.TShape();
if(vertex_map.count(tshape)!=0)
if(vertex_map.count(v)!=0)
continue;
auto occ_vertex = make_unique<OCCVertex>(TopoDS::Vertex(v));
occ_vertex->nr = vertices.Size();
vertex_map[tshape] = occ_vertex->nr;
vertex_map[v] = occ_vertex->nr;
if(global_shape_properties.count(tshape)>0)
occ_vertex->properties = global_shape_properties[tshape];
if(global_shape_properties.count(v)>0)
occ_vertex->properties = global_shape_properties[v];
vertices.Append(std::move(occ_vertex));
}
for(auto i1 : Range(1, emap.Extent()+1))
{
auto e = emap(i1);
auto tshape = e.TShape();
auto edge = TopoDS::Edge(e);
if(edge_map.count(tshape)!=0)
if(edge_map.count(e)!=0)
continue;
edge_map[tshape] = edges.Size();
edge_map[e] = edges.Size();
auto verts = GetVertices(e);
auto occ_edge = make_unique<OCCEdge>(edge, *vertices[vertex_map[verts[0].TShape()]], *vertices[vertex_map[verts[1].TShape()]] );
occ_edge->properties = global_shape_properties[tshape];
auto occ_edge = make_unique<OCCEdge>(edge, *vertices[vertex_map[verts[0]]], *vertices[vertex_map[verts[1]]] );
occ_edge->properties = global_shape_properties[e];
edges.Append(std::move(occ_edge));
}
for(auto i1 : Range(1, fmap.Extent()+1))
{
auto f = fmap(i1);
auto tshape = f.TShape();
if(face_map.count(tshape)==0)
if(face_map.count(f)==0)
{
auto k = faces.Size();
face_map[tshape] = k;
face_map[f] = k;
auto occ_face = make_unique<OCCFace>(f);
for(auto e : GetEdges(f))
occ_face->edges.Append( edges[edge_map[e.TShape()]].get() );
occ_face->edges.Append( edges[edge_map[e]].get() );
if(global_shape_properties.count(tshape)>0)
occ_face->properties = global_shape_properties[tshape];
if(global_shape_properties.count(f)>0)
occ_face->properties = global_shape_properties[f];
faces.Append(std::move(occ_face));
if(dimension==2)
for(auto e : GetEdges(f))
{
auto & edge = *edges[edge_map[e.TShape()]];
auto & edge = *edges[edge_map[e]];
if(e.Orientation() == TopAbs_REVERSED)
edge.domout = k;
else
@ -1182,21 +1179,20 @@ namespace netgen
for(auto i1 : Range(1, somap.Extent()+1))
{
auto s = somap(i1);
auto tshape = s.TShape();
int k;
if(solid_map.count(tshape)==0)
if(solid_map.count(s)==0)
{
k = solids.Size();
solid_map[tshape] = k;
solid_map[s] = k;
auto occ_solid = make_unique<OCCSolid>(s);
if(global_shape_properties.count(tshape)>0)
occ_solid->properties = global_shape_properties[tshape];
if(global_shape_properties.count(s)>0)
occ_solid->properties = global_shape_properties[s];
solids.Append(std::move(occ_solid));
}
for(auto f : GetFaces(s))
{
auto face_nr = face_map[f.TShape()];
auto face_nr = face_map[f];
auto & face = faces[face_nr];
if(face->domin==-1)
face->domin = k;
@ -1208,9 +1204,9 @@ namespace netgen
// Add identifications
auto add_identifications = [&](auto & shapes, auto & shape_map)
{
for(auto &[tshape, nr] : shape_map)
if(identifications.count(tshape))
for(auto & ident : identifications[tshape])
for(auto &[shape, nr] : shape_map)
if(identifications.count(shape))
for(auto & ident : identifications[shape])
{
if(shape_map.count(ident.from)==0 || shape_map.count(ident.to)==0)
continue;
@ -1321,7 +1317,7 @@ namespace netgen
Array<GeometryVertex*> verts;
const auto& occface = dynamic_cast<const OCCFace&>(face);
for(auto& vert : GetVertices(occface.Shape()))
verts.Append(vertices[vertex_map.at(vert.TShape())].get());
verts.Append(vertices[vertex_map.at(vert)].get());
return move(verts);
}
@ -1615,34 +1611,33 @@ namespace netgen
auto occ_hash = key.HashCode(1<<31UL);
return std::hash<decltype(occ_hash)>()(occ_hash);
};
std::map<Handle(TopoDS_TShape), int> tshape_map;
Array<Handle(TopoDS_TShape)> tshape_list;
std::map<TopoDS_Shape, int> shape_map;
Array<TopoDS_Shape> shape_list;
ar & dimension;
for (auto typ : { TopAbs_SOLID, TopAbs_FACE, TopAbs_EDGE })
for (TopExp_Explorer e(shape, typ); e.More(); e.Next())
{
auto ds = e.Current();
auto ts = ds.TShape();
if(tshape_map.count(ts)==0)
if(shape_map.count(ds)==0)
{
tshape_map[ts] = tshape_list.Size();
tshape_list.Append(ts);
shape_map[ds] = shape_list.Size();
shape_list.Append(ds);
}
}
for (auto ts : tshape_list)
for (auto s : shape_list)
{
bool has_properties = global_shape_properties.count(ts);
bool has_properties = global_shape_properties.count(s);
ar & has_properties;
if(has_properties)
ar & global_shape_properties[ts];
ar & global_shape_properties[s];
bool has_identifications = identifications.count(ts);
bool has_identifications = identifications.count(s);
ar & has_identifications;
if(has_identifications)
{
auto & idents = identifications[ts];
auto & idents = identifications[s];
auto n_idents = idents.size();
ar & n_idents;
idents.resize(n_idents);
@ -1652,14 +1647,14 @@ namespace netgen
int id_from, id_to;
if(ar.Output())
{
id_from = tshape_map[id.from];
id_to = tshape_map[id.to];
id_from = shape_map[id.from];
id_to = shape_map[id.to];
}
ar & id_from & id_to & id.trafo & id.name;
if(ar.Input())
{
id.from = tshape_list[id_from];
id.to = tshape_list[id_to];
id.from = shape_list[id_from];
id.to = shape_list[id_to];
}
}
}
@ -1981,7 +1976,7 @@ namespace netgen
if(tree.GetTolerance() < Dist(trafo(c_me), c_you))
return false;
std::map<T_Shape, T_Shape> vmap;
std::map<TopoDS_Shape, optional<TopoDS_Shape>> vmap;
auto verts_me = GetVertices(me);
auto verts_you = GetVertices(you);
@ -1991,21 +1986,21 @@ namespace netgen
for (auto i : Range(verts_me.size()))
{
auto s = verts_me[i].TShape();
auto s = verts_me[i];
if(vmap.count(s)>0)
continue;
auto p = trafo(occ2ng(s));
tree.Insert( p, i );
vmap[s] = nullptr;
vmap[s] = nullopt;
}
for (auto vert : verts_you)
{
auto s = vert.TShape();
auto s = vert;
auto p = occ2ng(s);
bool vert_mapped = false;
tree.GetFirstIntersecting( p, p, [&](size_t i ) {
vmap[verts_me[i].TShape()] = s;
vmap[verts_me[i]] = s;
vert_mapped = true;
return true;
});
@ -2061,8 +2056,8 @@ namespace netgen
if(!IsMappedShape(trafo, shape_me, shape_you))
continue;
OCCGeometry::identifications[shape_me.TShape()].push_back
(OCCIdentification { shape_me.TShape(), shape_you.TShape(), trafo, name, type });
OCCGeometry::identifications[shape_me].push_back
(OCCIdentification { shape_me, shape_you, trafo, name, type });
}
}
@ -2124,7 +2119,7 @@ namespace netgen
XCAFPrs_Style aStyle;
set.FindFromKey(e.Current(), aStyle);
auto & prop = OCCGeometry::global_shape_properties[e.Current().TShape()];
auto & prop = OCCGeometry::global_shape_properties[e.Current()];
if(aStyle.IsSetColorSurf())
prop.col = step_utils::ReadColor(aStyle.GetColorSurfRGBA());
}
@ -2144,7 +2139,7 @@ namespace netgen
if (!transProc->IsBound(item))
continue;
OCCGeometry::global_shape_properties[shape.TShape()].name = name;
OCCGeometry::global_shape_properties[shape].name = name;
}
@ -2168,7 +2163,7 @@ namespace netgen
if(name != "netgen_geometry_properties")
continue;
auto & prop = OCCGeometry::global_shape_properties[shape.TShape()];
auto & prop = OCCGeometry::global_shape_properties[shape];
auto nprops = item->NbItemElement();
@ -2194,7 +2189,7 @@ namespace netgen
Handle(StepRepr_RepresentationItem) item = STEPConstruct::FindEntity(finder, shape);
if(!item)
return;
auto prop = OCCGeometry::global_shape_properties[shape.TShape()];
auto prop = OCCGeometry::global_shape_properties[shape];
if(auto n = prop.name)
item->SetName(MakeName(*n));
@ -2223,7 +2218,7 @@ namespace netgen
void WriteIdentifications(const Handle(Interface_InterfaceModel) model, const TopoDS_Shape & shape, const Handle(Transfer_FinderProcess) finder)
{
Handle(StepRepr_RepresentationItem) item = STEPConstruct::FindEntity(finder, shape);
auto & identifications = OCCGeometry::identifications[shape.TShape()];
auto & identifications = OCCGeometry::identifications[shape];
if(identifications.size()==0)
return;
auto n = identifications.size();
@ -2274,7 +2269,7 @@ namespace netgen
result.push_back(ident);
}
OCCGeometry::identifications[shape_origin.TShape()] = result;
OCCGeometry::identifications[shape_origin] = result;
}
void WriteSTEP(const TopoDS_Shape & shape, const filesystem::path & filename)
@ -2298,7 +2293,7 @@ namespace netgen
for (auto typ : { TopAbs_SOLID, TopAbs_FACE, TopAbs_EDGE })
for (TopExp_Explorer e(shape, typ); e.More(); e.Next())
{
auto prop = OCCGeometry::global_shape_properties[e.Current().TShape()];
auto prop = OCCGeometry::global_shape_properties[e.Current()];
if(auto col = prop.col)
colortool->SetColor(e.Current(), step_utils::MakeColor(*col), XCAFDoc_ColorGen);
}

View File

@ -31,6 +31,20 @@
#define OCC_HAVE_HISTORY
#endif
namespace std
{
template<>
struct less<TopoDS_Shape>
{
bool operator() (const TopoDS_Shape& s1, const TopoDS_Shape& s2) const
{
return s1.HashCode(std::numeric_limits<Standard_Integer>::max()) <
s2.HashCode(std::numeric_limits<Standard_Integer>::max());
}
};
}
namespace netgen
{
@ -135,15 +149,15 @@ namespace netgen
Point<3> center;
OCCParameters occparam;
public:
static std::map<T_Shape, ShapeProperties> global_shape_properties;
static std::map<T_Shape, std::vector<OCCIdentification>> identifications;
static std::map<TopoDS_Shape, ShapeProperties> global_shape_properties;
static std::map<TopoDS_Shape, std::vector<OCCIdentification>> identifications;
TopoDS_Shape shape;
TopTools_IndexedMapOfShape fmap, emap, vmap, somap, shmap, wmap; // legacy maps
NgArray<bool> fsingular, esingular, vsingular;
Box<3> boundingbox;
std::map<T_Shape, int> edge_map, vertex_map, face_map, solid_map;
std::map<TopoDS_Shape, int> solid_map, face_map, edge_map, vertex_map;
mutable int changed;
mutable NgArray<int> facemeshstatus;
@ -376,8 +390,8 @@ namespace netgen
template <class TBuilder>
void PropagateIdentifications (TBuilder & builder, TopoDS_Shape shape, std::optional<Transformation<3>> trafo = nullopt)
{
std::map<T_Shape, std::set<T_Shape>> mod_map;
std::map<T_Shape, bool> tshape_handled;
std::map<TopoDS_Shape, std::set<TopoDS_Shape>> mod_map;
std::map<TopoDS_Shape, bool> shape_handled;
Transformation<3> trafo_inv;
if(trafo)
trafo_inv = trafo->CalcInverse();
@ -385,35 +399,34 @@ namespace netgen
for (auto typ : { TopAbs_SOLID, TopAbs_FACE, TopAbs_EDGE, TopAbs_VERTEX })
for (TopExp_Explorer e(shape, typ); e.More(); e.Next())
{
auto tshape = e.Current().TShape();
mod_map[tshape].insert(tshape);
tshape_handled[tshape] = false;
auto s = e.Current();
mod_map[s].insert(s);
shape_handled[s] = false;
}
for (auto typ : { TopAbs_SOLID, TopAbs_FACE, TopAbs_EDGE, TopAbs_VERTEX })
for (TopExp_Explorer e(shape, typ); e.More(); e.Next())
{
auto tshape = e.Current().TShape();
auto s = e.Current();
for (auto mods : builder.Modified(e.Current()))
mod_map[tshape].insert(mods.TShape());
mod_map[s].insert(mods);
}
for (auto typ : { TopAbs_SOLID, TopAbs_FACE, TopAbs_EDGE, TopAbs_VERTEX })
for (TopExp_Explorer e(shape, typ); e.More(); e.Next())
{
auto tshape = e.Current().TShape();
auto s = e.Current();
if(tshape_handled[tshape])
if(shape_handled[s])
continue;
tshape_handled[tshape] = true;
shape_handled[s] = true;
if(OCCGeometry::identifications.count(tshape)==0)
if(OCCGeometry::identifications.count(s)==0)
continue;
auto tshape_mapped = mod_map[tshape];
auto shape_mapped = mod_map[s];
for(auto ident : OCCGeometry::identifications[tshape])
for(auto ident : OCCGeometry::identifications[s])
{
// nothing happened
if(mod_map[ident.to].size()==1 && mod_map[ident.from].size() ==1)
@ -428,9 +441,6 @@ namespace netgen
if(from==from_mapped && to==to_mapped)
continue;
TopoDS_Shape s_from; s_from.TShape(from_mapped);
TopoDS_Shape s_to; s_to.TShape(to_mapped);
Transformation<3> trafo_mapped = ident.trafo;
if(trafo)
{
@ -439,14 +449,14 @@ namespace netgen
trafo_mapped.Combine(*trafo, trafo_temp);
}
if(!IsMappedShape(trafo_mapped, s_from, s_to))
if(!IsMappedShape(trafo_mapped, from_mapped, to_mapped))
continue;
OCCIdentification id_new = ident;
id_new.to = to_mapped;
id_new.from = from_mapped;
id_new.trafo = trafo_mapped;
auto id_owner = from == tshape ? from_mapped : to_mapped;
auto id_owner = from == s ? from_mapped : to_mapped;
OCCGeometry::identifications[id_owner].push_back(id_new);
}
}
@ -461,11 +471,11 @@ namespace netgen
for (auto typ : { TopAbs_SOLID, TopAbs_FACE, TopAbs_EDGE })
for (TopExp_Explorer e(shape, typ); e.More(); e.Next())
{
auto tshape = e.Current().TShape();
auto & prop = OCCGeometry::global_shape_properties[tshape];
for (auto mods : builder.Modified(e.Current()))
OCCGeometry::global_shape_properties[mods.TShape()].Merge(prop);
have_identifications |= OCCGeometry::identifications.count(tshape) > 0;
auto s = e.Current();
auto & prop = OCCGeometry::global_shape_properties[s];
for (auto mods : builder.Modified(s))
OCCGeometry::global_shape_properties[mods].Merge(prop);
have_identifications |= OCCGeometry::identifications.count(s) > 0;
}
if(have_identifications)
PropagateIdentifications(builder, shape, trafo);

View File

@ -118,11 +118,11 @@ DLL_HEADER void ExportNgOCC(py::module &m)
for (auto & s : shapes)
for (TopExp_Explorer e(s, TopAbs_SOLID); e.More(); e.Next())
if (auto name = OCCGeometry::global_shape_properties[e.Current().TShape()].name)
if (auto name = OCCGeometry::global_shape_properties[e.Current()].name)
{
TopTools_ListOfShape modlist = history->Modified(e.Current());
for (auto mods : modlist)
OCCGeometry::global_shape_properties[mods.TShape()].name = *name;
OCCGeometry::global_shape_properties[mods].name = *name;
}
#endif // OCC_HAVE_HISTORY
@ -323,8 +323,6 @@ DLL_HEADER void ExportNgOCC(py::module &m)
Handle(XCAFDoc_MaterialTool) material_tool = XCAFDoc_DocumentTool::MaterialTool(doc->Main());
// Handle(XCAFDoc_VisMaterialTool) vismaterial_tool = XCAFDoc_DocumentTool::VisMaterialTool(doc->Main());
cout << "handle(shape) = " << *(void**)(void*)(&(shape.TShape())) << endl;
// TDF_LabelSequence doc_shapes;
// shape_tool->GetShapes(doc_shapes);
// cout << "shape tool nbentities: " << doc_shapes.Size() << endl;

View File

@ -304,7 +304,7 @@ public:
// auto edge = BRepBuilderAPI_MakeEdge(curve).Edge();
if (name)
OCCGeometry::global_shape_properties[edge.TShape()].name = name;
OCCGeometry::global_shape_properties[edge].name = name;
wire_builder.Add(edge);
if (closing) Finish();
@ -591,7 +591,7 @@ public:
auto NameVertex (string name)
{
if (!lastvertex.IsNull())
OCCGeometry::global_shape_properties[lastvertex.TShape()].name = name;
OCCGeometry::global_shape_properties[lastvertex].name = name;
return shared_from_this();
}
@ -822,37 +822,37 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
.def("bc", [](const TopoDS_Shape & shape, const string & name)
{
for (TopExp_Explorer e(shape, TopAbs_FACE); e.More(); e.Next())
OCCGeometry::global_shape_properties[e.Current().TShape()].name = name;
OCCGeometry::global_shape_properties[e.Current()].name = name;
return shape;
}, py::arg("name"), "sets 'name' property for all faces of shape")
.def("mat", [](const TopoDS_Shape & shape, const string & name)
{
for (TopExp_Explorer e(shape, TopAbs_SOLID); e.More(); e.Next())
OCCGeometry::global_shape_properties[e.Current().TShape()].name = name;
OCCGeometry::global_shape_properties[e.Current()].name = name;
return shape;
}, py::arg("name"), "sets 'name' property to all solids of shape")
.def_property("name", [](const TopoDS_Shape & self) -> optional<string> {
if (auto name = OCCGeometry::global_shape_properties[self.TShape()].name)
if (auto name = OCCGeometry::global_shape_properties[self].name)
return *name;
else
return nullopt;
}, [](const TopoDS_Shape & self, optional<string> name) {
OCCGeometry::global_shape_properties[self.TShape()].name = name;
OCCGeometry::global_shape_properties[self].name = name;
}, "'name' of shape")
.def_property("maxh",
[](const TopoDS_Shape& self)
{
return OCCGeometry::global_shape_properties[self.TShape()].maxh;
return OCCGeometry::global_shape_properties[self].maxh;
},
[](TopoDS_Shape& self, double val)
{
for (auto typ : { TopAbs_SOLID, TopAbs_FACE, TopAbs_EDGE, TopAbs_VERTEX })
for (TopExp_Explorer e(self, typ); e.More(); e.Next())
{
auto & maxh = OCCGeometry::global_shape_properties[e.Current().TShape()].maxh;
auto & maxh = OCCGeometry::global_shape_properties[e.Current()].maxh;
maxh = min2(val, maxh);
}
}, "maximal mesh-size for shape")
@ -860,16 +860,16 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
.def_property("hpref",
[](const TopoDS_Shape& self)
{
return OCCGeometry::global_shape_properties[self.TShape()].hpref;
return OCCGeometry::global_shape_properties[self].hpref;
},
[](TopoDS_Shape& self, double val)
{
auto & hpref = OCCGeometry::global_shape_properties[self.TShape()].hpref;
auto & hpref = OCCGeometry::global_shape_properties[self].hpref;
hpref = max2(val, hpref);
}, "number of refinement levels for geometric refinement")
.def_property("col", [](const TopoDS_Shape & self) {
auto it = OCCGeometry::global_shape_properties.find(self.TShape());
auto it = OCCGeometry::global_shape_properties.find(self);
Vec<4> col(0.2, 0.2, 0.2);
if (it != OCCGeometry::global_shape_properties.end() && it->second.col)
col = *it->second.col;
@ -878,7 +878,7 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
Vec<4> col(c[0], c[1], c[2], 1.0);
if(c.size() == 4)
col[3] = c[3];
OCCGeometry::global_shape_properties[self.TShape()].col = col;
OCCGeometry::global_shape_properties[self].col = col;
}, "color of shape as RGB - tuple")
.def("UnifySameDomain", [](const TopoDS_Shape& shape,
bool edges, bool faces,
@ -891,9 +891,9 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
for (auto typ : { TopAbs_SOLID, TopAbs_FACE, TopAbs_EDGE })
for (TopExp_Explorer e(shape, typ); e.More(); e.Next())
{
auto prop = OCCGeometry::global_shape_properties[e.Current().TShape()];
auto prop = OCCGeometry::global_shape_properties[e.Current()];
for (auto mods : history->Modified(e.Current()))
OCCGeometry::global_shape_properties[mods.TShape()].Merge(prop);
OCCGeometry::global_shape_properties[mods].Merge(prop);
}
return unify.Shape();
}, py::arg("unifyEdges")=true, py::arg("unifyFaces")=true,
@ -919,9 +919,9 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
for (auto & s : { shape1, shape2 })
for (TopExp_Explorer e(s, typ); e.More(); e.Next())
{
auto prop = OCCGeometry::global_shape_properties[e.Current().TShape()];
auto prop = OCCGeometry::global_shape_properties[e.Current()];
for (auto mods : history->Modified(e.Current()))
OCCGeometry::global_shape_properties[mods.TShape()].Merge(prop);
OCCGeometry::global_shape_properties[mods].Merge(prop);
}
#endif
*/
@ -945,9 +945,9 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
for (auto typ : { TopAbs_SOLID, TopAbs_FACE, TopAbs_EDGE })
for (TopExp_Explorer e(fused, typ); e.More(); e.Next())
{
auto prop = OCCGeometry::global_shape_properties[e.Current().TShape()];
auto prop = OCCGeometry::global_shape_properties[e.Current()];
for (auto mods : history->Modified(e.Current()))
OCCGeometry::global_shape_properties[mods.TShape()].Merge(prop);
OCCGeometry::global_shape_properties[mods].Merge(prop);
}
// #endif
// PropagateProperties (unify, fused);
@ -971,9 +971,9 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
for (auto & s : { shape1, shape2 })
for (TopExp_Explorer e(s, typ); e.More(); e.Next())
{
auto prop = OCCGeometry::global_shape_properties[e.Current().TShape()];
auto prop = OCCGeometry::global_shape_properties[e.Current()];
for (auto mods : history->Modified(e.Current()))
OCCGeometry::global_shape_properties[mods.TShape()].Merge(prop);
OCCGeometry::global_shape_properties[mods].Merge(prop);
}
#endif // OCC_HAVE_HISTORY
*/
@ -994,9 +994,9 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
for (auto & s : { shape1, shape2 })
for (TopExp_Explorer e(s, typ); e.More(); e.Next())
{
auto prop = OCCGeometry::global_shape_properties[e.Current().TShape()];
auto prop = OCCGeometry::global_shape_properties[e.Current()];
for (auto mods : history->Modified(e.Current()))
OCCGeometry::global_shape_properties[mods.TShape()].Merge(prop);
OCCGeometry::global_shape_properties[mods].Merge(prop);
}
#endif // OCC_HAVE_HISTORY
*/
@ -1005,6 +1005,12 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
return builder.Shape();
}, "cut of shapes")
.def("__eq__", [] (const TopoDS_Shape& shape1, const TopoDS_Shape& shape2) {
return shape1.IsSame(shape2);
})
.def("__hash__", [] (const TopoDS_Shape& shape) {
return shape.HashCode(std::numeric_limits<Standard_Integer>::max());
})
.def("Reversed", [](const TopoDS_Shape & shape) {
return CastShape(shape.Reversed()); })
@ -1029,9 +1035,9 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
for (auto typ : { TopAbs_SOLID, TopAbs_FACE, TopAbs_EDGE, TopAbs_VERTEX })
for (TopExp_Explorer e(shape, typ); e.More(); e.Next())
{
auto prop = OCCGeometry::global_shape_properties[e.Current().TShape()];
auto prop = OCCGeometry::global_shape_properties[e.Current()];
for (auto mods : builder.Generated(e.Current()))
OCCGeometry::global_shape_properties[mods.TShape()].Merge(prop);
OCCGeometry::global_shape_properties[mods].Merge(prop);
}
return builder.Shape();
@ -1052,9 +1058,9 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
for (auto typ : { TopAbs_EDGE, TopAbs_VERTEX })
for (TopExp_Explorer e(shape, typ); e.More(); e.Next())
{
auto prop = OCCGeometry::global_shape_properties[e.Current().TShape()];
auto prop = OCCGeometry::global_shape_properties[e.Current()];
for (auto mods : builder.Generated(e.Current()))
OCCGeometry::global_shape_properties[mods.TShape()].Merge(prop);
OCCGeometry::global_shape_properties[mods].Merge(prop);
}
return builder.Shape();
@ -1070,7 +1076,7 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
PropagateProperties (mkFillet, shape);
for (auto e : edges)
for (auto gen : mkFillet.Generated(e))
OCCGeometry::global_shape_properties[gen.TShape()].name = "fillet";
OCCGeometry::global_shape_properties[gen].name = "fillet";
return mkFillet.Shape();
}, py::arg("edges"), py::arg("r"), "make fillets for edges 'edges' of radius 'r'")
@ -1083,7 +1089,7 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
PropagateProperties (mkChamfer, shape);
for (auto e : edges)
for (auto gen : mkChamfer.Generated(e))
OCCGeometry::global_shape_properties[gen.TShape()].name = "chamfer";
OCCGeometry::global_shape_properties[gen].name = "chamfer";
return mkChamfer.Shape();
#else
throw Exception("MakeChamfer not available for occ-version < 7.4");
@ -1191,7 +1197,7 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
// Handle(TopoDS_Face) face = e.Current();
fmap.Add(face);
ExtractFaceData(face, index, p, n, box);
auto & props = OCCGeometry::global_shape_properties[face.TShape()];
auto & props = OCCGeometry::global_shape_properties[face];
if(props.col)
{
auto & c = *props.col;
@ -1214,7 +1220,7 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
for(auto& face : GetFaces(solid))
faces.push_back(fmap.FindIndex(face)-1);
solid_face_map.push_back(move(faces));
auto& props = OCCGeometry::global_shape_properties[solid.TShape()];
auto& props = OCCGeometry::global_shape_properties[solid];
if(props.name)
solid_names.append(*props.name);
else
@ -1228,7 +1234,7 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
{
TopoDS_Edge edge = TopoDS::Edge(e.Current());
ExtractEdgeData(edge, index, edge_p, box);
auto & props = OCCGeometry::global_shape_properties[edge.TShape()];
auto & props = OCCGeometry::global_shape_properties[edge];
if(props.col)
{
auto & c = *props.col;
@ -1456,11 +1462,11 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
}))
.def_property("quad_dominated", [](const TopoDS_Face& self) -> optional<bool>
{
return OCCGeometry::global_shape_properties[self.TShape()].quad_dominated;
return OCCGeometry::global_shape_properties[self].quad_dominated;
},
[](TopoDS_Face& self, optional<bool> quad_dominated)
{
OCCGeometry::global_shape_properties[self.TShape()].quad_dominated = quad_dominated;
OCCGeometry::global_shape_properties[self].quad_dominated = quad_dominated;
})
.def_property_readonly("surf", [] (TopoDS_Face face) -> Handle(Geom_Surface)
{
@ -1511,13 +1517,13 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
{
auto & props = OCCGeometry::global_shape_properties;
for(auto & s : GetSolids(shapes[i]))
props[s.TShape()].layer = i+1;
props[s].layer = i+1;
for(auto & s : GetFaces(shapes[i]))
props[s.TShape()].layer = i+1;
props[s].layer = i+1;
for(auto & s : GetEdges(shapes[i]))
props[s.TShape()].layer = i+1;
props[s].layer = i+1;
for(auto & s : GetVertices(shapes[i]))
props[s.TShape()].layer = i+1;
props[s].layer = i+1;
}
}
@ -1599,7 +1605,7 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
ListOfShapes selected;
std::regex pattern(name);
for (auto s : self)
if (auto sname = OCCGeometry::global_shape_properties[s.TShape()].name)
if (auto sname = OCCGeometry::global_shape_properties[s].name)
if (std::regex_match(*sname, pattern))
selected.push_back(s);
return selected;
@ -1622,7 +1628,7 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
.def("Sorted",[](ListOfShapes self, gp_Vec dir)
{
std::map<Handle(TopoDS_TShape), double> sortval;
std::map<TopoDS_Shape, double> sortval;
for (auto shape : self)
{
GProp_GProps props;
@ -1642,12 +1648,12 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
}
double val = center.X()*dir.X() + center.Y()*dir.Y() + center.Z() * dir.Z();
sortval[shape.TShape()] = val;
sortval[shape] = val;
}
std::sort (std::begin(self), std::end(self),
[&](TopoDS_Shape a, TopoDS_Shape b)
{ return sortval[a.TShape()] < sortval[b.TShape()]; });
[&](const TopoDS_Shape& a, const TopoDS_Shape& b)
{ return sortval[a] < sortval[b]; });
return self;
}, py::arg("dir"), "returns list of shapes, where center of gravity is sorted in direction of 'dir'")
@ -1674,7 +1680,7 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
{
for(auto& shape : shapes)
{
OCCGeometry::global_shape_properties[shape.TShape()].name = name;
OCCGeometry::global_shape_properties[shape].name = name;
}
}, "set name for all elements of list")
.def_property("col", [](ListOfShapes& shapes) {
@ -1684,7 +1690,7 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
if(c.size() == 4)
col[3] = c[3];
for(auto& shape : shapes)
OCCGeometry::global_shape_properties[shape.TShape()].col = col;
OCCGeometry::global_shape_properties[shape].col = col;
}, "set col for all elements of list")
.def_property("maxh", [](ListOfShapes& shapes)
@ -1696,13 +1702,13 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
for(auto& shape : shapes)
{
for(auto& s : GetSolids(shape))
OCCGeometry::global_shape_properties[s.TShape()].maxh = maxh;
OCCGeometry::global_shape_properties[s].maxh = maxh;
for(auto& s : GetFaces(shape))
OCCGeometry::global_shape_properties[s.TShape()].maxh = maxh;
OCCGeometry::global_shape_properties[s].maxh = maxh;
for(auto& s : GetEdges(shape))
OCCGeometry::global_shape_properties[s.TShape()].maxh = maxh;
OCCGeometry::global_shape_properties[s].maxh = maxh;
for(auto& s : GetVertices(shape))
OCCGeometry::global_shape_properties[s.TShape()].maxh = maxh;
OCCGeometry::global_shape_properties[s].maxh = maxh;
}
}, "set maxh for all elements of list")
.def_property("hpref", [](ListOfShapes& shapes)
@ -1713,7 +1719,7 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
{
for(auto& shape : shapes)
{
auto& val = OCCGeometry::global_shape_properties[shape.TShape()].hpref;
auto& val = OCCGeometry::global_shape_properties[shape].hpref;
val = max2(hpref, val);
}
}, "set hpref for all elements of list")
@ -1724,7 +1730,7 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
[](ListOfShapes& shapes, optional<bool> quad_dominated)
{
for(auto& shape : shapes)
OCCGeometry::global_shape_properties[shape.TShape()].quad_dominated = quad_dominated;
OCCGeometry::global_shape_properties[shape].quad_dominated = quad_dominated;
})
.def("Identify", [](const ListOfShapes& me,
@ -1822,7 +1828,7 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
optional<string> bot, optional<string> top, optional<string> mantle) {
auto builder = BRepPrimAPI_MakeCylinder (gp_Ax2(cpnt, cdir), r, h);
if(mantle)
OCCGeometry::global_shape_properties[builder.Face().TShape()].name = *mantle;
OCCGeometry::global_shape_properties[builder.Face()].name = *mantle;
auto pyshape = py::cast(builder.Solid());
gp_Vec v = cdir;
if(bot)
@ -2073,9 +2079,9 @@ tangents : Dict[int, gp_Vec2d]
for (auto & s : shapes)
for (TopExp_Explorer e(s, typ); e.More(); e.Next())
{
auto prop = OCCGeometry::global_shape_properties[e.Current().TShape()];
auto prop = OCCGeometry::global_shape_properties[e.Current()];
for (auto mods : history->Modified(e.Current()))
OCCGeometry::global_shape_properties[mods.TShape()].Merge(prop);
OCCGeometry::global_shape_properties[mods].Merge(prop);
}
#endif // OCC_HAVE_HISTORY
*/
@ -2104,9 +2110,9 @@ tangents : Dict[int, gp_Vec2d]
for (TopExp_Explorer e(shape, TopAbs_SOLID); e.More(); e.Next())
{
auto prop = OCCGeometry::global_shape_properties[e.Current().TShape()];
auto prop = OCCGeometry::global_shape_properties[e.Current()];
for (auto mods : history->Modified(e.Current()))
OCCGeometry::global_shape_properties[mods.TShape()].Merge(prop);
OCCGeometry::global_shape_properties[mods].Merge(prop);
}
#endif // OCC_HAVE_HISTORY
*/

View File

@ -548,7 +548,7 @@ namespace netgen
if (!occgeometry->fvispar[i-1].IsHighlighted())
{
auto c = OCCGeometry::global_shape_properties[face.TShape()].col.value_or(Vec<4>(0,1,0,1) );
auto c = OCCGeometry::global_shape_properties[face].col.value_or(Vec<4>(0,1,0,1) );
for(auto j : Range(4))
mat_col[j] = c[j];
}