Skip to content

Commit 941a4de

Browse files
committed
Fixed some issues with constructing and meshing compound OCC objects.
1 parent ad090b9 commit 941a4de

2 files changed

Lines changed: 28 additions & 3 deletions

File tree

GeomLib/GOCCObject.cpp

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,18 +151,41 @@ void GOCCObject::BuildGObject()
151151
for (int i = 1; i <= faceMap.Extent(); ++i)
152152
{
153153
GFace* face = new GFace(this);
154-
face->m_nPID[0] = 0;
155154
AddFace(face);
156155
}
157156

158157
// add a part
159158
if ((m_occ->m_shape.ShapeType() == TopAbs_SOLID) || (m_occ->m_shape.ShapeType() == TopAbs_COMPOUND))
160159
{
161-
AddSolidPart();
160+
for (TopExp_Explorer ex(shape, TopAbs_SOLID); ex.More(); ex.Next())
161+
{
162+
const TopoDS_Solid& solid = TopoDS::Solid(ex.Current());
163+
GPart* pg = AddSolidPart();
164+
165+
// get all the faces of this solid
166+
TopTools_IndexedMapOfShape solidFaceMap;
167+
TopExp::MapShapes(solid, TopAbs_FACE, solidFaceMap);
168+
169+
for (int i = 1; i <= solidFaceMap.Extent(); ++i)
170+
{
171+
const TopoDS_Face& face = TopoDS::Face(solidFaceMap(i));
172+
173+
int nf = faceMap.FindIndex(face) - 1; // get the global face index (1-based)
174+
if ((nf >= 0) && (nf < (int)m_Face.size()))
175+
{
176+
GFace* pf = Face(nf);
177+
int m = 0;
178+
if (pf->m_nPID[0] >= 0) m++;
179+
if (pf->m_nPID[1] >= 0) m++;
180+
pf->m_nPID[m] = pg->GetLocalID();
181+
}
182+
}
183+
}
162184
}
163185
else
164186
{
165187
AddShellPart();
188+
for (int i = 0; i < Faces(); ++i) Face(i)->m_nPID[0] = 0;
166189
}
167190
#endif
168191
}

MeshTools/NetGenMesher.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,9 @@ FSMesh* NetGenMesher::NGMeshToFEMesh(GObject* po, netgen::Mesh* ngmesh, bool sec
254254

255255
// Note that I need to invert the element
256256
FSElement& el = mesh->Element(i);
257-
el.m_gid = 0;
257+
258+
el.m_gid = ngel.GetIndex() - 1; assert(el.m_gid >= 0);
259+
if (el.m_gid < 0) el.m_gid = 0;
258260

259261
if (secondOrder == false)
260262
{

0 commit comments

Comments
 (0)