diff --git a/codegen/datamodelgen.py b/codegen/datamodelgen.py index 0cdae0144bf7..f9697d223995 100644 --- a/codegen/datamodelgen.py +++ b/codegen/datamodelgen.py @@ -5,7 +5,7 @@ from typing import Any, Dict from ansys.api.fluent.v0 import datamodel_se_pb2 as DataModelProtoModule -from ansys.fluent.core.session import _BaseSession as Session +from ansys.fluent.core.session import BaseSession as Session from ansys.fluent.core.utils.fluent_version import get_version_for_filepath _THIS_DIR = Path(__file__).parent @@ -289,7 +289,10 @@ def _write_doc_for_model_object( with open(index_file, "w", encoding="utf8") as f: ref = "_ref_" + "_".join([x.strip("_") for x in heading.split(".")]) f.write(f".. {ref}:\n\n") - heading_ = heading.replace("_", "\_") + if class_name == "Root": + heading_ = heading.replace("_", "\_") + else: + heading_ = class_name.split(".")[-1] f.write(f"{heading_}\n") f.write(f"{'=' * len(heading_)}\n") f.write("\n") diff --git a/codegen/tuigen.py b/codegen/tuigen.py index 0a618feb6a3e..1c3c1e3ccb27 100644 --- a/codegen/tuigen.py +++ b/codegen/tuigen.py @@ -259,7 +259,10 @@ def _write_doc_for_menu(self, menu, doc_dir: Path, heading, class_name) -> None: with open(index_file, "w", encoding="utf8") as f: ref = "_ref_" + "_".join([x.strip("_") for x in heading.split(".")]) f.write(f".. {ref}:\n\n") - heading_ = heading.replace("_", "\_") + if class_name == "main_menu": + heading_ = heading.replace("_", "\_") + else: + heading_ = class_name.split(".")[-1] f.write(f"{heading_}\n") f.write(f"{'=' * len(heading_)}\n") desc = MENU_DESCRIPTIONS.get(heading) diff --git a/doc/source/api/general/case_reader.rst b/doc/source/api/general/case_reader.rst index 8402025ba9ea..c0b1af36d62f 100644 --- a/doc/source/api/general/case_reader.rst +++ b/doc/source/api/general/case_reader.rst @@ -50,3 +50,11 @@ Along with basic functionality, the case reader provides many additional feature >>> reader.rp_vars() >>> reader.config_vars() + +.. automodule:: ansys.fluent.core.filereader.case_file + :members: + :show-inheritance: + :undoc-members: + :exclude-members: __weakref__, __dict__ + :special-members: __init__ + :autosummary: diff --git a/doc/source/api/general/data_transfer.rst b/doc/source/api/general/data_transfer.rst index e2a159fcddbb..1432833aa62f 100644 --- a/doc/source/api/general/data_transfer.rst +++ b/doc/source/api/general/data_transfer.rst @@ -42,3 +42,11 @@ pure meshing session and transfer it to a solver session. Similarly, you can use the ``transfer_case`` method to transfer a case file from one instance of Fluent to another. + +.. automodule:: ansys.fluent.core.utils.data_transfer + :members: + :show-inheritance: + :undoc-members: + :exclude-members: __weakref__, __dict__ + :special-members: __init__ + :autosummary: diff --git a/doc/source/api/general/sessions/Meshing/index.rst b/doc/source/api/general/sessions/Meshing/index.rst new file mode 100644 index 000000000000..ccd14cb5beb8 --- /dev/null +++ b/doc/source/api/general/sessions/Meshing/index.rst @@ -0,0 +1,20 @@ +.. _ref_meshing_sessions: + +Meshing sessions +================ + +================================= =========================================================== +:ref:`ref_session_meshing` | Module containing class encapsulating Fluent connection. + +:ref:`ref_session_base_meshing` Module containing class encapsulating Fluent connection. + +:ref:`ref_session_pure_meshing` Module containing class encapsulating Fluent connection. +================================= =========================================================== + +.. toctree:: + :maxdepth: 1 + :hidden: + + session_meshing + session_base_meshing + session_pure_meshing diff --git a/doc/source/api/general/sessions/Meshing/session_base_meshing.rst b/doc/source/api/general/sessions/Meshing/session_base_meshing.rst new file mode 100644 index 000000000000..efedfe9a8bdf --- /dev/null +++ b/doc/source/api/general/sessions/Meshing/session_base_meshing.rst @@ -0,0 +1,12 @@ +.. _ref_session_base_meshing: + +session_base_meshing +==================== + +.. automodule:: ansys.fluent.core.session_base_meshing + :members: + :show-inheritance: + :undoc-members: + :exclude-members: __weakref__, __dict__ + :special-members: __init__ + :autosummary: diff --git a/doc/source/api/general/sessions/Meshing/session_meshing.rst b/doc/source/api/general/sessions/Meshing/session_meshing.rst new file mode 100644 index 000000000000..c5d67ed4c2b1 --- /dev/null +++ b/doc/source/api/general/sessions/Meshing/session_meshing.rst @@ -0,0 +1,12 @@ +.. _ref_session_meshing: + +session_meshing +=============== + +.. automodule:: ansys.fluent.core.session_meshing + :members: + :show-inheritance: + :undoc-members: + :exclude-members: __weakref__, __dict__ + :special-members: __init__ + :autosummary: diff --git a/doc/source/api/general/sessions/Meshing/session_pure_meshing.rst b/doc/source/api/general/sessions/Meshing/session_pure_meshing.rst new file mode 100644 index 000000000000..47db5f10c916 --- /dev/null +++ b/doc/source/api/general/sessions/Meshing/session_pure_meshing.rst @@ -0,0 +1,12 @@ +.. _ref_session_pure_meshing: + +session_pure_meshing +==================== + +.. automodule:: ansys.fluent.core.session_pure_meshing + :members: + :show-inheritance: + :undoc-members: + :exclude-members: __weakref__, __dict__ + :special-members: __init__ + :autosummary: diff --git a/doc/source/api/general/sessions/Session/fluent_connection.rst b/doc/source/api/general/sessions/Session/fluent_connection.rst new file mode 100644 index 000000000000..ae4bd3f9c0fb --- /dev/null +++ b/doc/source/api/general/sessions/Session/fluent_connection.rst @@ -0,0 +1,12 @@ +.. _ref_fluent_connection: + +fluent_connection +================= + +.. automodule:: ansys.fluent.core.fluent_connection + :members: + :show-inheritance: + :undoc-members: + :exclude-members: __weakref__, __dict__ + :special-members: __init__ + :autosummary: diff --git a/doc/source/api/general/sessions/Session/index.rst b/doc/source/api/general/sessions/Session/index.rst new file mode 100644 index 000000000000..b924dcdb4ad0 --- /dev/null +++ b/doc/source/api/general/sessions/Session/index.rst @@ -0,0 +1,17 @@ +.. _ref_Session: + +Session +======= + +============================== =============================================================================== +:ref:`ref_session` | Module containing class encapsulating Fluent connection and the Base Session. + +:ref:`ref_fluent_connection` Encapsulates a Fluent connection. +============================== =============================================================================== + +.. toctree:: + :maxdepth: 1 + :hidden: + + session + fluent_connection diff --git a/doc/source/api/general/sessions/Session/session.rst b/doc/source/api/general/sessions/Session/session.rst new file mode 100644 index 000000000000..4e4cc95715de --- /dev/null +++ b/doc/source/api/general/sessions/Session/session.rst @@ -0,0 +1,12 @@ +.. _ref_session: + +session +======= + +.. automodule:: ansys.fluent.core.session + :members: + :show-inheritance: + :undoc-members: + :exclude-members: __weakref__, __dict__ + :special-members: __init__ + :autosummary: diff --git a/doc/source/api/general/sessions/Solver/index.rst b/doc/source/api/general/sessions/Solver/index.rst new file mode 100644 index 000000000000..063c14a5e2db --- /dev/null +++ b/doc/source/api/general/sessions/Solver/index.rst @@ -0,0 +1,20 @@ +.. _ref_solver_sessions: + +Solver sessions +=============== + +================================= =========================================================== +:ref:`ref_session_solver` | Module containing class encapsulating Fluent connection. + +:ref:`ref_session_solver_icing` Module containing class encapsulating Fluent connection. + +:ref:`ref_session_solver_lite` Module containing class encapsulating Fluent connection. +================================= =========================================================== + +.. toctree:: + :maxdepth: 1 + :hidden: + + session_solver + session_solver_icing + session_solver_lite diff --git a/doc/source/api/general/sessions/Solver/session_solver.rst b/doc/source/api/general/sessions/Solver/session_solver.rst new file mode 100644 index 000000000000..a3e6e400da96 --- /dev/null +++ b/doc/source/api/general/sessions/Solver/session_solver.rst @@ -0,0 +1,12 @@ +.. _ref_session_solver: + +session_solver +============== + +.. automodule:: ansys.fluent.core.session_solver + :members: + :show-inheritance: + :undoc-members: + :exclude-members: __weakref__, __dict__ + :special-members: __init__ + :autosummary: diff --git a/doc/source/api/general/sessions/Solver/session_solver_icing.rst b/doc/source/api/general/sessions/Solver/session_solver_icing.rst new file mode 100644 index 000000000000..7dd30cf625fa --- /dev/null +++ b/doc/source/api/general/sessions/Solver/session_solver_icing.rst @@ -0,0 +1,12 @@ +.. _ref_session_solver_icing: + +session_solver_icing +==================== + +.. automodule:: ansys.fluent.core.session_solver_icing + :members: + :show-inheritance: + :undoc-members: + :exclude-members: __weakref__, __dict__ + :special-members: __init__ + :autosummary: diff --git a/doc/source/api/general/sessions/Solver/session_solver_lite.rst b/doc/source/api/general/sessions/Solver/session_solver_lite.rst new file mode 100644 index 000000000000..b1caef21361b --- /dev/null +++ b/doc/source/api/general/sessions/Solver/session_solver_lite.rst @@ -0,0 +1,12 @@ +.. _ref_session_solver_lite: + +session_solver_lite +=================== + +.. automodule:: ansys.fluent.core.session_solver_lite + :members: + :show-inheritance: + :undoc-members: + :exclude-members: __weakref__, __dict__ + :special-members: __init__ + :autosummary: diff --git a/doc/source/api/general/sessions/index.rst b/doc/source/api/general/sessions/index.rst index 70200c91ab17..af2c9ac45d5b 100644 --- a/doc/source/api/general/sessions/index.rst +++ b/doc/source/api/general/sessions/index.rst @@ -3,47 +3,42 @@ Sessions ======== - Session ------- -.. currentmodule:: ansys.fluent.core - -.. autosummary:: - :toctree: _autosummary - :template: flobject-module-template.rst - :recursive: - - session - fluent_connection +============================== =============================================================================== +:ref:`ref_session` | Module containing class encapsulating Fluent connection and the Base Session. +:ref:`ref_fluent_connection` Encapsulates a Fluent connection. +============================== =============================================================================== Meshing sessions ---------------- -.. currentmodule:: ansys.fluent.core +================================= =========================================================== +:ref:`ref_session_meshing` | Module containing class encapsulating Fluent connection. -.. autosummary:: - :toctree: _autosummary - :template: flobject-module-template.rst - :recursive: - - session_meshing - session_base_meshing - session_pure_meshing +:ref:`ref_session_base_meshing` Module containing class encapsulating Fluent connection. +:ref:`ref_session_pure_meshing` Module containing class encapsulating Fluent connection. +================================= =========================================================== Solver sessions --------------- -.. currentmodule:: ansys.fluent.core +================================= =========================================================== +:ref:`ref_session_solver` | Module containing class encapsulating Fluent connection. + +:ref:`ref_session_solver_icing` Module containing class encapsulating Fluent connection. + +:ref:`ref_session_solver_lite` Module containing class encapsulating Fluent connection. +================================= =========================================================== -.. autosummary:: - :toctree: _autosummary - :template: flobject-module-template.rst - :recursive: - session_solver - session_solver_icing - session_solver_lite +.. toctree:: + :maxdepth: 1 + :hidden: + Session/index + Meshing/index + Solver/index diff --git a/doc/source/api/general/utils/index.rst b/doc/source/api/general/utils/index.rst index b965cdbd6186..c2239358134d 100644 --- a/doc/source/api/general/utils/index.rst +++ b/doc/source/api/general/utils/index.rst @@ -3,11 +3,10 @@ Asynchronous execution ====================== -.. currentmodule:: ansys.fluent.core.utils - -.. autosummary:: - :toctree: _autosummary - :template: flobject-module-template.rst - :recursive: - - async_execution +.. automodule:: ansys.fluent.core.utils.async_execution + :members: + :show-inheritance: + :undoc-members: + :exclude-members: __weakref__, __dict__ + :special-members: __init__ + :autosummary: diff --git a/doc/styles/Vocab/ANSYS/accept.txt b/doc/styles/Vocab/ANSYS/accept.txt index ffcc35df5912..4b2eb0ea6dc2 100644 --- a/doc/styles/Vocab/ANSYS/accept.txt +++ b/doc/styles/Vocab/ANSYS/accept.txt @@ -8,6 +8,7 @@ endfor endif Fluent fluent +fluent_connection Fluent's fullname hexahedral @@ -33,6 +34,14 @@ Pythonic pyvista rpvars sbatch +session +session_meshing +session_base_meshing +session_pure_meshing +session_solver +session_solver_icing +session_solver_lite +Session Slurm UDFs Univa diff --git a/src/ansys/fluent/core/__init__.py b/src/ansys/fluent/core/__init__.py index 5d8155b236f2..e161d72f4cda 100644 --- a/src/ansys/fluent/core/__init__.py +++ b/src/ansys/fluent/core/__init__.py @@ -14,7 +14,7 @@ launch_fluent, ) from ansys.fluent.core.services.batch_ops import BatchOps # noqa: F401 -from ansys.fluent.core.session import _BaseSession as Fluent # noqa: F401 +from ansys.fluent.core.session import BaseSession as Fluent # noqa: F401 from ansys.fluent.core.utils import fldoc from ansys.fluent.core.utils.setup_for_fluent import setup_for_fluent # noqa: F401 diff --git a/src/ansys/fluent/core/filereader/case_file.py b/src/ansys/fluent/core/filereader/case_file.py index a66165bc44ff..4ca0f8ce16bb 100644 --- a/src/ansys/fluent/core/filereader/case_file.py +++ b/src/ansys/fluent/core/filereader/case_file.py @@ -3,16 +3,13 @@ Example ------- -from ansys.fluent.core.filereader.case import Case +.. code-block:: python -Instantiate a case reader + from ansys.fluent.core.filereader.case import Case + reader = Case(case_filepath=case_filepath) # Instantiate a case reader + input_parameters = reader.input_parameters() # Get lists of input parameters + output_parameters = reader.output_parameters() # Get lists of output parameters -reader = Case(case_filepath=case_filepath) - -Get lists of input and output parameters - -input_parameters = reader.input_parameters() -output_parameters = reader.output_parameters() """ import codecs import gzip diff --git a/src/ansys/fluent/core/fluent_connection.py b/src/ansys/fluent/core/fluent_connection.py index 361783ddf016..c5a5aa634425 100644 --- a/src/ansys/fluent/core/fluent_connection.py +++ b/src/ansys/fluent/core/fluent_connection.py @@ -76,7 +76,7 @@ def __call__(self): return self._scheme_eval.scheme_eval("(data-valid?)") -class _FluentConnection: +class FluentConnection: """Encapsulates a Fluent connection. Methods @@ -182,11 +182,11 @@ def __init__( f"The connection to the Fluent server could not be established within the configurable {start_timeout} second time limit." ) - self._id = f"session-{next(_FluentConnection._id_iter)}" + self._id = f"session-{next(FluentConnection._id_iter)}" - if not _FluentConnection._monitor_thread: - _FluentConnection._monitor_thread = MonitorThread() - _FluentConnection._monitor_thread.start() + if not FluentConnection._monitor_thread: + FluentConnection._monitor_thread = MonitorThread() + FluentConnection._monitor_thread.start() self._batch_ops_service = BatchOpsService(self._channel, self._metadata) @@ -236,7 +236,7 @@ def __init__( self.launcher_args = launcher_args self._finalizer = weakref.finalize( self, - _FluentConnection._exit, + FluentConnection._exit, self._channel, self._cleanup_on_exit, self.scheme_eval, @@ -247,7 +247,7 @@ def __init__( self.monitors_manager, self._remote_instance, ) - _FluentConnection._monitor_thread.cbs.append(self._finalizer) + FluentConnection._monitor_thread.cbs.append(self._finalizer) @property def id(self) -> str: diff --git a/src/ansys/fluent/core/launcher/fluent_container.py b/src/ansys/fluent/core/launcher/fluent_container.py index da3613213779..aeea21129574 100644 --- a/src/ansys/fluent/core/launcher/fluent_container.py +++ b/src/ansys/fluent/core/launcher/fluent_container.py @@ -5,7 +5,7 @@ import time from typing import List -from ansys.fluent.core.session import parse_server_info_file +from ansys.fluent.core.session import _parse_server_info_file from ansys.fluent.core.utils.networking import get_free_port @@ -66,7 +66,7 @@ def start_fluent_container(mounted_from: str, mounted_to: str, args: List[str]) while True: if os.stat(sifile).st_mtime > sifile_last_mtime: time.sleep(1) - _, _, password = parse_server_info_file(sifile) + _, _, password = _parse_server_info_file(sifile) break if timeout == 0: break diff --git a/src/ansys/fluent/core/launcher/launcher.py b/src/ansys/fluent/core/launcher/launcher.py index 7da6fe565ff1..dbb2261f35f6 100644 --- a/src/ansys/fluent/core/launcher/launcher.py +++ b/src/ansys/fluent/core/launcher/launcher.py @@ -15,10 +15,10 @@ from typing import Any, Dict, Union import warnings -from ansys.fluent.core.fluent_connection import _FluentConnection +from ansys.fluent.core.fluent_connection import FluentConnection from ansys.fluent.core.launcher.fluent_container import start_fluent_container from ansys.fluent.core.scheduler import build_parallel_options, load_machines -from ansys.fluent.core.session import parse_server_info_file +from ansys.fluent.core.session import _parse_server_info_file from ansys.fluent.core.session_meshing import Meshing from ansys.fluent.core.session_pure_meshing import PureMeshing from ansys.fluent.core.session_solver import Solver @@ -276,7 +276,7 @@ def launch_remote_fluent( # nb pymapdl sets max msg len here: channel = instance.build_grpc_channel() return session_cls( - fluent_connection=_FluentConnection( + fluent_connection=FluentConnection( channel=channel, cleanup_on_exit=cleanup_on_exit, remote_instance=instance, @@ -354,7 +354,7 @@ def _connect_to_running_server(argvals, server_info_filepath: str): "The server-info file was not parsed because ip and port were provided explicitly." ) elif server_info_filepath: - ip, port, password = parse_server_info_file(server_info_filepath) + ip, port, password = _parse_server_info_file(server_info_filepath) elif os.getenv("PYFLUENT_FLUENT_IP") and os.getenv("PYFLUENT_FLUENT_PORT"): ip = port = None else: @@ -366,7 +366,7 @@ def _connect_to_running_server(argvals, server_info_filepath: str): def _get_running_session_mode( - fluent_connection: _FluentConnection, mode: LaunchMode = None + fluent_connection: FluentConnection, mode: LaunchMode = None ): """Get the mode of the running session if the mode has not been mentioned explicitly.""" @@ -668,7 +668,7 @@ def launch_fluent( pyfluent.EXAMPLES_PATH, pyfluent.EXAMPLES_PATH, args ) return new_session( - fluent_connection=_FluentConnection( + fluent_connection=FluentConnection( start_timeout=start_timeout, port=port, password=password, @@ -681,7 +681,7 @@ def launch_fluent( ip, port, password = _connect_to_running_server( argvals, server_info_filepath ) - fluent_connection = _FluentConnection( + fluent_connection = FluentConnection( ip=ip, port=port, password=password, diff --git a/src/ansys/fluent/core/session.py b/src/ansys/fluent/core/session.py index 347e2d0062aa..232ba65e2868 100644 --- a/src/ansys/fluent/core/session.py +++ b/src/ansys/fluent/core/session.py @@ -6,7 +6,7 @@ import os from typing import Any, Dict -from ansys.fluent.core.fluent_connection import _FluentConnection +from ansys.fluent.core.fluent_connection import FluentConnection from ansys.fluent.core.session_shared import ( # noqa: F401 _CODEGEN_MSG_DATAMODEL, _CODEGEN_MSG_TUI, @@ -22,7 +22,7 @@ data_model_logger = logging.getLogger("ansys.fluent.services.datamodel") -def parse_server_info_file(filename: str): +def _parse_server_info_file(filename: str): with open(filename, encoding="utf-8") as f: lines = f.readlines() ip_and_port = lines[0].strip().split(":") @@ -50,7 +50,7 @@ def _get_solverworkflow(session): return _get_datamodel_attributes(session, "solverworkflow") -class _BaseSession: +class BaseSession: """Instantiates a Fluent connection. Attributes @@ -70,10 +70,10 @@ class _BaseSession: Close the Fluent connection and exit Fluent. """ - def __init__(self, fluent_connection: _FluentConnection): - _BaseSession.build_from_fluent_connection(self, fluent_connection) + def __init__(self, fluent_connection: FluentConnection): + BaseSession.build_from_fluent_connection(self, fluent_connection) - def build_from_fluent_connection(self, fluent_connection: _FluentConnection): + def build_from_fluent_connection(self, fluent_connection: FluentConnection): self.fluent_connection = fluent_connection self.scheme_eval = self.fluent_connection.scheme_eval self.rp_vars = RPVars(self.scheme_eval.string_eval) @@ -110,9 +110,9 @@ def create_from_server_info_file( Session Session instance """ - ip, port, password = parse_server_info_file(server_info_filepath) + ip, port, password = _parse_server_info_file(server_info_filepath) session = cls( - fluent_connection=_FluentConnection( + fluent_connection=FluentConnection( ip=ip, port=port, password=password, diff --git a/src/ansys/fluent/core/session_base_meshing.py b/src/ansys/fluent/core/session_base_meshing.py index 8f7f38ba6eaa..d061e71f9931 100644 --- a/src/ansys/fluent/core/session_base_meshing.py +++ b/src/ansys/fluent/core/session_base_meshing.py @@ -1,7 +1,7 @@ import importlib import logging -from ansys.fluent.core.fluent_connection import _FluentConnection +from ansys.fluent.core.fluent_connection import FluentConnection from ansys.fluent.core.meshing.meshing import Meshing from ansys.fluent.core.services.datamodel_se import PyMenuGeneric from ansys.fluent.core.services.datamodel_tui import TUIMenu @@ -14,8 +14,8 @@ tui_logger = logging.getLogger("ansys.fluent.services.tui") -class _BaseMeshing: - def __init__(self, session_execute_tui, fluent_connection: _FluentConnection): +class BaseMeshing: + def __init__(self, session_execute_tui, fluent_connection: FluentConnection): self._tui_service = fluent_connection.datamodel_service_tui self._se_service = fluent_connection.datamodel_service_se self._fluent_connection = fluent_connection diff --git a/src/ansys/fluent/core/session_meshing.py b/src/ansys/fluent/core/session_meshing.py index e826ea444931..c809c8bc7c5f 100644 --- a/src/ansys/fluent/core/session_meshing.py +++ b/src/ansys/fluent/core/session_meshing.py @@ -1,7 +1,7 @@ """Module containing class encapsulating Fluent connection.""" from typing import Any -from ansys.fluent.core.fluent_connection import _FluentConnection +from ansys.fluent.core.fluent_connection import FluentConnection from ansys.fluent.core.session_pure_meshing import PureMeshing from ansys.fluent.core.session_solver import Solver @@ -15,7 +15,7 @@ class Meshing(PureMeshing): def __init__( self, - fluent_connection: _FluentConnection, + fluent_connection: FluentConnection, ): super(Meshing, self).__init__(fluent_connection=fluent_connection) self.switch_to_solver = lambda: self._switch_to_solver() diff --git a/src/ansys/fluent/core/session_pure_meshing.py b/src/ansys/fluent/core/session_pure_meshing.py index f3972ba70a61..fb4e3e356375 100644 --- a/src/ansys/fluent/core/session_pure_meshing.py +++ b/src/ansys/fluent/core/session_pure_meshing.py @@ -4,22 +4,22 @@ """ -from ansys.fluent.core.fluent_connection import _FluentConnection -from ansys.fluent.core.session import _BaseSession -from ansys.fluent.core.session_base_meshing import _BaseMeshing +from ansys.fluent.core.fluent_connection import FluentConnection +from ansys.fluent.core.session import BaseSession +from ansys.fluent.core.session_base_meshing import BaseMeshing from ansys.fluent.core.utils.data_transfer import transfer_case -class PureMeshing(_BaseSession): +class PureMeshing(BaseSession): """Encapsulates a Fluent meshing session. A ``tui`` object for meshing TUI commanding, and ``meshing`` and ``workflow`` objects for access to task-based meshing workflows are all exposed here. No ``switch_to_solver`` method is available in this mode.""" - def __init__(self, fluent_connection: _FluentConnection): + def __init__(self, fluent_connection: FluentConnection): super(PureMeshing, self).__init__(fluent_connection=fluent_connection) - self._base_meshing = _BaseMeshing(self.execute_tui, fluent_connection) + self._base_meshing = BaseMeshing(self.execute_tui, fluent_connection) @property def tui(self): diff --git a/src/ansys/fluent/core/session_solver.py b/src/ansys/fluent/core/session_solver.py index 52b90b037e38..1c814d805c8f 100644 --- a/src/ansys/fluent/core/session_solver.py +++ b/src/ansys/fluent/core/session_solver.py @@ -10,7 +10,7 @@ from ansys.fluent.core.services.datamodel_tui import TUIMenu from ansys.fluent.core.session import ( _CODEGEN_MSG_TUI, - _BaseSession, + BaseSession, _get_preferences, _get_solverworkflow, ) @@ -24,7 +24,7 @@ data_model_logger = logging.getLogger("ansys.fluent.services.datamodel") -class Solver(_BaseSession): +class Solver(BaseSession): """Encapsulates a Fluent solver session. A ``tui`` object for solver TUI commanding, and solver settings objects are all exposed here.""" diff --git a/src/ansys/fluent/core/session_solver_icing.py b/src/ansys/fluent/core/session_solver_icing.py index 4b5f0faa5e50..8bb11bba5fbe 100644 --- a/src/ansys/fluent/core/session_solver_icing.py +++ b/src/ansys/fluent/core/session_solver_icing.py @@ -4,7 +4,7 @@ """ import importlib -from ansys.fluent.core.fluent_connection import _FluentConnection +from ansys.fluent.core.fluent_connection import FluentConnection from ansys.fluent.core.session_solver import Solver from ansys.fluent.core.utils.fluent_version import get_version_for_filepath @@ -18,7 +18,7 @@ class SolverIcing(Solver): def __init__( self, - fluent_connection: _FluentConnection, + fluent_connection: FluentConnection, ): super(SolverIcing, self).__init__(fluent_connection=fluent_connection) self._flserver_root = None diff --git a/tests/test_session.py b/tests/test_session.py index 55d515b8ce67..d69f95a361eb 100644 --- a/tests/test_session.py +++ b/tests/test_session.py @@ -18,8 +18,8 @@ import ansys.fluent.core as pyfluent from ansys.fluent.core import examples, launch_fluent from ansys.fluent.core.examples import download_file -from ansys.fluent.core.fluent_connection import _FluentConnection -from ansys.fluent.core.session import _BaseSession +from ansys.fluent.core.fluent_connection import FluentConnection +from ansys.fluent.core.session import BaseSession from ansys.fluent.core.utils.networking import get_free_port @@ -82,8 +82,8 @@ def test_create_session_by_passing_ip_and_port_and_password() -> None: MockSchemeEvalServicer(), server ) server.start() - session = _BaseSession( - _FluentConnection(ip=ip, port=port, password="12345", cleanup_on_exit=False) + session = BaseSession( + FluentConnection(ip=ip, port=port, password="12345", cleanup_on_exit=False) ) assert session.health_check_service.is_serving server.stop(None) @@ -105,7 +105,7 @@ def test_create_session_by_setting_ip_and_port_env_var( server.start() monkeypatch.setenv("PYFLUENT_FLUENT_IP", ip) monkeypatch.setenv("PYFLUENT_FLUENT_PORT", str(port)) - session = _BaseSession(_FluentConnection(password="12345", cleanup_on_exit=False)) + session = BaseSession(FluentConnection(password="12345", cleanup_on_exit=False)) assert session.health_check_service.is_serving server.stop(None) session.exit() @@ -123,8 +123,8 @@ def test_create_session_by_passing_grpc_channel() -> None: ) server.start() channel = grpc.insecure_channel(f"{ip}:{port}") - session = _BaseSession( - _FluentConnection(channel=channel, cleanup_on_exit=False, password="12345") + session = BaseSession( + FluentConnection(channel=channel, cleanup_on_exit=False, password="12345") ) assert session.health_check_service.is_serving server.stop(None) @@ -144,7 +144,7 @@ def test_create_session_from_server_info_file(tmp_path: Path) -> None: server.start() server_info_file = tmp_path / "server_info.txt" server_info_file.write_text(f"{ip}:{port}\n12345") - session = _BaseSession.create_from_server_info_file( + session = BaseSession.create_from_server_info_file( server_info_filepath=str(server_info_file), cleanup_on_exit=False ) assert session.health_check_service.is_serving @@ -167,7 +167,7 @@ def test_create_session_from_server_info_file_with_wrong_password( server_info_file = tmp_path / "server_info.txt" server_info_file.write_text(f"{ip}:{port}\n1234") with pytest.raises(RuntimeError): - session = _BaseSession.create_from_server_info_file( + session = BaseSession.create_from_server_info_file( server_info_filepath=str(server_info_file), cleanup_on_exit=False ) session.scheme_eval.scheme_eval("")