Hi,
for the given simple solid geometry a valid mesh cannot be computed:
// load geometry
std::string input = "C:\\temp\\geom4.brep";
TopoDS_Shape s;
BRepTools::Read(s, input.c_str(), BRep_Builder());
// define periodic geometry
const auto angle = M_PI;
gp_Trsf transf;
transf.SetRotation(gp::OZ(), angle);
std::vector<TopoDS_Shape> faces;
for (TopExp_Explorer Ex(s, TopAbs_FACE); Ex.More(); Ex.Next())
faces.emplace_back(Ex.Current());
auto per1 = faces[faces.size() - 2];
auto per2 = faces[faces.size() - 1];
netgen::Identify(per1, per2, "periodic", netgen::Identifications::PERIODIC, transf);
// make OCCT geometry available for netgen
std::shared_ptr<netgen::OCCGeometry> occgeo = std::make_shared<netgen::OCCGeometry>(s);
const auto identOK = occgeo->HaveIdentifications(per1);
// meshing
netgen::MeshingParameters mp;
mp.perfstepsend = netgen::MESHCONST_MESHSURFACE;
mp.minh = 0.1;
mp.maxh = 2.0;
auto mesh = std::make_shared<netgen::Mesh>();
mesh->SetGeometry(occgeo);
int success = occgeo->GenerateMesh(mesh, mp);
// result
for (int fdIdx = 1; fdIdx <= mesh->GetNFD(); fdIdx++)
{
// get infos from face descriptor
netgen::FaceDescriptor fd = mesh->GetFaceDescriptor(fdIdx);
// get mesh elements related to face descriptor
netgen::Array<netgen::SurfaceElementIndex> se_face;
mesh->GetSurfaceElementsOfFace(fdIdx, se_face);
auto NbElems = se_face.Size(); // <--- zero elements for face index
}
The console log shows erroneous meshing of a face, but its name is not shown. Checking element number related to the 6th face returns zero elements. Besides that, the return value success
of the meshing function is true
though. So there seem to be more than one issue present. Can this be fixed? Or is there a workaround available?
Thanks, Matthias
geom4.brep (151.8 KB)