mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-11 21:50:34 +05:00
named edges in CSG geometry
This commit is contained in:
parent
30b10c1aaa
commit
d53f28c89b
@ -367,6 +367,11 @@ namespace netgen
|
|||||||
|
|
||||||
NgArray<BCModification> bcmodifications;
|
NgArray<BCModification> bcmodifications;
|
||||||
|
|
||||||
|
|
||||||
|
map<tuple<Surface*,Surface*>, string> named_edges;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual int GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam) override;
|
virtual int GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam) override;
|
||||||
|
|
||||||
void AddSplineSurface (shared_ptr<SplineSurface> ss) { spline_surfaces.Append(ss); }
|
void AddSplineSurface (shared_ptr<SplineSurface> ss) { spline_surfaces.Append(ss); }
|
||||||
|
@ -485,6 +485,29 @@ namespace netgen
|
|||||||
layer,
|
layer,
|
||||||
mesh);
|
mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
// named edge ?
|
||||||
|
// cout << "check edge name, size = " << geometry.named_edges.size() << endl;
|
||||||
|
// for (auto pair : geometry.named_edges)
|
||||||
|
// cout << "key = " << get<0> (pair.first) << "-" << get<1> (pair.first) << ", val = " << pair.second << endl;
|
||||||
|
|
||||||
|
Surface * sp1 = const_cast<Surface*> (geometry.GetSurface(s1));
|
||||||
|
Surface * sp2 = const_cast<Surface*> (geometry.GetSurface(s2));
|
||||||
|
// cout << "sp1 = " << sp1 << ", sp2 = " << sp2 << endl;
|
||||||
|
|
||||||
|
auto ptr = geometry.named_edges.find(tuple(sp1, sp2));
|
||||||
|
if (ptr != geometry.named_edges.end())
|
||||||
|
for (int i = 0; i < refedges.Size(); i++)
|
||||||
|
mesh.SetCD2Name(refedges[i].edgenr, ptr->second);
|
||||||
|
|
||||||
|
ptr = geometry.named_edges.find(tuple(sp2, sp1));
|
||||||
|
if (ptr != geometry.named_edges.end())
|
||||||
|
for (int i = 0; i < refedges.Size(); i++)
|
||||||
|
mesh.SetCD2Name(refedges[i].edgenr, ptr->second);
|
||||||
|
}
|
||||||
|
|
||||||
for(int i=0; i<refedges.Size(); i++)
|
for(int i=0; i<refedges.Size(); i++)
|
||||||
{
|
{
|
||||||
auto splinesurface = dynamic_cast<const SplineSurface*>(geometry.GetSurface(refedges[i].surfnr1));
|
auto splinesurface = dynamic_cast<const SplineSurface*>(geometry.GetSurface(refedges[i].surfnr1));
|
||||||
|
@ -569,7 +569,16 @@ However, when r = 0, the top part becomes a point(tip) and meshing fails!
|
|||||||
py::arg("solid1"), py::arg("solid2"),
|
py::arg("solid1"), py::arg("solid2"),
|
||||||
py::arg("trafo")=Transformation<3>(Vec<3>(0,0,0))
|
py::arg("trafo")=Transformation<3>(Vec<3>(0,0,0))
|
||||||
)
|
)
|
||||||
|
.def("NameEdge", [] (CSGeometry & self, shared_ptr<SPSolid> s1, shared_ptr<SPSolid> s2, string name)
|
||||||
|
{
|
||||||
|
Array<Surface*> surfs1, surfs2;
|
||||||
|
s1->GetSolid()->ForEachSurface( [&surfs1] (Surface * s, bool inv) { surfs1.Append(s); });
|
||||||
|
s2->GetSolid()->ForEachSurface( [&surfs2] (Surface * s, bool inv) { surfs2.Append(s); });
|
||||||
|
for (auto s1 : surfs1)
|
||||||
|
for (auto s2 : surfs2)
|
||||||
|
self.named_edges[tuple(s1,s2)] = name;
|
||||||
|
})
|
||||||
|
|
||||||
.def("AddPoint", [] (CSGeometry & self, Point<3> p, int index) -> CSGeometry&
|
.def("AddPoint", [] (CSGeometry & self, Point<3> p, int index) -> CSGeometry&
|
||||||
{
|
{
|
||||||
self.AddUserPoint(CSGeometry::UserPoint(p, index));
|
self.AddUserPoint(CSGeometry::UserPoint(p, index));
|
||||||
|
Loading…
Reference in New Issue
Block a user