Skip to content

Commit 60ce097

Browse files
committed
Refactor vacuum domain handling and update expected names in tests
1 parent ce40089 commit 60ce097

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

src/ShapesClassification.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,19 @@ def _buildDefaultVacuumDomain(self):
149149
farVacuum = [(2, gmsh.model.occ.addDisk(
150150
*boundingBox.getCenter(),
151151
farVacuumDiameter, farVacuumDiameter))]
152-
152+
153153
gmsh.model.occ.synchronize()
154+
self.open = dict([[0, gmsh.model.getBoundary(farVacuum)]])
154155

155156
farVacuum = gmsh.model.occ.cut(
156157
farVacuum, nearVacuum, removeObject=True, removeTool=False)[0]
157158

159+
158160
nearVacuum = gmsh.model.occ.cut(
159161
nearVacuum, nonVacuumSurfaces, removeObject=True, removeTool=False)[0]
160162

163+
gmsh.model.occ.synchronize()
164+
161165
# -- Set mesh size for near vacuum region
162166
bb = BoundingBox(
163167
gmsh.model.getBoundingBox(2, nearVacuum[0][1]))
@@ -167,7 +171,7 @@ def _buildDefaultVacuumDomain(self):
167171
gmsh.model.mesh.setSize(innerRegion, minSide / 20)
168172

169173

170-
self.open = dict([[0, gmsh.model.getBoundary(farVacuum)]])
174+
171175
gmsh.model.occ.synchronize()
172176

173177
return dict([[0, nearVacuum], [1, farVacuum]])

test/test_mesher.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,12 @@ def test_conductor_and_outer_dielectric(self):
246246

247247
pGs = gmsh.model.getPhysicalGroups()
248248
pGNames = [gmsh.model.getPhysicalName(*pG) for pG in pGs]
249-
expectedNames = ['Conductor_0', 'Dielectric_0',
249+
expectedNames = ['Conductor_0',
250+
'Dielectric_0',
250251
'OpenBoundary_0',
251252
'Vacuum_0', 'Vacuum_1']
252-
expectedEntities = [1, 1,
253+
expectedEntities = [1,
254+
1,
253255
1,
254256
1, 1]
255257
self.assertEqual(sorted(pGNames), sorted(expectedNames))

0 commit comments

Comments
 (0)