Skip to content

Commit

Permalink
fix: meshng wf update (#3356)
Browse files Browse the repository at this point in the history
* meshng wf update

* tests

* meshng wf update

* tests

* Clean up.

* meshng wf update

* tests

* Clean up.

---------

Co-authored-by: Prithwish Mukherjee <[email protected]>
Co-authored-by: Prithwish Mukherjee <[email protected]>
  • Loading branch information
3 people authored Oct 9, 2024
1 parent a3eeaa4 commit 96d3a6f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 45 deletions.
28 changes: 1 addition & 27 deletions src/ansys/fluent/core/meshing/meshing_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from ansys.fluent.core.services.datamodel_se import PyMenuGeneric
from ansys.fluent.core.utils.fluent_version import FluentVersion
from ansys.fluent.core.workflow import ClassicWorkflow, Workflow
from ansys.fluent.core.workflow import Workflow

name_to_identifier_map = {
"Watertight Geometry": "EnableCleanCAD",
Expand All @@ -17,31 +17,6 @@
}


class ClassicMeshingWorkflow(ClassicWorkflow):
"""Provides meshing specialization of the workflow wrapper."""

def __init__(
self,
workflow: PyMenuGeneric,
meshing: PyMenuGeneric,
fluent_version: FluentVersion,
) -> None:
"""Initialize ClassicMeshingWorkflow.
Parameters
----------
workflow : PyMenuGeneric
Underlying workflow object.
meshing : PyMenuGeneric
Meshing object.
fluent_version: FluentVersion
Version of Fluent in this session.
"""
super().__init__(
workflow=workflow, command_source=meshing, fluent_version=fluent_version
)


class MeshingWorkflow(Workflow):
"""Provides meshing specialization of the workflow wrapper that extends the core
functionality in an object-oriented manner."""
Expand Down Expand Up @@ -260,7 +235,6 @@ def __init__(
class WorkflowMode(Enum):
"""Provides an enum of supported Fluent meshing workflow modes."""

CLASSIC_MESHING_MODE = ClassicMeshingWorkflow
WATERTIGHT_MESHING_MODE = WatertightMeshingWorkflow
FAULT_TOLERANT_MESHING_MODE = FaultTolerantMeshingWorkflow
TWO_DIMENSIONAL_MESHING_MODE = TwoDimensionalMeshingWorkflow
Expand Down
8 changes: 2 additions & 6 deletions src/ansys/fluent/core/session_base_meshing.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,8 @@ def meshing_utilities(self):
@property
def workflow(self):
"""Datamodel root of workflow."""
if not self._old_workflow:
self._old_workflow = WorkflowMode.CLASSIC_MESHING_MODE.value(
_make_datamodel_module(self, "workflow"),
self.meshing,
self.get_fluent_version(),
)
if self._old_workflow is None:
self._old_workflow = _make_datamodel_module(self, "workflow")
return self._old_workflow

def watertight_workflow(self, initialize: bool = True):
Expand Down
14 changes: 7 additions & 7 deletions src/ansys/fluent/core/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class BaseTask:

def __init__(
self,
command_source: ClassicWorkflow | Workflow,
command_source: Workflow,
task: str,
) -> None:
"""Initialize BaseTask.
Expand Down Expand Up @@ -937,7 +937,7 @@ class CommandTask(BaseTask):

def __init__(
self,
command_source: ClassicWorkflow | Workflow,
command_source: Workflow,
task: str,
) -> None:
"""Initialize CommandTask.
Expand Down Expand Up @@ -1006,7 +1006,7 @@ class SimpleTask(CommandTask):

def __init__(
self,
command_source: ClassicWorkflow | Workflow,
command_source: Workflow,
task: str,
) -> None:
"""Initialize SimpleTask.
Expand Down Expand Up @@ -1034,7 +1034,7 @@ class CompoundChild(SimpleTask):

def __init__(
self,
command_source: ClassicWorkflow | Workflow,
command_source: Workflow,
task: str,
) -> None:
"""Initialize CompoundChild.
Expand Down Expand Up @@ -1079,7 +1079,7 @@ class CompositeTask(BaseTask):

def __init__(
self,
command_source: ClassicWorkflow | Workflow,
command_source: Workflow,
task: str,
) -> None:
"""Initialize CompositeTask.
Expand Down Expand Up @@ -1131,7 +1131,7 @@ class ConditionalTask(CommandTask):

def __init__(
self,
command_source: ClassicWorkflow | Workflow,
command_source: Workflow,
task: str,
) -> None:
"""Initialize ConditionalTask.
Expand Down Expand Up @@ -1166,7 +1166,7 @@ class CompoundTask(CommandTask):

def __init__(
self,
command_source: ClassicWorkflow | Workflow,
command_source: Workflow,
task: str,
) -> None:
"""Initialize CompoundTask.
Expand Down
5 changes: 0 additions & 5 deletions tests/test_meshing_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ def test_nonexistent_attrs(new_meshing_session):
assert not hasattr(meshing.workflow, "xyz")
with pytest.raises(AttributeError) as msg:
meshing.workflow.xyz
assert msg.value.args[0] == "'ClassicMeshingWorkflow' object has no attribute 'xyz'"


@pytest.mark.codegen_required
Expand All @@ -242,10 +241,6 @@ def test_old_workflow_structure(new_meshing_session):
assert meshing.workflow.TaskObject["Import Geometry"]
with pytest.raises(AttributeError) as msg:
meshing.workflow.import_geometry
assert (
msg.value.args[0]
== "'ClassicMeshingWorkflow' object has no attribute 'import_geometry'"
)


@pytest.mark.nightly
Expand Down

0 comments on commit 96d3a6f

Please sign in to comment.