Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Customise enhanced meshing workflow #2701

Merged
merged 41 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
f6286b9
Clean up.
prmukherj Apr 16, 2024
1ba4dde
Handle an issue with camel_to_snake convertor.
prmukherj Apr 16, 2024
0a3ca72
Merge branch 'main' into feat/enhanced_meshing_workflow_custom
prmukherj Apr 17, 2024
432cc07
Clean up test and code.
prmukherj Apr 17, 2024
4d84114
Clean up test and code.
prmukherj Apr 17, 2024
9bf9069
Update test.
prmukherj Apr 17, 2024
f5ddf1b
Update possible task list.
prmukherj Apr 17, 2024
8918e7d
Fix tests.
prmukherj Apr 17, 2024
af0acd2
Fix camel case conversion.
prmukherj Apr 17, 2024
3c92bbb
Add test for duplicate tasks.
prmukherj Apr 17, 2024
4745eed
Object oriented task insertion.
prmukherj Apr 18, 2024
9997e79
Fix test.
prmukherj Apr 18, 2024
7d3a271
Update src/ansys/fluent/core/workflow.py
prmukherj Apr 19, 2024
8902e3d
Update src/ansys/fluent/core/workflow.py
prmukherj Apr 19, 2024
ff511ad
Update src/ansys/fluent/core/workflow.py
prmukherj Apr 19, 2024
159ffa4
Update src/ansys/fluent/core/workflow.py
prmukherj Apr 19, 2024
2ec895b
Update src/ansys/fluent/core/workflow.py
prmukherj Apr 19, 2024
937cbb0
Merge branch 'main' into feat/enhanced_meshing_workflow_custom
prmukherj Apr 19, 2024
12917c5
Merge branch 'main' into feat/enhanced_meshing_workflow_custom
prmukherj Apr 19, 2024
9d60a93
feat: Load saved workflows. (#2718)
prmukherj Apr 19, 2024
00ef7d1
Update src/ansys/fluent/core/meshing/meshing_workflow.py
prmukherj Apr 20, 2024
0a905c2
Update src/ansys/fluent/core/meshing/meshing_workflow.py
prmukherj Apr 20, 2024
8b39504
Update src/ansys/fluent/core/meshing/meshing_workflow.py
prmukherj Apr 20, 2024
6738356
Update src/ansys/fluent/core/session_base_meshing.py
prmukherj Apr 20, 2024
a683bed
Update src/ansys/fluent/core/session_pure_meshing.py
prmukherj Apr 20, 2024
4f1cb85
Update src/ansys/fluent/core/workflow.py
prmukherj Apr 20, 2024
c42dd5a
Update src/ansys/fluent/core/workflow.py
prmukherj Apr 20, 2024
1b91ebf
Update src/ansys/fluent/core/workflow.py
prmukherj Apr 20, 2024
c48d595
Update src/ansys/fluent/core/workflow.py
prmukherj Apr 20, 2024
e4487da
Merge branch 'main' into feat/enhanced_meshing_workflow_custom
prmukherj Apr 20, 2024
0a30191
rename -> insertable_tasks
prmukherj Apr 20, 2024
b7f54b4
ordered_children -> tasks
prmukherj Apr 20, 2024
20318bb
Renaming.
prmukherj Apr 20, 2024
ffff8d5
Update doc.
prmukherj Apr 20, 2024
aa3a312
Refactor.
prmukherj Apr 20, 2024
225e302
Refactor.
prmukherj Apr 20, 2024
02ebfe9
Fix tests.
prmukherj Apr 20, 2024
e3428fa
Refactor.
prmukherj Apr 21, 2024
6e5411e
Refactor.
prmukherj Apr 21, 2024
8770222
Rename.
prmukherj Apr 22, 2024
1f1e7d6
Update tests.
prmukherj Apr 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions src/ansys/fluent/core/meshing/meshing_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,68 @@ class WorkflowMode(Enum):
FAULT_TOLERANT_MESHING_MODE = FaultTolerantMeshingWorkflow
TWO_DIMENSIONAL_MESHING_MODE = TwoDimensionalMeshingWorkflow
TOPOLOGY_BASED_MESHING_MODE = TopologyBasedMeshingWorkflow


class LoadWorkflow(Workflow):
"""Provides a specialization of the workflow wrapper for a loaded workflow."""

def __init__(
self,
workflow: PyMenuGeneric,
meshing: PyMenuGeneric,
file_path: str,
fluent_version: FluentVersion,
) -> None:
"""Initialize a ``LoadWorkflow`` instance.

Parameters
----------
workflow : PyMenuGeneric
Underlying workflow object.
meshing : PyMenuGeneric
Meshing object.
file_path: str
Path to the saved workflow.
fluent_version: FluentVersion
Version of Fluent in this session.
"""
super().__init__(
workflow=workflow, command_source=meshing, fluent_version=fluent_version
)
self._meshing = meshing
self._file_path = file_path

def load(self) -> None:
"""Load a workflow."""
self._load_workflow(file_path=self._file_path)


class CreateWorkflow(Workflow):
"""Provides a specialization of the workflow wrapper for a newly created
workflow."""

def __init__(
self,
workflow: PyMenuGeneric,
meshing: PyMenuGeneric,
fluent_version: FluentVersion,
) -> None:
"""Initialize a ``CreateWorkflow`` instance.

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
)
self._meshing = meshing

def create(self) -> None:
"""Create a workflow."""
self._create_workflow()
32 changes: 30 additions & 2 deletions src/ansys/fluent/core/session_base_meshing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
import logging

from ansys.fluent.core.fluent_connection import FluentConnection
from ansys.fluent.core.meshing.meshing_workflow import WorkflowMode
from ansys.fluent.core.meshing.meshing_workflow import (
CreateWorkflow,
LoadWorkflow,
WorkflowMode,
)
from ansys.fluent.core.services.datamodel_se import PyMenuGeneric
from ansys.fluent.core.services.datamodel_tui import TUIMenu
from ansys.fluent.core.session_shared import _CODEGEN_MSG_DATAMODEL, _CODEGEN_MSG_TUI
Expand Down Expand Up @@ -48,6 +52,8 @@ def __init__(
self._ft_workflow = None
self._2dm_workflow = None
self._tb_workflow = None
self._loaded_workflow = None
self._created_workflow = None
self._part_management = None
self._pm_file_management = None
self._preferences = None
Expand Down Expand Up @@ -199,9 +205,31 @@ def topology_based_meshing_workflow(self):
)
return self._tb_workflow

def load_workflow(self, file_path: str):
"""Datamodel root of workflow exposed in object-oriented manner."""
if not self._loaded_workflow:
self._loaded_workflow = LoadWorkflow(
self._workflow_se,
self.meshing,
file_path,
self.get_fluent_version(),
)
return self._loaded_workflow

@property
def create_workflow(self):
"""Datamodel root of the workflow exposed in an object-oriented manner."""
if not self._created_workflow:
self._created_workflow = CreateWorkflow(
self._workflow_se,
self.meshing,
self.get_fluent_version(),
)
return self._created_workflow

@property
def PartManagement(self):
"""Datamdoel root of PartManagement."""
"""Datamodel root of ``PartManagement``."""
if self._part_management is None:
try:
pm_module = importlib.import_module(
Expand Down
10 changes: 10 additions & 0 deletions src/ansys/fluent/core/session_pure_meshing.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,16 @@ def two_dimensional_meshing(self):
self._base_meshing.two_dimensional_meshing_workflow.reinitialize()
return self._base_meshing.two_dimensional_meshing_workflow

def load_workflow(self, file_path: str):
"""Load a saved workflow."""
self._base_meshing.load_workflow(file_path=file_path).load()
return self._base_meshing.load_workflow(file_path=file_path)

def create_workflow(self):
"""Create a meshing workflow."""
self._base_meshing.create_workflow.create()
return self._base_meshing.create_workflow

def topology_based(self):
"""Get a new topology-based meshing workflow.
prmukherj marked this conversation as resolved.
Show resolved Hide resolved

Expand Down
2 changes: 2 additions & 0 deletions src/ansys/fluent/core/session_pure_meshing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class PureMeshing:
def fault_tolerant(self): ...
def two_dimensional_meshing(self): ...
def topology_based(self): ...
def load_workflow(self, file_path: str): ...
def create_workflow(self): ...
@property
def PartManagement(self) -> partmanagement_root: ...
@property
Expand Down
Loading