Skip to content

Commit

Permalink
Fix for QGmshRenderer adding a ground_plane physical group even when …
Browse files Browse the repository at this point in the history
…it is not in the model. (#873)

Co-authored-by: Priti Ashvin Shah <74020801+priti-ashvin-shah-ibm@users.noreply.github.com>
  • Loading branch information
AbeerVaishnav13 and priti-ashvin-shah-ibm authored Nov 9, 2022
1 parent 39313b1 commit a8cb84c
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions qiskit_metal/renderers/renderer_gmsh/gmsh_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,28 +915,31 @@ def assign_physical_groups(self, ignore_metal_volume: bool,

layer_name = layer_type + f'_(layer {layer})'
layer_tag = self.layers_dict[layer]
if layer_dim == 3:
layer_sfs_tags = []
for vol in layer_tag:
layer_sfs_tags += list(
gmsh.model.occ.getSurfaceLoops(vol)[1][0])

if layer_type != "ground_plane" or (
layer_type == "ground_plane" and
not ignore_metal_volume):
ph_vol_tag = gmsh.model.addPhysicalGroup(
dim=layer_dim, tags=layer_tag, name=layer_name)
self.physical_groups[layer][layer_name] = ph_vol_tag

ph_sfs_tag = gmsh.model.addPhysicalGroup(
dim=2, tags=layer_sfs_tags, name=f"{layer_name}_sfs")
self.physical_groups[layer][
f"{layer_name}_sfs"] = ph_sfs_tag
else:
ph_tag = gmsh.model.addPhysicalGroup(dim=layer_dim,
tags=layer_tag,
name=layer_name)
self.physical_groups[layer][layer_name] = ph_tag
if len(layer_tag) > 0:
if layer_dim == 3:
layer_sfs_tags = []
for vol in layer_tag:
layer_sfs_tags += list(
gmsh.model.occ.getSurfaceLoops(vol)[1][0])

if layer_type != "ground_plane" or (
layer_type == "ground_plane" and
not ignore_metal_volume):
ph_vol_tag = gmsh.model.addPhysicalGroup(
dim=layer_dim, tags=layer_tag, name=layer_name)
self.physical_groups[layer][layer_name] = ph_vol_tag

ph_sfs_tag = gmsh.model.addPhysicalGroup(
dim=2,
tags=layer_sfs_tags,
name=f"{layer_name}_sfs")
self.physical_groups[layer][
f"{layer_name}_sfs"] = ph_sfs_tag
else:
ph_tag = gmsh.model.addPhysicalGroup(dim=layer_dim,
tags=layer_tag,
name=layer_name)
self.physical_groups[layer][layer_name] = ph_tag

if draw_sample_holder:
# Make physical groups for vacuum box (volume)
Expand Down

0 comments on commit a8cb84c

Please sign in to comment.