Skip to content

Commit

Permalink
feat: Update container level operations. (#2336)
Browse files Browse the repository at this point in the history
* Update container level operations.

* Update tests/test_meshing_workflow.py

Co-authored-by: Sean Pearson <[email protected]>

* Update tests/test_meshing_workflow.py

Co-authored-by: Sean Pearson <[email protected]>

* Update tests/test_meshing_workflow.py

Co-authored-by: Sean Pearson <[email protected]>

* Use name instead of id.

---------

Co-authored-by: Sean Pearson <[email protected]>
  • Loading branch information
prmukherj and seanpearsonuk authored Jan 9, 2024
1 parent 7d6790e commit a74e6e9
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/ansys/fluent/core/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,9 @@ def _tasks_with_matching_attributes(self, attr: str, other_attr: str) -> list:
matches.append(task)
return matches

def display_name(self):
return self._name_()


class TaskContainer(PyCallableStateObject):
"""Wrap a workflow TaskObject container.
Expand Down Expand Up @@ -381,6 +384,9 @@ def __dir__(self):
)
)

def items(self):
return self._task_container.get_state().items()

def get_state(self):
return self._task_container.get_state()

Expand Down
32 changes: 32 additions & 0 deletions tests/test_meshing_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,3 +714,35 @@ def test_fault_tolerant_workflow(exhaust_system_geometry, new_mesh_session):
}
)
import_cad.Execute()


@pytest.mark.codegen_required
def test_modified_workflow(new_mesh_session):
meshing = new_mesh_session
meshing.workflow.InitializeWorkflow(WorkflowType="Watertight Geometry")

task_object_display_names = {
"Import Geometry",
"Add Local Sizing",
"Generate the Surface Mesh",
"Describe Geometry",
"Apply Share Topology",
"Enclose Fluid Regions (Capping)",
"Update Boundaries",
"Create Regions",
"Update Regions",
"Add Boundary Layers",
"Generate the Volume Mesh",
}

task_display_names = []
for task in meshing.workflow.TaskObject:
task_display_names.append(task.display_name())

assert set(task_display_names) == task_object_display_names

task_display_names = []
for name, _ in meshing.workflow.TaskObject.items():
task_display_names.append(name)

assert set(task_display_names) == task_object_display_names

0 comments on commit a74e6e9

Please sign in to comment.