Skip to content

Commit

Permalink
better progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
HelgeGehring committed Feb 14, 2024
1 parent 9b792fb commit cd84b6e
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions meshwell/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,17 +234,25 @@ def mesh(
resolution = entity_obj.resolution
if progress_bars:
if physical_name:
enumerator.set_description(f"{physical_name:<30}")
enumerator.set_description(
f"{physical_name:<30} - {'instanciate':<10}"
)
# First create the shape
dimtags_out = entity_obj.instanciate()

print("dimtags!")
if progress_bars:
if physical_name:
enumerator.set_description(f"{physical_name:<30} - {'dimtags':<10}")
# Parse dimension
dim = validate_dimtags(dimtags_out)
max_dim = max(dim, max_dim)
dimtags = unpack_dimtags(dimtags_out)

print("entities!")
if progress_bars:
if physical_name:
enumerator.set_description(
f"{physical_name:<30} - {'entities':<10}"
)
# Assemble with other shapes
current_entities = LabeledEntities(
index=index,
Expand All @@ -254,7 +262,9 @@ def mesh(
model=self.model,
resolution=resolution,
)
print("boolean!")
if progress_bars:
if physical_name:
enumerator.set_description(f"{physical_name:<30} - {'boolean':<10}")
if index != 0:
cut = self.occ.cut(
current_entities.dimtags,
Expand All @@ -267,9 +277,17 @@ def mesh(
removeTool=False, # Tool (previous entities) should remain untouched
)
# Heal interfaces now that there are no volume conflicts
print("duplicates!")
if progress_bars:
if physical_name:
enumerator.set_description(
f"{physical_name:<30} - {'duplicates':<10}"
)
self.occ.removeAllDuplicates()
print("sync!")
if progress_bars:
if physical_name:
enumerator.set_description(
f"{physical_name:<30} - {'sync':<10}"
)
self.sync_model()
current_entities.dimtags = list(set(cut[0]))
if current_entities.dimtags:
Expand Down

0 comments on commit cd84b6e

Please sign in to comment.