Skip to content

Commit 04c0c85

Browse files
feat: Updates for the client side dm-api. (#3748)
This PR adds support for a new client-side datamodel API called "meshing_workflow" to complement the existing "workflow" API. The changes enable access to meshing workflow functionality through a new meshing_workflow property across the meshing session classes. Introduces meshing_workflow datamodel API support for Fluent versions >=26.1 Adds the new API to meshing session classes and type definitions Updates code generation infrastructure to handle the new workflow type --------- Co-authored-by: pyansys-ci-bot <[email protected]>
1 parent 348ef24 commit 04c0c85

File tree

12 files changed

+838
-1
lines changed

12 files changed

+838
-1
lines changed

codegen/allapigen.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
gt_222 = FluentVersion(version) > FluentVersion.v222
1818
ge_231 = FluentVersion(version) >= FluentVersion.v231
1919
ge_242 = FluentVersion(version) >= FluentVersion.v242
20+
ge_261 = FluentVersion(version) >= FluentVersion.v261
2021

2122
static_infos = {
2223
StaticInfoType.DATAMODEL_WORKFLOW: meshing._datamodel_service_se.get_static_info(
@@ -40,6 +41,10 @@
4041
static_infos[StaticInfoType.DATAMODEL_MESHING_UTILITIES] = (
4142
meshing._datamodel_service_se.get_static_info("MeshingUtilities")
4243
)
44+
if ge_261:
45+
static_infos[StaticInfoType.DATAMODEL_MESHING_WORKFLOW] = (
46+
meshing._datamodel_service_se.get_static_info("meshing_workflow")
47+
)
4348
meshing.exit()
4449

4550
solver = launch_fluent(

doc/changelog.d/3748.added.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Updates for the client side dm-api.

doc/datamodel_rstgen.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def generate_meshing_datamodels():
1616
"pm_file_management",
1717
"preferences",
1818
"workflow",
19+
"meshing_workflow",
1920
]
2021
for meshing_datamodel in meshing_datamodels:
2122
try:

src/ansys/fluent/core/codegen/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class StaticInfoType(Enum):
3232
TUI_SOLVER = auto()
3333
TUI_MESHING = auto()
3434
DATAMODEL_WORKFLOW = auto()
35+
DATAMODEL_MESHING_WORKFLOW = auto()
3536
DATAMODEL_MESHING = auto()
3637
DATAMODEL_PART_MANAGEMENT = auto()
3738
DATAMODEL_PM_FILE_MANAGEMENT = auto()

src/ansys/fluent/core/codegen/datamodelgen.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ def _build_command_query_docstring(
187187
"MeshingUtilities": "meshing_utilities",
188188
"flicing": "flicing",
189189
"solverworkflow": "solver_workflow",
190+
"meshing_workflow": "meshing_workflow",
190191
}
191192

192193

@@ -241,6 +242,13 @@ def __init__(self, version, static_infos: dict, verbose: bool = False):
241242
),
242243
self.version,
243244
)
245+
if StaticInfoType.DATAMODEL_MESHING_WORKFLOW in static_infos:
246+
self._static_info["meshing_workflow"] = DataModelStaticInfo(
247+
StaticInfoType.DATAMODEL_MESHING_WORKFLOW,
248+
"meshing_workflow",
249+
("meshing",),
250+
self.version,
251+
)
244252
if StaticInfoType.DATAMODEL_MESHING in static_infos:
245253
self._static_info["meshing"] = DataModelStaticInfo(
246254
StaticInfoType.DATAMODEL_MESHING, "meshing", ("meshing",), self.version
@@ -622,6 +630,10 @@ def generate(version, static_infos: dict, verbose: bool = False):
622630
static_infos[StaticInfoType.DATAMODEL_MESHING_UTILITIES] = (
623631
meshing._datamodel_service_se.get_static_info("MeshingUtilities")
624632
)
633+
if FluentVersion(version) >= FluentVersion.v261:
634+
static_infos[StaticInfoType.DATAMODEL_MESHING_WORKFLOW] = (
635+
meshing._datamodel_service_se.get_static_info("meshing_workflow")
636+
)
625637
parser = argparse.ArgumentParser(
626638
description="A script to write Fluent API files with an optional verbose output."
627639
)

src/ansys/fluent/core/services/datamodel_se.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,10 @@ def get_attr(self, attrib: str) -> Any:
10981098
Any
10991099
Value of the attribute.
11001100
"""
1101-
if pyfluent.config.datamodel_use_attr_cache:
1101+
if (
1102+
pyfluent.config.datamodel_use_attr_cache
1103+
and self.rules != "meshing_workflow"
1104+
):
11021105
return self._get_cached_attr(attrib)
11031106
return self._get_remote_attr(attrib)
11041107

src/ansys/fluent/core/session_base_meshing.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def __init__(
7272
self._fluent_version = fluent_version
7373
self._meshing_utilities = None
7474
self._old_workflow = None
75+
self._meshing_workflow = None
7576
self._part_management = None
7677
self._pm_file_management = None
7778
self._preferences = None
@@ -127,6 +128,13 @@ def workflow(self):
127128
self._old_workflow = _make_datamodel_module(self, "workflow")
128129
return self._old_workflow
129130

131+
@property
132+
def meshing_workflow(self):
133+
"""Full API to meshing and meshing_workflow."""
134+
if self._meshing_workflow is None:
135+
self._meshing_workflow = _make_datamodel_module(self, "meshing_workflow")
136+
return self._meshing_workflow
137+
130138
def watertight_workflow(self, initialize: bool = True):
131139
"""Datamodel root of workflow."""
132140
self._current_workflow = WorkflowMode.WATERTIGHT_MESHING_MODE.value(

src/ansys/fluent/core/session_meshing.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ def workflow(self):
127127
"""Workflow datamodel root."""
128128
return super(Meshing, self).workflow
129129

130+
@property
131+
def meshing_workflow(self):
132+
"""Full API to meshing and meshing_workflow."""
133+
return super(Meshing, self).meshing_workflow
134+
130135
@property
131136
def PartManagement(self):
132137
"""Part management datamodel root."""

src/ansys/fluent/core/session_pure_meshing.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class PureMeshing(BaseSession):
5050

5151
_rules = [
5252
"workflow",
53+
"meshing_workflow",
5354
"meshing",
5455
"MeshingUtilities",
5556
"PartManagement",
@@ -146,6 +147,11 @@ def workflow(self):
146147
"""Datamodel root of workflow."""
147148
return self._base_meshing.workflow
148149

150+
@property
151+
def meshing_workflow(self):
152+
"""Full API to meshing and meshing_workflow."""
153+
return self._base_meshing.meshing_workflow
154+
149155
def watertight(self):
150156
"""Get a new watertight workflow."""
151157
return self._base_meshing.watertight_workflow()

src/ansys/fluent/core/session_pure_meshing.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ from ansys.fluent.core.generated.datamodel_252.preferences import (
3434
Root as preferences_root,
3535
)
3636
from ansys.fluent.core.generated.datamodel_252.workflow import Root as workflow_root
37+
from ansys.fluent.core.generated.datamodel_261.meshing_workflow import (
38+
Root as meshing_workflow_root,
39+
)
3740
from ansys.fluent.core.generated.meshing.tui_252 import main_menu
3841

3942
class PureMeshing:
@@ -45,6 +48,8 @@ class PureMeshing:
4548
def meshing_utilities(self) -> meshing_utilities_root: ...
4649
@property
4750
def workflow(self) -> workflow_root: ...
51+
@property
52+
def meshing_workflow(self) -> meshing_workflow_root: ...
4853
def watertight(self): ...
4954
def fault_tolerant(self): ...
5055
def two_dimensional_meshing(self): ...

0 commit comments

Comments
 (0)