Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
210a1af
feat: Update client side 'enhanced' meshing workflow to use server si…
prmukherj Nov 12, 2025
101d833
chore: adding changelog file 4600.added.md [dependabot-skip]
pyansys-ci-bot Nov 12, 2025
72bc722
Add test for renaming, deletion and insertion.
prmukherj Nov 12, 2025
fe3cc4a
Added the update workflow file.
prmukherj Nov 17, 2025
9a33809
Update Meshing workflow.
prmukherj Nov 21, 2025
74a5b01
Merge branch 'main' into feat/update_enhanced_meshing_workflow_to_use…
prmukherj Nov 26, 2025
00f9b29
Merge branch 'feat/update_enhanced_meshing_workflow_to_use_meshing_wo…
prmukherj Nov 26, 2025
dbca074
Update
prmukherj Nov 28, 2025
f4a922e
Updates.
prmukherj Nov 28, 2025
a02a71d
Updated behaviour.
prmukherj Dec 10, 2025
7f930a5
Merge branch 'main' into feat/update_enhanced_meshing_workflow_to_use…
prmukherj Dec 10, 2025
5774525
Monkey patch environment variable.
prmukherj Dec 10, 2025
efcfa19
Update generated task names.
prmukherj Dec 16, 2025
2729cfe
Merge branch 'main' into feat/update_enhanced_meshing_workflow_to_use…
prmukherj Dec 16, 2025
fff3e77
Added docstrings.
prmukherj Dec 16, 2025
dc05be2
Added docstrings.
prmukherj Dec 16, 2025
29780fb
Updates.
prmukherj Dec 16, 2025
4e876b0
Pass down meshing root from the top level.
prmukherj Dec 17, 2025
d96526f
Fixes.
prmukherj Dec 17, 2025
b787792
Remove unnecessary comments.
prmukherj Dec 17, 2025
1672f12
Minor updates.
prmukherj Dec 17, 2025
dcff47f
Minor updates.
prmukherj Dec 17, 2025
3935020
Minor updates.
prmukherj Dec 17, 2025
9919d07
Minor updates.
prmukherj Dec 17, 2025
5ae4d88
Refactor.
prmukherj Dec 17, 2025
51b7d6c
Have inline comments.
prmukherj Dec 17, 2025
bb9ece0
Rename _task_list.
prmukherj Dec 17, 2025
1a63519
Mark workflow tests as nightly.
prmukherj Dec 17, 2025
42eb0eb
Refactor and clean up.
prmukherj Dec 17, 2025
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
1 change: 1 addition & 0 deletions doc/changelog.d/4600.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update client side 'enhanced' meshing workflow to use server side 'meshing_workflow' root.
315 changes: 315 additions & 0 deletions src/ansys/fluent/core/meshing/meshing_workflow_new.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,315 @@
# Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

"""Meshing workflow specialization of the Workflow module that wraps and extends the
core functionality."""

from __future__ import annotations

from enum import Enum
import os

from ansys.fluent.core._types import PathType
from ansys.fluent.core.services.datamodel_se import PyMenuGeneric
from ansys.fluent.core.utils.fluent_version import FluentVersion
from ansys.fluent.core.workflow_new import Workflow

name_to_identifier_map = {
"Watertight Geometry": "EnableCleanCAD",
"Fault-tolerant Meshing": "EnableComplexMeshing",
"2D Meshing": "EnablePrime2dMeshing",
"Topology Based Meshing": "EnablePrimeMeshing",
}


class MeshingWorkflow(Workflow):
"""Provides meshing specialization of the workflow wrapper that extends the core
functionality in an object-oriented manner."""

def __init__(
self,
workflow: PyMenuGeneric,
meshing: PyMenuGeneric,
name: str,
identifier: str,
fluent_version: FluentVersion,
initialize: bool = True,
) -> None:
"""Initialize MeshingWorkflow.

Parameters
----------
workflow : PyMenuGeneric
Underlying workflow object.
meshing : PyMenuGeneric
Meshing object.
name: str
Workflow name to initialize it.
identifier: str
Workflow name to identify it from global settings.
fluent_version: FluentVersion
Version of Fluent in this session.
initialize: bool
Flag to initialize the workflow, defaults to True.
"""
super().__init__(
workflow=workflow, command_source=meshing, fluent_version=fluent_version
)
self._meshing = meshing
self._name = name
self._identifier = identifier
if initialize:
self._new_workflow(name=self._name)
self._initialized = True


class WatertightMeshingWorkflow(MeshingWorkflow):
"""Provides watertight meshing specialization of the workflow wrapper."""

def __init__(
self,
workflow: PyMenuGeneric,
meshing: PyMenuGeneric,
fluent_version: FluentVersion,
initialize: bool = True,
) -> None:
"""Initialize WatertightMeshingWorkflow.

Parameters
----------
workflow : PyMenuGeneric
Underlying workflow object.
meshing : PyMenuGeneric
Meshing object.
fluent_version: FluentVersion
Version of Fluent in this session.
initialize: bool
Flag to initialize the workflow, defaults to True.
"""
super().__init__(
workflow=workflow,
meshing=meshing,
name="Watertight Geometry",
identifier=name_to_identifier_map["Watertight Geometry"],
fluent_version=fluent_version,
initialize=initialize,
)


class FaultTolerantMeshingWorkflow(MeshingWorkflow):
"""Provides fault-tolerant meshing specialization of the workflow wrapper."""

def __init__(
self,
workflow: PyMenuGeneric,
meshing: PyMenuGeneric,
part_management: PyMenuGeneric,
pm_file_management: PyMenuGeneric,
fluent_version: FluentVersion,
initialize: bool = True,
) -> None:
"""Initialize FaultTolerantMeshingWorkflow.

Parameters
----------
workflow : PyMenuGeneric
Underlying workflow object.
meshing : PyMenuGeneric
Meshing object.
part_management : PyMenuGeneric
Part management object.
pm_file_management : PyMenuGeneric
File management object in the part management object.
fluent_version: FluentVersion
Version of Fluent in this session.
initialize: bool
Flag to initialize the workflow, defaults to True.
"""
super().__init__(
workflow=workflow,
meshing=meshing,
name="Fault-tolerant Meshing",
identifier=name_to_identifier_map["Fault-tolerant Meshing"],
fluent_version=fluent_version,
initialize=initialize,
)
self._part_management = part_management
self._pm_file_management = pm_file_management

@property
def part_management(self) -> PyMenuGeneric | None:
"""Access part-management in fault-tolerant mode.

Returns
-------
PyMenuGeneric | None
Part-management.
"""
return self._part_management

@property
def pm_file_management(self):
"""Access the part-management file-management object in fault-tolerant mode.

Returns
-------
PyMenuGeneric | None
File management object in the part management object.
"""
return self._pm_file_management


class TwoDimensionalMeshingWorkflow(MeshingWorkflow):
"""Provides 2D meshing specialization of the workflow wrapper."""

def __init__(
self,
workflow: PyMenuGeneric,
meshing: PyMenuGeneric,
fluent_version: FluentVersion,
initialize: bool = True,
) -> None:
"""Initialize TwoDimensionalMeshingWorkflow.

Parameters
----------
workflow : PyMenuGeneric
Underlying workflow object.
meshing : PyMenuGeneric
Meshing object.
fluent_version: FluentVersion
Version of Fluent in this session.
initialize: bool
Flag to initialize the workflow, defaults to True.
"""
super().__init__(
workflow=workflow,
meshing=meshing,
name="2D Meshing",
identifier=name_to_identifier_map["2D Meshing"],
fluent_version=fluent_version,
initialize=initialize,
)


class TopologyBasedMeshingWorkflow(MeshingWorkflow):
"""Provides topology-based meshing specialization of the workflow wrapper."""

def __init__(
self,
workflow: PyMenuGeneric,
meshing: PyMenuGeneric,
fluent_version: FluentVersion,
initialize: bool = True,
) -> None:
"""Initialize TopologyBasedMeshingWorkflow.

Parameters
----------
workflow : PyMenuGeneric
Underlying workflow object.
meshing : PyMenuGeneric
Meshing object.
fluent_version: FluentVersion
Version of Fluent in this session.
initialize: bool
Flag to initialize the workflow, defaults to True.
"""
super().__init__(
workflow=workflow,
meshing=meshing,
name="Topology Based Meshing",
identifier=name_to_identifier_map["Topology Based Meshing"],
fluent_version=fluent_version,
initialize=initialize,
)


class WorkflowMode(Enum):
"""Provides an enum of supported Fluent meshing workflow modes."""

WATERTIGHT_MESHING_MODE = WatertightMeshingWorkflow
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: PathType,
fluent_version: FluentVersion,
) -> None:
"""Initialize a ``LoadWorkflow`` instance.

Parameters
----------
workflow : PyMenuGeneric
Underlying workflow object.
meshing : PyMenuGeneric
Meshing object.
file_path: os.PathLike[str | bytes] | str | bytes
Path to the saved workflow file.
fluent_version: FluentVersion
Version of Fluent in this session.
"""
super().__init__(
workflow=workflow, command_source=meshing, fluent_version=fluent_version
)
self._meshing = meshing
self._load_workflow(file_path=os.fspath(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,
initialize: bool = True,
) -> None:
"""Initialize a ``CreateWorkflow`` instance.

Parameters
----------
workflow : PyMenuGeneric
Underlying workflow object.
meshing : PyMenuGeneric
Meshing object.
fluent_version: FluentVersion
Version of Fluent in this session.
initialize: bool
Flag to initialize the workflow, defaults to True.
"""
super().__init__(
workflow=workflow, command_source=meshing, fluent_version=fluent_version
)
self._meshing = meshing
if initialize:
self._create_workflow()
Loading