Skip to content

Commit 66cf491

Browse files
committed
change ndofs extaction
1 parent 291f0fc commit 66cf491

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

exemplary_workflow/aiida/exemplary_workflow.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,11 @@ def get_domain_size(gmsh_stdout):
120120
@calcfunction
121121
def get_num_dofs(fenics_stdout):
122122
stdout = fenics_stdout.get_content()
123-
ndofs = stdout.split("Number of dofs used:")[1]
124-
return Int("".join(ndofs.split()))
123+
match = re.search(r"Number of dofs used:\s*(\d+)", stdout)
124+
if not match:
125+
raise ValueError("Could not find 'Number of dofs used:' in FEniCS output.")
126+
ndofs = int(match.group(1))
127+
return Int(ndofs)
125128

126129

127130
# ### prepare latex macros

0 commit comments

Comments
 (0)