mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 05:20:34 +05:00
change interface for identifications
This commit is contained in:
parent
b7448ce2c1
commit
d467621edd
@ -539,8 +539,9 @@ namespace netgen
|
|||||||
if (md[i].mesh->CheckOverlappingBoundary())
|
if (md[i].mesh->CheckOverlappingBoundary())
|
||||||
throw NgException ("Stop meshing since boundary mesh is overlapping");
|
throw NgException ("Stop meshing since boundary mesh is overlapping");
|
||||||
|
|
||||||
// TODO: FillCloseSurface is still not working with CSG closesurfaces
|
// TODO: FillCloseSurface is not working with CSG closesurfaces
|
||||||
// FillCloseSurface( md[i] );
|
if(md[i].mesh->GetGeometry()->GetGeomType() == Mesh::GEOM_OCC)
|
||||||
|
FillCloseSurface( md[i] );
|
||||||
CloseOpenQuads( md[i] );
|
CloseOpenQuads( md[i] );
|
||||||
MeshDomain(md[i]);
|
MeshDomain(md[i]);
|
||||||
});
|
});
|
||||||
|
@ -1995,42 +1995,46 @@ namespace netgen
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OCCGeometry :: Identify(const TopoDS_Shape & me, const TopoDS_Shape & you, string name, Identifications::ID_TYPE type, std::optional<gp_Trsf> opt_trafo)
|
void Identify(const TopoDS_Shape & me, const TopoDS_Shape & you, string name, Identifications::ID_TYPE type, std::optional<gp_Trsf> opt_trafo)
|
||||||
{
|
{
|
||||||
auto type_me = me.ShapeType();
|
gp_Trsf trafo;
|
||||||
auto type_you = you.ShapeType();
|
|
||||||
if(type_me != type_you)
|
|
||||||
throw NgException ("Identify: cannot identify different shape types");
|
|
||||||
|
|
||||||
Transformation<3> trafo;
|
|
||||||
if(opt_trafo)
|
if(opt_trafo)
|
||||||
{
|
{
|
||||||
trafo = occ2ng(*opt_trafo);
|
trafo = *opt_trafo;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto cme = GetCenter(me);
|
auto v = GetCenter(you) - GetCenter(me);
|
||||||
auto cyou = GetCenter(you);
|
trafo.SetTranslation(gp_Vec(v[0], v[1], v[2]));
|
||||||
trafo = Transformation<3>(cyou-cme);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ListOfShapes list_me, list_you;
|
||||||
|
list_me.push_back(me);
|
||||||
|
list_you.push_back(you);
|
||||||
|
Identify(list_me, list_you, name, type, trafo);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Identify(const ListOfShapes & me, const ListOfShapes & you, string name, Identifications::ID_TYPE type, gp_Trsf occ_trafo)
|
||||||
|
{
|
||||||
|
Transformation<3> trafo = occ2ng(occ_trafo);
|
||||||
|
|
||||||
ListOfShapes id_me;
|
ListOfShapes id_me;
|
||||||
ListOfShapes id_you;
|
ListOfShapes id_you;
|
||||||
|
|
||||||
if(auto faces_me = GetFaces(me); faces_me.size()>0)
|
if(auto faces_me = me.Faces(); faces_me.size()>0)
|
||||||
{
|
{
|
||||||
id_me = faces_me;
|
id_me = faces_me;
|
||||||
id_you = GetFaces(you);
|
id_you = you.Faces();
|
||||||
}
|
}
|
||||||
else if(auto edges_me = GetEdges(me); edges_me.size()>0)
|
else if(auto edges_me = me.Edges(); edges_me.size()>0)
|
||||||
{
|
{
|
||||||
id_me = edges_me;
|
id_me = edges_me;
|
||||||
id_you = GetEdges(you);
|
id_you = you.Edges();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
id_me = GetVertices(me);
|
id_me = me.Vertices();
|
||||||
id_you = GetVertices(you);
|
id_you = you.Vertices();
|
||||||
}
|
}
|
||||||
|
|
||||||
for(auto shape_me : id_me)
|
for(auto shape_me : id_me)
|
||||||
@ -2039,7 +2043,7 @@ namespace netgen
|
|||||||
if(!IsMappedShape(trafo, shape_me, shape_you))
|
if(!IsMappedShape(trafo, shape_me, shape_you))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
identifications[shape_me.TShape()].push_back
|
OCCGeometry::identifications[shape_me.TShape()].push_back
|
||||||
(OCCIdentification { shape_me.TShape(), shape_you.TShape(), trafo, name, type });
|
(OCCIdentification { shape_me.TShape(), shape_you.TShape(), trafo, name, type });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -342,12 +342,14 @@ namespace netgen
|
|||||||
bool ErrorInSurfaceMeshing ();
|
bool ErrorInSurfaceMeshing ();
|
||||||
|
|
||||||
// void WriteOCC_STL(char * filename);
|
// void WriteOCC_STL(char * filename);
|
||||||
static void Identify(const TopoDS_Shape & me, const TopoDS_Shape & you, string name, Identifications::ID_TYPE type, std::optional<gp_Trsf> opt_trafo = nullopt);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//bool FastProject (int surfi, Point<3> & ap, double& u, double& v) const;
|
//bool FastProject (int surfi, Point<3> & ap, double& u, double& v) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void Identify(const ListOfShapes & me, const ListOfShapes & you, string name, Identifications::ID_TYPE type, gp_Trsf occ_trafo);
|
||||||
|
void Identify(const TopoDS_Shape & me, const TopoDS_Shape & you, string name, Identifications::ID_TYPE type, std::optional<gp_Trsf> opt_trafo);
|
||||||
|
|
||||||
|
|
||||||
void PrintContents (OCCGeometry * geom);
|
void PrintContents (OCCGeometry * geom);
|
||||||
|
|
||||||
|
@ -1080,7 +1080,9 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
|
|||||||
BRepMesh_IncrementalMesh (shape, deflection, true);
|
BRepMesh_IncrementalMesh (shape, deflection, true);
|
||||||
})
|
})
|
||||||
|
|
||||||
.def("Identify", OCCGeometry::Identify, py::arg("other"), py::arg("name"),
|
|
||||||
|
.def("Identify", py::overload_cast<const TopoDS_Shape &, const TopoDS_Shape &, string, Identifications::ID_TYPE, std::optional<gp_Trsf>>(&Identify),
|
||||||
|
py::arg("other"), py::arg("name"),
|
||||||
py::arg("type")=Identifications::PERIODIC, py::arg("trafo")=nullopt,
|
py::arg("type")=Identifications::PERIODIC, py::arg("trafo")=nullopt,
|
||||||
"Identify shapes for periodic meshing")
|
"Identify shapes for periodic meshing")
|
||||||
|
|
||||||
@ -1625,6 +1627,11 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
|
|||||||
}
|
}
|
||||||
}, "set hpref for all elements of list")
|
}, "set hpref for all elements of list")
|
||||||
|
|
||||||
|
.def("Identify", py::overload_cast<const ListOfShapes&, const ListOfShapes&, string, Identifications::ID_TYPE, gp_Trsf>(&Identify),
|
||||||
|
py::arg("other"), py::arg("name"),
|
||||||
|
py::arg("type")=Identifications::PERIODIC, py::arg("trafo"),
|
||||||
|
"Identify shapes for periodic meshing")
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user