diff --git a/codegen/datamodelgen.py b/codegen/datamodelgen.py index 8b93eb0d157..b199d4fdd1d 100644 --- a/codegen/datamodelgen.py +++ b/codegen/datamodelgen.py @@ -10,7 +10,6 @@ _THIS_DIR = Path(__file__).parent - _PY_TYPE_BY_DM_TYPE = { **dict.fromkeys(["Logical", "Bool"], "bool"), **dict.fromkeys(["Logical List", "ListBool"], "List[bool]"), @@ -66,8 +65,8 @@ def _build_parameter_docstring(name: str, t: str): return f"Parameter {name} of value type {_PY_TYPE_BY_DM_TYPE[t]}." -def _build_command_docstring(name: str, info: Any, indent: str): - doc = f"{indent}Command {name}.\n\n" +def _build_command_query_docstring(name: str, info: Any, indent: str, is_command: bool): + doc = f"{indent}Command {name}.\n\n" if is_command else f"{indent}Query {name}.\n\n" if info.args: doc += f"{indent}Parameters\n" doc += f"{indent}{'-' * len('Parameters')}\n" @@ -146,6 +145,10 @@ def __init__(self, version, pyfluent_path): if int(self.version) >= 231 else None, } + if int(self.version) >= 242: + self._static_info["meshing_utilities"] = DataModelStaticInfo( + pyfluent_path, "MeshingUtilities", ("meshing",), self.version + ) if not self._static_info["solverworkflow"]: del self._static_info["solverworkflow"] self._delete_generated_files() @@ -223,6 +226,9 @@ def _write_static_info(self, name: str, info: Any, f: FileIO, level: int = 0): singletons = sorted(info.singletons) parameters = sorted(info.parameters) commands = sorted(info.commands) + queries = [] + if hasattr(info, "queries"): + queries = sorted(info.queries) for k in named_objects: f.write( f"{indent} self.{k} = " @@ -245,6 +251,11 @@ def _write_static_info(self, name: str, info: Any, f: FileIO, level: int = 0): f"{indent} self.{k} = " f'self.__class__.{k}(service, rules, "{k}", path)\n' ) + for k in queries: + f.write( + f"{indent} self.{k} = " + f'self.__class__.{k}(service, rules, "{k}", path)\n' + ) f.write(f"{indent} super().__init__(service, rules, path)\n\n") for k in named_objects: f.write(f"{indent} class {k}(PyNamedObjectContainer):\n") @@ -288,13 +299,24 @@ def _write_static_info(self, name: str, info: Any, f: FileIO, level: int = 0): f.write(f"{indent} class {k}(PyCommand):\n") f.write(f'{indent} """\n') f.write( - _build_command_docstring( - k, info.commands[k].commandinfo, f"{indent} " + _build_command_query_docstring( + k, info.commands[k].commandinfo, f"{indent} ", True ) ) f.write(f'{indent} """\n') f.write(f"{indent} pass\n\n") api_tree[k] = "Command" + for k in queries: + f.write(f"{indent} class {k}(PyQuery):\n") + f.write(f'{indent} """\n') + f.write( + _build_command_query_docstring( + k, info.queries[k].queryinfo, f"{indent} ", False + ) + ) + f.write(f'{indent} """\n') + f.write(f"{indent} pass\n\n") + api_tree[k] = "Query" return api_tree def _write_doc_for_model_object( @@ -317,6 +339,9 @@ def _write_doc_for_model_object( singletons = sorted(info.singletons) parameters = sorted(info.parameters) commands = sorted(info.commands) + queries = [] + if hasattr(info, "queries"): + queries = sorted(info.queries) f.write(f".. autoclass:: {module_name}.{class_name}\n") if noindex: @@ -388,7 +413,8 @@ def write_static_info(self) -> None: f.write(" PyNumerical,\n") f.write(" PyDictionary,\n") f.write(" PyNamedObjectContainer,\n") - f.write(" PyCommand\n") + f.write(" PyCommand,\n") + f.write(" PyQuery\n") f.write(")\n\n\n") api_tree_val = { name: self._write_static_info("Root", info.static_info, f) diff --git a/src/ansys/fluent/core/services/datamodel_se.py b/src/ansys/fluent/core/services/datamodel_se.py index a788ee5e824..744e57eec74 100644 --- a/src/ansys/fluent/core/services/datamodel_se.py +++ b/src/ansys/fluent/core/services/datamodel_se.py @@ -157,6 +157,14 @@ def execute_command( logger.debug(f"Command: {request.command}") return self._stub.executeCommand(request, metadata=self._metadata) + @catch_grpc_error + def execute_query( + self, request: DataModelProtoModule.ExecuteQueryRequest + ) -> DataModelProtoModule.ExecuteQueryResponse: + """ExecuteQuery rpc of DataModel service.""" + logger.debug(f"Query: {request.query}") + return self._stub.executeQuery(request, metadata=self._metadata) + @catch_grpc_error def create_command_arguments( self, request: DataModelProtoModule.CreateCommandArgumentsRequest @@ -1044,6 +1052,61 @@ def get_state(self): return dict(sorted(returned_state.items())) +class PyQuery: + """Query class using the StateEngine-based DatamodelService as the backend. Use this + class instead of directly calling the DatamodelService's method. + + Methods + ------- + __call__() + Execute the query. + help() + Print the query help string. + """ + + docstring = None + _stored_static_info = {} + + def __init__( + self, service: DatamodelService, rules: str, query: str, path: Path = None + ): + """__init__ method of PyQuery class.""" + self.service = service + self.rules = rules + self.query = query + if path is None: + self.path = [] + else: + self.path = path + + def __call__(self, *args, **kwds) -> Any: + """Execute the query. + + Returns + ------- + Any + Return value. + """ + request = DataModelProtoModule.ExecuteQueryRequest() + request.rules = self.rules + request.path = convert_path_to_se_path(self.path) + request.query = self.query + _convert_value_to_variant(kwds, request.args) + response = self.service.execute_query(request) + return _convert_variant_to_value(response.result) + + def help(self) -> None: + """Prints help string.""" + request = DataModelProtoModule.GetSpecsRequest() + request.rules = self.rules + request.path = convert_path_to_se_path(self.path) + response = self.service.get_specs(request) + help_string = getattr( + response.member, response.member.WhichOneof("as") + ).query.helpstring + print(help_string) + + class PyCommand: """Command class using the StateEngine-based DatamodelService as the backend. Use this class instead of directly calling the DatamodelService's method. @@ -1409,6 +1472,7 @@ def _get_child_names(self) -> tuple[list, list, list]: singleton_names = [] creatable_type_names = [] command_names = [] + query_names = [] for struct_type in ("singleton", "namedobject"): if response.member.HasField(struct_type): struct_field = getattr(response.member, struct_type) @@ -1417,12 +1481,14 @@ def _get_child_names(self) -> tuple[list, list, list]: singleton_names.append(member) creatable_type_names = struct_field.creatabletypes command_names = [x.name for x in struct_field.commands] - return singleton_names, creatable_type_names, command_names + if hasattr(struct_field, "queries"): + query_names = [x.name for x in struct_field.queries] + return singleton_names, creatable_type_names, command_names, query_names def _get_child( self, name: str ) -> Union["PyMenuGeneric", PyNamedObjectContainer, PyCommand]: - singletons, creatable_types, commands = self._get_child_names() + singletons, creatable_types, commands, queries = self._get_child_names() if name in singletons: child_path = self.path + [(name, "")] return PyMenuGeneric(self.service, self.rules, child_path) @@ -1431,6 +1497,8 @@ def _get_child( return PyNamedObjectContainerGeneric(self.service, self.rules, child_path) elif name in commands: return PyCommand(self.service, self.rules, name, self.path) + elif name in queries: + return PyQuery(self.service, self.rules, name, self.path) else: raise LookupError( f"{name} is not found at path " f"{convert_path_to_se_path(self.path)}" diff --git a/src/ansys/fluent/core/session_base_meshing.py b/src/ansys/fluent/core/session_base_meshing.py index 83bd4ce95b9..ac89bb9270d 100644 --- a/src/ansys/fluent/core/session_base_meshing.py +++ b/src/ansys/fluent/core/session_base_meshing.py @@ -36,13 +36,14 @@ def __init__( self._fluent_connection = fluent_connection self._tui = None self._meshing = None + self._fluent_version = fluent_version + self._meshing_utilities = None self._workflow = None self._part_management = None self._pm_file_management = None self._preferences = None self._session_execute_tui = session_execute_tui self._version = None - self._fluent_version = fluent_version def get_fluent_version(self): """Gets and returns the fluent version.""" @@ -92,6 +93,31 @@ def meshing(self): self._meshing = self._meshing_root return self._meshing + @property + def _meshing_utilities_root(self): + """Datamodel root of meshing_utilities.""" + try: + if self.get_fluent_version() >= "24.2.0": + meshing_utilities_module = importlib.import_module( + f"ansys.fluent.core.datamodel_{self.version}.MeshingUtilities" + ) + meshing_utilities_root = meshing_utilities_module.Root( + self._se_service, "MeshingUtilities", [] + ) + except ImportError: + datamodel_logger.warning(_CODEGEN_MSG_DATAMODEL) + if self.get_fluent_version() >= "24.2.0": + meshing_utilities_root = PyMenuGeneric( + self._se_service, "meshing_utilities" + ) + return meshing_utilities_root + + @property + def meshing_utilities(self): + if self._meshing_utilities is None: + self._meshing_utilities = self._meshing_utilities_root + return self._meshing_utilities + @property def _workflow_se(self): """Datamodel root of workflow.""" diff --git a/src/ansys/fluent/core/session_meshing.py b/src/ansys/fluent/core/session_meshing.py index 560dddf3d46..0fe6d53079b 100644 --- a/src/ansys/fluent/core/session_meshing.py +++ b/src/ansys/fluent/core/session_meshing.py @@ -54,6 +54,11 @@ def meshing(self): """Datamodel root of meshing.""" return super(Meshing, self).meshing if not self.switched else None + @property + def meshing_utilities(self): + """Datamodel root of meshing_utilities.""" + return super(Meshing, self).meshing_utilities if not self.switched else None + @property def workflow(self): """Datamodel root of workflow.""" diff --git a/src/ansys/fluent/core/session_pure_meshing.py b/src/ansys/fluent/core/session_pure_meshing.py index d3e6f75f80d..53b0ea67e7a 100644 --- a/src/ansys/fluent/core/session_pure_meshing.py +++ b/src/ansys/fluent/core/session_pure_meshing.py @@ -26,7 +26,14 @@ class PureMeshing(BaseSession): in this mode. """ - rules = ["workflow", "meshing", "PartManagement", "PMFileManagement"] + rules = [ + "workflow", + "meshing", + "MeshingUtilities", + "PartManagement", + "PMFileManagement", + ] + for r in rules: DataModelCache.set_config(r, "name_key", NameKey.INTERNAL) @@ -55,7 +62,6 @@ def __init__( self.meshing_queries_service = fluent_connection.create_service( MeshingQueriesService, self.error_state ) - self.meshing_queries = MeshingQueries(self.meshing_queries_service) datamodel_service_se = self.datamodel_service_se self.datamodel_streams = {} @@ -83,6 +89,18 @@ def meshing(self): """Datamodel root of meshing.""" return self._base_meshing.meshing + @property + def meshing_queries(self): + """Datamodel root of meshing_queries.""" + if float(self.get_fluent_version()[:-2]) >= 23.2: + return MeshingQueries(self.meshing_queries_service) + + @property + def meshing_utilities(self): + """Datamodel root of meshing_utilities.""" + if self.get_fluent_version() >= "24.2.0": + return self._base_meshing.meshing_utilities + @property def workflow(self): """Datamodel root of workflow.""" diff --git a/tests/test_meshing_queries_fdl.py b/tests/test_meshing_queries_fdl.py new file mode 100644 index 00000000000..78cfc28749d --- /dev/null +++ b/tests/test_meshing_queries_fdl.py @@ -0,0 +1,2058 @@ +import pytest + +from ansys.fluent.core import examples + +import_filename = examples.download_file("mixing_elbow.msh.h5", "pyfluent/mixing_elbow") + + +@pytest.mark.fluent_version(">=24.2") +def test_meshing_utilities(new_mesh_session): + meshing_session = new_mesh_session + meshing_session.tui.file.read_case(import_filename) + + assert meshing_session.meshing_utilities._cell_zones_labels_fdl() == ["elbow-fluid"] + + assert meshing_session.meshing_utilities._cell_zones_str_fdl() == [" 87 "] + + assert meshing_session.meshing_utilities._edge_zones_labels_fdl() == [ + "wall-elbow:wall-inlet:elbow-fluid:feature.28", + "outlet:wall-elbow:elbow-fluid:feature.27", + "cold-inlet:wall-elbow:elbow-fluid:feature.26", + "symmetry:xyplane:wall-elbow:elbow-fluid:feature.25", + "symmetry:xyplane:wall-inlet:elbow-fluid:feature.24", + "symmetry:xyplane:outlet:elbow-fluid:feature.23", + "symmetry:xyplane:cold-inlet:elbow-fluid:feature.22", + "hot-inlet:wall-inlet:elbow-fluid:feature.21", + "symmetry:xyplane:hot-inlet:elbow-fluid:feature.20", + ] + + assert meshing_session.meshing_utilities._edge_zones_str_fdl() == [ + " 28 ", + " 27 ", + " 26 ", + " 25 ", + " 24 ", + " 23 ", + " 22 ", + " 21 ", + " 20 ", + ] + + assert meshing_session.meshing_utilities._face_zones_labels_fdl() == [ + "wall-elbow", + "wall-inlet", + "outlet", + "cold-inlet", + "hot-inlet", + "symmetry-xyplane", + ] + + assert meshing_session.meshing_utilities._face_zones_str_fdl() == [ + " 89 ", + " 34 ", + " 33 ", + " 32 ", + " 31 ", + " 30 ", + " 29 ", + ] + + assert meshing_session.meshing_utilities._node_zones_labels_fdl() == [ + "boundary-node-163", + "node-91", + "boundary-node-19", + ] + + assert meshing_session.meshing_utilities._node_zones_str_fdl() == [ + " 163 ", + " 91 ", + " 19 ", + ] + + assert meshing_session.meshing_utilities._prism_cell_zones_labels_fdl() is None + + assert meshing_session.meshing_utilities._prism_cell_zones_str_fdl() is None + + assert meshing_session.meshing_utilities._object_names_str_fdl() == ["elbow-fluid"] + + assert meshing_session.meshing_utilities._regions_str_fdl() == [" elbow-fluid "] + + assert meshing_session.meshing_utilities._zone_types_fdl() == [ + "interior", + "wall", + "wall", + "pressure-outlet", + "velocity-inlet", + "velocity-inlet", + "symmetry", + "boundary-node", + "node", + "boundary-node", + "fluid", + "boundary-edge", + "boundary-edge", + "boundary-edge", + "boundary-edge", + "boundary-edge", + "boundary-edge", + "boundary-edge", + "boundary-edge", + "boundary-edge", + ] + + assert meshing_session.meshing_utilities.get_labels(object_name="elbow-fluid") == [ + "elbow-fluid", + "wall-elbow", + "wall-inlet", + "outlet", + "cold-inlet", + "hot-inlet", + "symmetry-xyplane", + ] + + assert meshing_session.meshing_utilities.get_labels( + object_name="elbow-fluid", filter="*" + ) == [ + "elbow-fluid", + "wall-elbow", + "wall-inlet", + "outlet", + "cold-inlet", + "hot-inlet", + "symmetry-xyplane", + ] + + assert meshing_session.meshing_utilities.get_labels( + object_name="elbow-fluid", label_name_pattern="*" + ) == [ + "elbow-fluid", + "wall-elbow", + "wall-inlet", + "outlet", + "cold-inlet", + "hot-inlet", + "symmetry-xyplane", + ] + + assert ( + meshing_session.meshing_utilities.add_labels_on_face_zones( + face_zone_name_list=["wall-inlet", "wall-elbow"], + label_name_list=["wall-inlet-1", "wall-elbow-1"], + ) + is None + ) + + assert meshing_session.meshing_utilities.get_labels_on_face_zones( + face_zone_name_list=["wall-inlet", "wall-elbow"] + ) == ["elbow-fluid", "wall-elbow", "wall-inlet-1", "wall-elbow-1", "wall-inlet"] + + assert meshing_session.meshing_utilities.get_face_zone_id_list_with_labels( + face_zone_name_list=["wall-inlet", "wall-elbow"], + label_name_list=["wall-inlet-1", "wall-elbow-1"], + ) == [33, 34, 33, 34] + + assert meshing_session.meshing_utilities.get_face_zone_id_list_with_labels( + face_zone_id_list=[33, 34], + label_name_list=["wall-inlet-1", "wall-elbow-1"], + ) == [33, 34, 33, 34] + + assert meshing_session.meshing_utilities.get_face_zone_id_list_with_labels( + face_zone_name_pattern="wall*", + label_name_list=["wall-inlet-1", "wall-elbow-1"], + ) == [33, 34, 33, 34] + + assert ( + meshing_session.meshing_utilities.add_labels_on_face_zones( + face_zone_id_list=[30, 31], label_name_list=["hot-inlet-1", "cold-inlet-1"] + ) + is None + ) + + assert meshing_session.meshing_utilities.get_labels_on_face_zones( + face_zone_id_list=[30, 31] + ) == ["elbow-fluid", "cold-inlet", "hot-inlet-1", "cold-inlet-1", "hot-inlet"] + + assert ( + meshing_session.meshing_utilities.add_labels_on_face_zones( + face_zone_name_pattern="out*", label_name_list=["outlet-1"] + ) + is None + ) + + assert meshing_session.meshing_utilities.get_labels_on_face_zones( + face_zone_name_pattern="out*" + ) == ["elbow-fluid", "outlet", "outlet-1"] + + assert ( + meshing_session.meshing_utilities.remove_labels_on_face_zones( + face_zone_name_list=["wall-inlet"], + label_name_list=["wall-inlet-1"], + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.remove_labels_on_face_zones( + face_zone_id_list=[30], + label_name_list=["hot-inlet-1"], + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.remove_labels_on_face_zones( + face_zone_name_pattern="*", + label_name_list=["wall-elbow-1"], + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.add_labels_on_cell_zones( + cell_zone_name_list=["elbow-fluid"], label_name_list=["elbow-1"] + ) + == "*the-non-printing-object*" + ) + + assert meshing_session.meshing_utilities.get_cell_zone_id_list_with_labels( + cell_zone_name_list=["elbow-fluid"], + label_name_list=["elbow-1"], + ) == [87] + + assert meshing_session.meshing_utilities.get_cell_zone_id_list_with_labels( + cell_zone_id_list=[87], + label_name_list=["elbow-1"], + ) == [87] + + assert meshing_session.meshing_utilities.get_cell_zone_id_list_with_labels( + cell_zone_name_pattern="*", + label_name_list=["elbow-1"], + ) == [87] + + assert meshing_session.meshing_utilities.get_labels_on_cell_zones( + cell_zone_name_list=["elbow-fluid"] + ) == ["elbow-1"] + + assert ( + meshing_session.meshing_utilities.add_labels_on_cell_zones( + cell_zone_id_list=[87], label_name_list=["87-1"] + ) + == "*the-non-printing-object*" + ) + + assert meshing_session.meshing_utilities.get_labels_on_cell_zones( + cell_zone_id_list=[87] + ) == ["elbow-1", "87-1"] + + assert ( + meshing_session.meshing_utilities.add_labels_on_cell_zones( + cell_zone_name_pattern="*", label_name_list=["cell-1"] + ) + == "*the-non-printing-object*" + ) + + assert meshing_session.meshing_utilities.get_labels_on_cell_zones( + cell_zone_name_pattern="*" + ) == ["87-1", "elbow-1", "cell-1"] + + meshing_session.meshing_utilities.remove_labels_on_cell_zones( + cell_zone_name_list=["elbow-fluid"], + label_name_list=["elbow-1"], + ) + + assert meshing_session.meshing_utilities.get_labels_on_cell_zones( + cell_zone_name_pattern="*" + ) == ["cell-1", "87-1"] + + meshing_session.meshing_utilities.remove_labels_on_cell_zones( + cell_zone_id_list=[87], + label_name_list=["87-1"], + ) + + assert meshing_session.meshing_utilities.get_labels_on_cell_zones( + cell_zone_name_pattern="*" + ) == ["cell-1"] + + meshing_session.meshing_utilities.remove_labels_on_cell_zones( + cell_zone_name_pattern="*", + label_name_list=["cell-1"], + ) + + assert ( + meshing_session.meshing_utilities.get_labels_on_cell_zones( + cell_zone_name_pattern="*" + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.add_labels_on_edge_zones( + edge_zone_name_list=[ + "symmetry:xyplane:hot-inlet:elbow-fluid:feature.20", + "hot-inlet:wall-inlet:elbow-fluid:feature.21", + ], + label_name_list=["20-1", "21-1"], + ) + == "*the-non-printing-object*" + ) + + assert meshing_session.meshing_utilities.get_edge_zone_id_list_with_labels( + edge_zone_name_list=[ + "symmetry:xyplane:hot-inlet:elbow-fluid:feature.20", + "hot-inlet:wall-inlet:elbow-fluid:feature.21", + ], + label_name_list=["20-1", "21-1"], + ) == [20, 21, 20, 21] + + assert meshing_session.meshing_utilities.get_edge_zone_id_list_with_labels( + edge_zone_id_list=[20, 21], + label_name_list=["20-1", "21-1"], + ) == [20, 21, 20, 21] + + assert meshing_session.meshing_utilities.get_edge_zone_id_list_with_labels( + edge_zone_name_pattern="*", + label_name_list=["20-1", "21-1"], + ) == [20, 21, 20, 21] + + assert meshing_session.meshing_utilities.get_labels_on_edge_zones( + edge_zone_name_list=[ + "symmetry:xyplane:hot-inlet:elbow-fluid:feature.20", + "hot-inlet:wall-inlet:elbow-fluid:feature.21", + ] + ) == ["20-1", "21-1"] + + assert ( + meshing_session.meshing_utilities.add_labels_on_edge_zones( + edge_zone_id_list=[22, 23], label_name_list=["22-1", "23-1"] + ) + == "*the-non-printing-object*" + ) + + assert meshing_session.meshing_utilities.get_labels_on_edge_zones( + edge_zone_id_list=[22, 23] + ) == ["22-1", "23-1"] + + assert ( + meshing_session.meshing_utilities.add_labels_on_edge_zones( + edge_zone_name_pattern="cold-inlet*", label_name_list=["26-1"] + ) + == "*the-non-printing-object*" + ) + + assert meshing_session.meshing_utilities.get_labels_on_edge_zones( + edge_zone_name_pattern="cold-inlet*" + ) == ["26-1"] + + meshing_session.meshing_utilities.remove_labels_on_edge_zones( + edge_zone_name_list=["symmetry:xyplane:hot-inlet:elbow-fluid:feature.20"], + label_name_list=["20-1"], + ) + + meshing_session.meshing_utilities.remove_labels_on_edge_zones( + edge_zone_id_list=[22], + label_name_list=["22-1"], + ) + + meshing_session.meshing_utilities.remove_labels_on_edge_zones( + edge_zone_name_pattern="*", + label_name_list=["26-1"], + ) + + assert meshing_session.meshing_utilities.convert_zone_name_strings_to_ids( + zone_name_list=["outlet", "cold-inlet"] + ) == [32, 31] + + assert meshing_session.meshing_utilities.convert_zone_ids_to_name_strings( + zone_id_list=[32, 31] + ) == ["outlet", "cold-inlet"] + + assert meshing_session.meshing_utilities.get_edge_zones(filter="*") == [ + 28, + 27, + 26, + 25, + 24, + 23, + 22, + 21, + 20, + ] + + assert meshing_session.meshing_utilities.get_edge_zones( + maximum_entity_count=20, only_boundary=False + ) == [20, 21, 22, 23, 28] + + assert meshing_session.meshing_utilities.get_edge_zones( + maximum_entity_count=20, only_boundary=True + ) == [20, 21, 22, 23, 28] + + assert meshing_session.meshing_utilities.get_unreferenced_edge_zones() is None + + assert ( + meshing_session.meshing_utilities.get_unreferenced_edge_zones(filter="*") + is None + ) + + assert ( + meshing_session.meshing_utilities.get_unreferenced_edge_zones( + zone_name_pattern="*" + ) + is None + ) + + assert meshing_session.meshing_utilities.get_face_zones(filter="*") == [ + 89, + 34, + 33, + 32, + 31, + 30, + 29, + ] + + assert meshing_session.meshing_utilities.get_face_zones(prism_control_name="*") == [ + 33, + 34, + ] + + assert ( + meshing_session.meshing_utilities.get_face_zones( + xyz_coordinates=[1.4, 1.4, 1.4] + ) + == 34 + ) + + assert ( + meshing_session.meshing_utilities.get_face_zones( + maximum_entity_count=20, only_boundary=True + ) + is None + ) + + assert meshing_session.meshing_utilities.get_face_zones_by_zone_area( + maximum_zone_area=100 + ) == [33, 32, 31, 30] + + assert meshing_session.meshing_utilities.get_face_zones_by_zone_area( + minimum_zone_area=10 + ) == [34, 29] + + assert meshing_session.meshing_utilities.get_face_zones_of_object( + object_name="elbow-fluid", regions=["elbow-fluid"] + ) == [34, 33, 32, 31, 30, 29] + + assert meshing_session.meshing_utilities.get_face_zones_of_object( + object_name="elbow-fluid", labels=["outlet"] + ) == [32] + + assert ( + meshing_session.meshing_utilities.get_face_zones_of_object( + object_name="elbow-fluid", region_type="elbow-fluid" + ) + is None + ) + + assert meshing_session.meshing_utilities.get_face_zones_of_object( + object_name="elbow-fluid" + ) == [29, 30, 31, 32, 33, 34] + + assert meshing_session.meshing_utilities.get_face_zones_of_object( + objects=["elbow-fluid"] + ) == [29, 30, 31, 32, 33, 34] + + assert meshing_session.meshing_utilities.get_wrapped_face_zones() is None + + assert meshing_session.meshing_utilities.get_unreferenced_face_zones() is None + + assert ( + meshing_session.meshing_utilities.get_unreferenced_face_zones(filter="*") + is None + ) + + assert ( + meshing_session.meshing_utilities.get_unreferenced_face_zones( + zone_name_pattern="*" + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.get_interior_face_zones_for_given_cell_zones( + cell_zone_id_list=[87] + ) + == [89] + ) + + assert ( + meshing_session.meshing_utilities.get_interior_face_zones_for_given_cell_zones( + cell_zone_name_pattern="*" + ) + == [89] + ) + + assert ( + meshing_session.meshing_utilities.get_interior_face_zones_for_given_cell_zones( + cell_zone_name_list=["elbow-fluid"] + ) + == [89] + ) + + assert meshing_session.meshing_utilities.get_node_zones(filter="*") == [163, 91, 19] + + assert meshing_session.meshing_utilities.get_adjacent_zones_by_edge_connectivity( + zone_id_list=[29, 30, 31, 32, 33] + ) == [34] + assert meshing_session.meshing_utilities.get_adjacent_zones_by_edge_connectivity( + zone_name_list=["outlet", "inlet", "wall", "internal"] + ) == [34, 29] + assert ( + meshing_session.meshing_utilities.get_adjacent_zones_by_edge_connectivity( + zone_name_pattern="*" + ) + is None + ) + + assert meshing_session.meshing_utilities.get_adjacent_zones_by_node_connectivity( + zone_id_list=[29, 30, 31, 32, 33] + ) == [34] + + assert meshing_session.meshing_utilities.get_adjacent_zones_by_node_connectivity( + zone_name_list=["outlet", "inlet", "wall", "internal"] + ) == [29, 34] + + assert ( + meshing_session.meshing_utilities.get_adjacent_zones_by_node_connectivity( + zone_name_pattern="*" + ) + is None + ) + + assert meshing_session.meshing_utilities.get_cell_zones(filter="*") == [87] + + assert ( + meshing_session.meshing_utilities.get_cell_zones(maximum_entity_count=100) + is None + ) + + assert ( + meshing_session.meshing_utilities.get_cell_zones( + xyz_coordinates=[1.4, 1.4, 1.4] + ) + is False + ) + + assert meshing_session.meshing_utilities.get_unreferenced_cell_zones() is None + + assert ( + meshing_session.meshing_utilities.get_unreferenced_cell_zones(filter="*") + is None + ) + + assert ( + meshing_session.meshing_utilities.get_unreferenced_cell_zones( + zone_name_pattern="*" + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.get_adjacent_cell_zones_for_given_face_zones( + cell_zone_id_list=[29, 30, 31, 32, 33] + ) + == [87] + ) + + assert ( + meshing_session.meshing_utilities.get_adjacent_cell_zones_for_given_face_zones( + cell_zone_name_list=["outlet", "inlet", "wall", "internal"] + ) + == [87] + ) + + assert ( + meshing_session.meshing_utilities.get_adjacent_cell_zones_for_given_face_zones( + cell_zone_name_pattern="*" + ) + == [87] + ) + + assert ( + meshing_session.meshing_utilities.get_tet_cell_zones( + zone_id_list=[29, 30, 31, 32, 33] + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.get_tet_cell_zones(zone_id_list=[87]) is None + ) + + assert ( + meshing_session.meshing_utilities.get_tet_cell_zones( + zone_name_list=["outlet", "inlet", "wall", "internal"] + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.get_tet_cell_zones(zone_name_pattern="*") + is None + ) + + assert ( + meshing_session.meshing_utilities.get_prism_cell_zones(zone_id_list=[87]) + is None + ) + + assert ( + meshing_session.meshing_utilities.get_prism_cell_zones( + zone_name_list=["outlet", "inlet", "wall", "internal"] + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.get_prism_cell_zones(zone_name_pattern="*") + is None + ) + + assert ( + meshing_session.meshing_utilities.get_maxsize_cell_zone_by_count( + zone_id_list=[87] + ) + == 87 + ) + + assert ( + meshing_session.meshing_utilities.get_maxsize_cell_zone_by_count( + zone_name_list=["outlet", "inlet", "wall", "internal"] + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.get_maxsize_cell_zone_by_count( + zone_name_pattern="*" + ) + == 87 + ) + + assert ( + meshing_session.meshing_utilities.get_maxsize_cell_zone_by_volume( + zone_id_list=[87] + ) + == 87 + ) + + assert ( + meshing_session.meshing_utilities.get_maxsize_cell_zone_by_volume( + zone_name_list=["outlet", "inlet", "wall", "internal"] + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.get_maxsize_cell_zone_by_volume( + zone_name_pattern="*" + ) + == 87 + ) + + assert meshing_session.meshing_utilities.get_zones(type_name="velocity-inlet") == [ + 30, + 31, + ] + + assert meshing_session.meshing_utilities.get_zones(group_name="inlet") == [31, 30] + + assert meshing_session.meshing_utilities.get_embedded_baffles() is None + + assert meshing_session.meshing_utilities.get_baffles_for_face_zones( + face_zone_id_list=[29, 30, 31, 32, 33] + ) == [33, 32, 31, 30, 29] + + assert ( + meshing_session.meshing_utilities.get_baffles_for_face_zones( + face_zone_id_list=[87] + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.get_zones_with_marked_faces_for_given_face_zones( + face_zone_id_list=[29, 30, 31, 32, 33] + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.get_zones_with_marked_faces_for_given_face_zones( + face_zone_name_list=["outlet", "inlet", "wall", "internal"] + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.get_zones_with_marked_faces_for_given_face_zones( + face_zone_name_pattern="*" + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.get_zones_with_multi_faces_for_given_face_zones( + face_zone_id_list=[29, 30, 31, 32, 33] + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.get_zones_with_multi_faces_for_given_face_zones( + face_zone_name_list=["outlet", "inlet", "wall", "internal"] + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.get_zones_with_multi_faces_for_given_face_zones( + face_zone_name_pattern="*" + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.get_zones_with_free_faces_for_given_face_zones( + face_zone_id_list=[29, 30, 31, 32, 33] + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.get_zones_with_free_faces_for_given_face_zones( + face_zone_name_list=["outlet", "inlet", "wall", "internal"] + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.get_zones_with_free_faces_for_given_face_zones( + face_zone_name_pattern="*" + ) + is None + ) + + assert meshing_session.meshing_utilities.get_all_objects() == ["elbow-fluid"] + + assert meshing_session.meshing_utilities.get_objects(type_name="mesh") == [ + "elbow-fluid" + ] + + assert meshing_session.meshing_utilities.get_objects(filter="*") == ["elbow-fluid"] + + assert meshing_session.meshing_utilities.get_regions( + object_name="elbow-fluid", region_name_pattern="*" + ) == ["elbow-fluid"] + + assert meshing_session.meshing_utilities.get_regions( + object_name="elbow-fluid", filter="*" + ) == ["elbow-fluid"] + + assert meshing_session.meshing_utilities.get_regions(object_name="elbow-fluid") == [ + "elbow-fluid" + ] + + assert meshing_session.meshing_utilities.get_regions_of_face_zones( + face_zone_id_list=[29, 30, 31, 32, 33] + ) == ["elbow-fluid"] + + assert meshing_session.meshing_utilities.get_regions_of_face_zones( + face_zone_name_list=["outlet", "inlet", "wall", "internal"] + ) == ["elbow-fluid"] + + assert meshing_session.meshing_utilities.get_regions_of_face_zones( + face_zone_name_pattern="*" + ) == ["elbow-fluid"] + + assert meshing_session.meshing_utilities.get_region_volume( + object_name="elbow-fluid", sorting_order="ascending" + ) == [[152.59942809266, "elbow-fluid"]] + + assert ( + meshing_session.meshing_utilities.get_region_volume( + object_name="elbow-fluid", region_name="elbow-fluid" + ) + == 152.59942809266 + ) + + assert ( + meshing_session.meshing_utilities.get_pairs_of_overlapping_face_zones( + face_zone_id_list=[29, 30, 31, 32, 33], + join_tolerance=0.001, + absolute_tolerance=True, + join_angle=45, + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.get_pairs_of_overlapping_face_zones( + face_zone_name_list=["outlet", "inlet", "wall", "internal"], + join_tolerance=0.001, + absolute_tolerance=True, + join_angle=45, + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.get_pairs_of_overlapping_face_zones( + face_zone_name_pattern="*", + join_tolerance=0.001, + absolute_tolerance=True, + join_angle=45, + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.get_overlapping_face_zones( + face_zone_name_pattern="*", area_tolerance=0.01, distance_tolerance=0.01 + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.get_minsize_face_zone_by_count( + zone_id_list=[29, 30, 31, 32, 33] + ) + == 30 + ) + + assert ( + meshing_session.meshing_utilities.get_minsize_face_zone_by_count( + zone_name_list=["outlet", "inlet", "wall", "internal"] + ) + == 32 + ) + + assert ( + meshing_session.meshing_utilities.get_minsize_face_zone_by_count( + zone_name_pattern="*" + ) + == 30 + ) + + assert ( + meshing_session.meshing_utilities.get_minsize_face_zone_by_area( + zone_id_list=[29, 30, 31, 32, 33] + ) + == 30 + ) + + assert ( + meshing_session.meshing_utilities.get_minsize_face_zone_by_area( + zone_name_list=["outlet", "inlet", "wall", "internal"] + ) + == 32 + ) + + assert ( + meshing_session.meshing_utilities.get_minsize_face_zone_by_area( + zone_name_pattern="*" + ) + == 30 + ) + + assert ( + meshing_session.meshing_utilities.get_adjacent_face_zones_for_given_cell_zones( + cell_zone_id_list=[87] + ) + == [29, 30, 31, 32, 33, 34] + ) + + assert ( + meshing_session.meshing_utilities.get_adjacent_face_zones_for_given_cell_zones( + cell_zone_name_pattern="*" + ) + == [29, 30, 31, 32, 33, 34] + ) + + assert ( + meshing_session.meshing_utilities.get_adjacent_face_zones_for_given_cell_zones( + cell_zone_name_list=["elbow-fluid"] + ) + == [29, 30, 31, 32, 33, 34] + ) + + assert meshing_session.meshing_utilities.get_adjacent_interior_and_boundary_face_zones_for_given_cell_zones( + cell_zone_id_list=[87] + ) == [ + 29, + 30, + 31, + 32, + 33, + 34, + 89, + ] + + assert meshing_session.meshing_utilities.get_adjacent_interior_and_boundary_face_zones_for_given_cell_zones( + cell_zone_name_pattern="*" + ) == [ + 29, + 30, + 31, + 32, + 33, + 34, + 89, + ] + + assert meshing_session.meshing_utilities.get_adjacent_interior_and_boundary_face_zones_for_given_cell_zones( + cell_zone_name_list=["elbow-fluid"] + ) == [ + 29, + 30, + 31, + 32, + 33, + 34, + 89, + ] + + assert ( + meshing_session.meshing_utilities.count_marked_faces( + face_zone_name_list=["cold-inlet", "hot-inlet", "outlet"] + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.count_marked_faces(face_zone_name_pattern="*") + == 0 + ) + + assert ( + meshing_session.meshing_utilities.get_multi_faces_count( + face_zone_id_list=[30, 31, 32] + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.get_multi_faces_count( + face_zone_name_list=["cold-inlet", "hot-inlet", "outlet"] + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.get_multi_faces_count( + face_zone_name_pattern="*" + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.get_free_faces_count( + face_zone_id_list=[30, 31, 32] + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.get_free_faces_count( + face_zone_name_list=["cold-inlet", "hot-inlet", "outlet"] + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.get_free_faces_count( + face_zone_name_pattern="*" + ) + == 0 + ) + + assert meshing_session.meshing_utilities.get_edge_size_limits( + face_zone_id_list=[30, 31, 32] + ) == [0.02167507486136073, 0.3016698360443115, 0.1515733801031084] + + assert meshing_session.meshing_utilities.get_edge_size_limits( + face_zone_name_list=["cold-inlet", "hot-inlet", "outlet"] + ) == [0.02167507486136073, 0.3016698360443115, 0.1515733801031084] + + assert meshing_session.meshing_utilities.get_edge_size_limits( + face_zone_name_pattern="*" + ) == [0.002393084222530175, 0.3613402218724294, 0.1225859010936682] + + assert ( + meshing_session.meshing_utilities.get_cell_zone_shape(cell_zone_id=87) + == "mixed" + ) + + # Commented due to variation in 10^-16 th place + + # assert meshing_session.meshing_utilities.get_cell_quality_limits( + # cell_zone_id_list=[87], measure="Orthogonal Quality" + # ) == [17822, 0.2453637718621773, 0.9999993965264717, 0.9546058175066768, 0.0, 0] + # + # assert meshing_session.meshing_utilities.get_cell_quality_limits( + # cell_zone_name_list=["elbow-fluid"], measure="Orthogonal Quality" + # ) == [17822, 0.2453637718621773, 0.9999993965264717, 0.9546058175066768, 0.0, 0] + # + # assert meshing_session.meshing_utilities.get_cell_quality_limits( + # cell_zone_name_pattern="*", measure="Orthogonal Quality" + # ) == [17822, 0.2453637718621773, 0.9999993965264717, 0.9546058175066768, 0.0, 0] + # + # assert meshing_session.meshing_utilities.get_face_quality_limits( + # face_zone_id_list=[30, 31, 32], measure="Orthogonal Quality" + # )[1:] == [0.7348979098719086, 0.9999899933604034, 0.9840275981092989, 362] + # + # assert meshing_session.meshing_utilities.get_face_quality_limits( + # face_zone_name_list=["cold-inlet", "hot-inlet", "outlet"], + # measure="Orthogonal Quality", + # )[1:] == [0.7348979098719086, 0.9999899933604034, 0.9840275981092989, 362] + # + # assert meshing_session.meshing_utilities.get_face_quality_limits( + # face_zone_name_pattern="*", measure="Orthogonal Quality" + # )[1:] == [0.03215596355473505, 1.0, 0.9484456798568045, 91581] + + assert meshing_session.meshing_utilities.get_face_mesh_distribution( + face_zone_id_list=[30, 31, 32], + measure="Orthogonal Quality", + partitions=2, + range=[0.9, 1], + ) == [356, [323, 33], [0, 6]] + + assert meshing_session.meshing_utilities.get_face_mesh_distribution( + face_zone_name_list=["cold-inlet", "hot-inlet", "outlet"], + measure="Orthogonal Quality", + partitions=2, + range=[0.9, 1], + ) == [356, [323, 33], [0, 6]] + + assert meshing_session.meshing_utilities.get_face_mesh_distribution( + face_zone_name_pattern="*", + measure="Orthogonal Quality", + partitions=2, + range=[0.9, 1], + ) == [83001, [71792, 11209], [0, 8580]] + + assert meshing_session.meshing_utilities.get_cell_mesh_distribution( + cell_zone_id_list=[87], + measure="Orthogonal Quality", + partitions=2, + range=[0.9, 1], + ) == [16016, [11740, 4276], [0, 1806]] + + assert meshing_session.meshing_utilities.get_cell_mesh_distribution( + cell_zone_name_list=["elbow-fluid"], + measure="Orthogonal Quality", + partitions=2, + range=[0.9, 1], + ) == [16016, [11740, 4276], [0, 1806]] + + assert meshing_session.meshing_utilities.get_cell_mesh_distribution( + cell_zone_name_pattern="*", + measure="Orthogonal Quality", + partitions=2, + range=[0.9, 1], + ) == [16016, [11740, 4276], [0, 1806]] + + # Commented due to variation in 10^-13 th place + + # assert ( + # meshing_session.meshing_utilities.get_cell_zone_volume(cell_zone_id_list=[87]) + # == 152.5994280926617 + # ) + # + # assert ( + # meshing_session.meshing_utilities.get_cell_zone_volume( + # cell_zone_name_list=["elbow-fluid"] + # ) + # == 152.5994280926617 + # ) + # + # assert ( + # meshing_session.meshing_utilities.get_cell_zone_volume( + # cell_zone_name_pattern="*" + # ) + # == 152.5994280926617 + # ) + + # Commented due to variation in 10^-15 th place + + # assert ( + # meshing_session.meshing_utilities.get_face_zone_area( + # face_zone_id_list=[30, 31, 32] + # ) + # == 12.429615960819163 + # ) + # + # assert ( + # meshing_session.meshing_utilities.get_face_zone_area( + # face_zone_name_list=["cold-inlet", "hot-inlet", "outlet"] + # ) + # == 12.429615960819163 + # ) + + # Commented due to variation in 10^-15 th place + + # assert ( + # meshing_session.meshing_utilities.get_face_zone_area(face_zone_name_pattern="*") + # == 2282.142530887569 + # ) + + assert ( + meshing_session.meshing_utilities.get_face_zone_count( + face_zone_id_list=[30, 31, 32] + ) + == 362 + ) + + assert ( + meshing_session.meshing_utilities.get_face_zone_count( + face_zone_name_list=["cold-inlet", "hot-inlet", "outlet"] + ) + == 362 + ) + + assert ( + meshing_session.meshing_utilities.get_face_zone_count( + face_zone_name_pattern="*" + ) + == 91581 + ) + + assert ( + meshing_session.meshing_utilities.get_cell_zone_count(cell_zone_id_list=[87]) + == 17822 + ) + + assert ( + meshing_session.meshing_utilities.get_cell_zone_count( + cell_zone_name_list=["elbow-fluid"] + ) + == 17822 + ) + + assert ( + meshing_session.meshing_utilities.get_cell_zone_count( + cell_zone_name_pattern="*" + ) + == 17822 + ) + + assert meshing_session.meshing_utilities.get_zone_type(zone_id=87) == "fluid" + + assert ( + meshing_session.meshing_utilities.get_zone_type(zone_name="elbow-fluid") + == "fluid" + ) + + assert ( + meshing_session.meshing_utilities.get_face_zone_node_count(face_zone_id=32) + == 246 + ) + + assert ( + meshing_session.meshing_utilities.get_face_zone_node_count( + face_zone_name="outlet" + ) + == 246 + ) + + assert ( + meshing_session.meshing_utilities.mark_free_faces( + face_zone_id_list=[30, 31, 32] + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_free_faces( + face_zone_name_list=["cold-inlet", "hot-inlet", "outlet"] + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_free_faces(face_zone_name_pattern="*") + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_multi_faces( + face_zone_id_list=[30, 31, 32], fringe_length=5 + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_multi_faces( + face_zone_name_list=["cold-inlet", "hot-inlet", "outlet"], fringe_length=5 + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_multi_faces( + face_zone_name_pattern="*", fringe_length=5 + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_self_intersecting_faces( + face_zone_id_list=[87], mark_folded=True + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_self_intersecting_faces( + face_zone_name_list=["elbow-fluid"], mark_folded=True + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_self_intersecting_faces( + face_zone_name_pattern="elbow*", mark_folded=True + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_duplicate_faces( + face_zone_id_list=[30, 31, 32] + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_duplicate_faces( + face_zone_name_list=["cold-inlet", "hot-inlet", "outlet"] + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_duplicate_faces( + face_zone_name_pattern="*" + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_invalid_normals( + face_zone_id_list=[30, 31, 32] + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_invalid_normals( + face_zone_name_list=["cold-inlet", "hot-inlet", "outlet"] + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_invalid_normals( + face_zone_name_pattern="*" + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_island_faces( + face_zone_id_list=[30, 31, 32], island_face_count=5 + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_island_faces( + face_zone_name_list=["cold-inlet", "hot-inlet", "outlet"], + island_face_count=5, + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_island_faces( + face_zone_name_pattern="cold*", island_face_count=5 + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_spikes( + face_zone_id_list=[30, 31, 32], spike_angle=40.5 + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_spikes( + face_zone_name_list=["cold-inlet", "hot-inlet", "outlet"], spike_angle=40.5 + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_spikes( + face_zone_name_pattern="*", spike_angle=40.5 + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_steps( + face_zone_id_list=[30, 31, 32], step_angle=40.5, step_width=3.3 + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_steps( + face_zone_name_list=["cold-inlet", "hot-inlet", "outlet"], + step_angle=40.5, + step_width=3.3, + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_steps( + face_zone_name_pattern="*", step_angle=40.5, step_width=3.3 + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_sliver_faces( + face_zone_id_list=[30, 31, 32], max_height=2, skew_limit=0.2 + ) + == 2 + ) + + assert ( + meshing_session.meshing_utilities.mark_sliver_faces( + face_zone_name_list=["cold-inlet", "hot-inlet", "outlet"], + max_height=2, + skew_limit=0.2, + ) + == 2 + ) + + assert ( + meshing_session.meshing_utilities.mark_sliver_faces( + face_zone_name_pattern="*", max_height=2.2, skew_limit=0.5 + ) + == 3453 + ) + + assert ( + meshing_session.meshing_utilities.mark_bad_quality_faces( + face_zone_id_list=[30, 31, 32], quality_limit=0.5, number_of_rings=2 + ) + == 362 + ) + + assert ( + meshing_session.meshing_utilities.mark_bad_quality_faces( + face_zone_name_list=["cold-inlet", "hot-inlet", "outlet"], + quality_limit=0.5, + number_of_rings=2, + ) + == 362 + ) + + # assert meshing_session.meshing_utilities.mark_bad_quality_faces(face_zone_name_pattern="*", quality_limit=0.5, + # number_of_rings=2) == 4799 + + assert ( + meshing_session.meshing_utilities.mark_face_strips_by_height_and_quality( + face_zone_id_list=[30, 31, 32], + strip_type=2, + strip_height=2, + quality_measure="Size Change", + quality_limit=0.5, + feature_angle=40, + ) + == -125 + ) + + assert ( + meshing_session.meshing_utilities.mark_face_strips_by_height_and_quality( + face_zone_name_list=["cold-inlet", "hot-inlet", "outlet"], + strip_type=2, + strip_height=2, + quality_measure="Size Change", + quality_limit=0.5, + feature_angle=40.5, + ) + == -125 + ) + + assert ( + meshing_session.meshing_utilities.mark_face_strips_by_height_and_quality( + face_zone_name_pattern="cold*", + strip_type=1, + strip_height=2, + quality_measure="Size Change", + quality_limit=0.5, + feature_angle=40.5, + ) + == -51 + ) + + assert ( + meshing_session.meshing_utilities.mark_faces_deviating_from_size_field( + face_zone_id_list=[87], + min_size_factor=0.5, + max_size_factor=1.1, + size_factor_type_to_compare="geodesic", + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_faces_deviating_from_size_field( + face_zone_name_list=["elbow-fluid"], + min_size_factor=0.5, + max_size_factor=1.1, + size_factor_type_to_compare="geodesic", + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_faces_deviating_from_size_field( + face_zone_name_pattern="elbow*", + min_size_factor=0.5, + max_size_factor=1.1, + size_factor_type_to_compare="geodesic", + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_faces_using_node_degree( + face_zone_id_list=[87], node_degree_threshold=2 + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_faces_using_node_degree( + face_zone_name_list=["elbow-fluid"], node_degree_threshold=2 + ) + == 0 + ) + + assert ( + meshing_session.meshing_utilities.mark_faces_using_node_degree( + face_zone_name_pattern="elbow*", node_degree_threshold=2 + ) + == 0 + ) + + # Commented due to variation in 10^-16 th place + + # assert meshing_session.meshing_utilities.get_average_bounding_box_center( + # face_zone_id_list=[30, 31, 32] + # ) == [1.1482939720153809, -2.2965879440307617, 0.7345014897547645] + # + # assert meshing_session.meshing_utilities.get_bounding_box_of_zone_list( + # zone_id_list=[26] + # ) == [ + # [-7.874015808105469, -7.874015808105469, 0.0], + # [-7.874015808105469, -3.937007904052734, 1.963911771774292], + # ] + + assert ( + meshing_session.meshing_utilities.unpreserve_cell_zones(cell_zone_id_list=[87]) + is False + ) + + assert ( + meshing_session.meshing_utilities.unpreserve_cell_zones( + cell_zone_name_list=["elbow-fluid"] + ) + is False + ) + + assert ( + meshing_session.meshing_utilities.unpreserve_cell_zones( + cell_zone_name_pattern="*" + ) + is False + ) + + assert ( + meshing_session.meshing_utilities.create_boi_and_size_functions_from_refinement_regions( + region_type="hexcore", boi_prefix_string="wall", create_size_function=True + ) + == "*the-non-printing-object*" + ) + + assert ( + meshing_session.meshing_utilities.scale_face_zones_around_pivot( + face_zone_id_list=[30, 31, 32], + scale=[1.1, 1.2, 1.3], + pivot=[1.1482939720153809, -2.2965879440307617, 0.7345014897547645], + use_bbox_center=True, + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.scale_face_zones_around_pivot( + face_zone_name_list=["cold-inlet", "hot-inlet", "outlet"], + scale=[1.1, 1.2, 1.3], + pivot=[1.1482939720153809, -2.2965879440307617, 0.7345014897547645], + use_bbox_center=True, + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.scale_face_zones_around_pivot( + face_zone_name_pattern="*", + scale=[1.1, 1.2, 1.3], + pivot=[1.1482939720153809, -2.2965879440307617, 0.7345014897547645], + use_bbox_center=True, + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.scale_cell_zones_around_pivot( + cell_zone_id_list=[87], + scale=[1.1, 1.2, 1.3], + pivot=[1.1482939720153809, -2.2965879440307617, 0.7345014897547645], + use_bbox_center=True, + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.scale_cell_zones_around_pivot( + cell_zone_name_list=["elbow-fluid"], + scale=[1.1, 1.2, 1.3], + pivot=[1.1482939720153809, -2.2965879440307617, 0.7345014897547645], + use_bbox_center=True, + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.scale_cell_zones_around_pivot( + cell_zone_name_pattern="*", + scale=[1.1, 1.2, 1.3], + pivot=[1.1482939720153809, -2.2965879440307617, 0.7345014897547645], + use_bbox_center=True, + ) + is None + ) + + assert meshing_session.meshing_utilities.dump_face_zone_orientation_in_region( + file_name="facezonetest.txt" + ) == [ + [29, "elbow-fluid"], + [30, "elbow-fluid"], + [31, "elbow-fluid"], + [32, "elbow-fluid"], + [33, "elbow-fluid"], + [34, "elbow-fluid"], + ] + + assert ( + meshing_session.meshing_utilities.set_quality_measure(measure="Aspect Ratio") + is None + ) + + assert ( + meshing_session.meshing_utilities.set_object_cell_zone_type( + object_name="elbow-fluid", cell_zone_type="mixed" + ) + is False + ) + + assert ( + meshing_session.meshing_utilities.set_number_of_parallel_compute_threads( + nthreads=2 + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.rename_face_zone( + zone_id=32, new_name="outlet-32" + ) + is True + ) + + assert ( + meshing_session.meshing_utilities.rename_face_zone( + zone_name="outlet-32", new_name="outlet" + ) + is True + ) + + assert ( + meshing_session.meshing_utilities.rename_edge_zone( + zone_id=20, new_name="symmetry:xyplane:hot-inlet:elbow-fluid:feature.20-new" + ) + is True + ) + + assert ( + meshing_session.meshing_utilities.rename_face_zone( + zone_name="symmetry:xyplane:hot-inlet:elbow-fluid:feature.20-new", + new_name="symmetry:xyplane:hot-inlet:elbow-fluid:feature.20", + ) + is True + ) + + assert ( + meshing_session.meshing_utilities.remove_id_suffix_from_face_zones() + == "*the-non-printing-object*" + ) + + assert ( + meshing_session.meshing_utilities.clean_face_zone_names() + == "*the-non-printing-object*" + ) + + assert ( + meshing_session.meshing_utilities.remove_ids_from_zone_names( + zone_id_list=[30, 31, 32] + ) + is True + ) + + assert ( + meshing_session.meshing_utilities.renumber_zone_ids( + zone_id_list=[30, 31, 32], start_number=1 + ) + == "*the-non-printing-object*" + ) + + assert meshing_session.meshing_utilities.rename_object( + old_object_name="elbow-fluid", new_object_name="elbow-fluid-1" + ) == [ + "elbow-fluid-1", + "solid", + 10, + [29, 33, 34, 1, 2, 3], + [20, 21, 22, 23, 24, 25, 26, 27, 28], + "mesh", + [ + [ + "elbow-fluid", + "fluid", + [3.981021240569742, 7.614496699403261, 0.02968953016527287], + [3, 2, 1, 34, 33, 29], + [[87], None], + ] + ], + [ + ["outlet-1", "fluid", 1, [3], None, "geom", False, None], + ["hot-inlet-1", "fluid", 1, [2], None, "geom", False, None], + ["cold-inlet-1", "fluid", 1, [2, 1], None, "geom", False, None], + ["wall-inlet-1", "fluid", 1, [34], None, "geom", False, None], + [ + "elbow-fluid", + "solid", + 10, + [3, 2, 1, 34, 33, 29], + None, + "geom", + None, + None, + None, + "body", + ], + [ + "wall-elbow", + "solid", + 10, + [34], + None, + "geom", + None, + None, + None, + "facelabel", + ], + [ + "wall-inlet", + "solid", + 10, + [33], + None, + "geom", + None, + None, + None, + "facelabel", + ], + ["outlet", "solid", 10, [3], None, "geom", None, None, None, "facelabel"], + [ + "cold-inlet", + "solid", + 10, + [2], + None, + "geom", + None, + None, + None, + "facelabel", + ], + [ + "hot-inlet", + "solid", + 10, + [1], + None, + "geom", + None, + None, + None, + "facelabel", + ], + [ + "symmetry-xyplane", + "solid", + 10, + [29], + None, + "geom", + None, + None, + None, + "facelabel", + ], + ], + [[87], None], + [None], + None, + ] + + assert ( + meshing_session.meshing_utilities.replace_object_suffix( + object_name_list=["elbow-fluid"], separator="-", new_suffix="fluid-new" + ) + == "*the-non-printing-object*" + ) + + assert ( + meshing_session.meshing_utilities.rename_face_zone_label( + object_name="elbow-fluid-1", + old_label_name="outlet", + new_label_name="outlet-new", + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.replace_label_suffix( + object_name_list=["elbow-fluid-1"], separator="-", new_suffix="fluid-new" + ) + == "*the-non-printing-object*" + ) + + assert ( + meshing_session.meshing_utilities.copy_face_zone_labels( + from_face_zone_id=33, to_face_zone_id=34 + ) + == "*the-non-printing-object*" + ) + + assert ( + meshing_session.meshing_utilities.merge_face_zones( + face_zone_id_list=[30, 31, 32] + ) + is False + ) + + assert ( + meshing_session.meshing_utilities.merge_face_zones( + face_zone_name_pattern="wall*" + ) + == 34 + ) + + assert ( + meshing_session.meshing_utilities.merge_face_zones_of_type( + face_zone_type="velocity-inlet", face_zone_name_pattern="*" + ) + == 1 + ) + + assert ( + meshing_session.meshing_utilities.merge_face_zones_with_same_prefix( + prefix="elbow" + ) + is True + ) + + assert ( + meshing_session.meshing_utilities.merge_cell_zones(cell_zone_id_list=[87]) + is False + ) + + assert ( + meshing_session.meshing_utilities.merge_cell_zones( + cell_zone_name_list=["elbow-fluid"] + ) + is False + ) + + assert ( + meshing_session.meshing_utilities.merge_cell_zones(cell_zone_name_pattern="*") + is False + ) + + assert ( + meshing_session.meshing_utilities.merge_cell_zones_with_same_prefix( + prefix="elbow" + ) + is True + ) + + assert ( + meshing_session.meshing_utilities.merge_cell_zones_with_same_suffix( + suffix="fluid" + ) + is True + ) + + assert ( + meshing_session.meshing_utilities.separate_face_zones_by_cell_neighbor( + face_zone_id_list=[30, 31, 32] + ) + is True + ) + + assert ( + meshing_session.meshing_utilities.separate_face_zones_by_cell_neighbor( + face_zone_name_list=["wall-inlet", "wallfluid-new"] + ) + is True + ) + + assert ( + meshing_session.meshing_utilities.separate_face_zones_by_cell_neighbor( + face_zone_name_pattern="*" + ) + is True + ) + + assert ( + meshing_session.meshing_utilities.refine_marked_faces_in_zones( + face_zone_id_list=[30, 31, 32] + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.refine_marked_faces_in_zones( + face_zone_name_list=["wall-inlet", "wallfluid-new"] + ) + is None + ) + + assert meshing_session.meshing_utilities.refine_marked_faces_in_zones( + face_zone_name_pattern="*" + ) == [0, 0, 0, 0, 0] + + assert ( + meshing_session.meshing_utilities.fill_holes_in_face_zone_list( + face_zone_id_list=[30, 31, 32], max_hole_edges=2 + ) + is False + ) + + assert ( + meshing_session.meshing_utilities.fill_holes_in_face_zone_list( + face_zone_name_list=["wall-inlet", "wallfluid-new"], max_hole_edges=2 + ) + is False + ) + + assert ( + meshing_session.meshing_utilities.fill_holes_in_face_zone_list( + face_zone_name_pattern="wall*", max_hole_edges=2 + ) + is False + ) + + assert ( + meshing_session.meshing_utilities.project_zone_on_plane( + zone_id=87, plane=[[1, 0, 0], [0, 1, 0], [0, 0, 1]] + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.delete_all_sub_domains() + == "*the-non-printing-object*" + ) + + assert ( + meshing_session.meshing_utilities.delete_marked_faces_in_zones( + face_zone_id_list=[30, 31, 32] + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.delete_marked_faces_in_zones( + face_zone_name_list=["wall-inlet", "wallfluid-new"] + ) + is None + ) + + assert meshing_session.meshing_utilities.delete_marked_faces_in_zones( + face_zone_name_pattern="*" + ) == [0, 0, 0, 0, 3446] + + assert ( + meshing_session.meshing_utilities.delete_empty_face_zones( + face_zone_id_list=[30, 31, 32] + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.delete_empty_face_zones( + face_zone_name_list=["wall-inlet", "wallfluid-new"] + ) + is None + ) + + assert meshing_session.meshing_utilities.delete_empty_face_zones( + face_zone_name_pattern="*" + ) == [29, 1, 3, 34, 89] + + assert meshing_session.meshing_utilities.delete_empty_cell_zones( + cell_zone_id_list=[87] + ) == [87] + + assert meshing_session.meshing_utilities.delete_empty_cell_zones( + cell_zone_name_list=["elbow.87"] + ) == [87] + + assert meshing_session.meshing_utilities.delete_empty_cell_zones( + cell_zone_name_pattern="*" + ) == [87] + + assert meshing_session.meshing_utilities.delete_empty_edge_zones( + edge_zone_id_list=[20, 25, 26] + ) == [26, 25, 20] + + assert meshing_session.meshing_utilities.delete_empty_edge_zones( + edge_zone_name_list=[ + "symmetry:xyplane:hot-inlet:elbow-fluid:feature.20", + "hot-inlet:wall-inlet:elbow-fluid:feature.21", + ] + ) == [21] + + assert meshing_session.meshing_utilities.delete_empty_edge_zones( + edge_zone_name_pattern="*" + ) == [28, 27, 26, 25, 24, 23, 22, 21, 20] + + assert meshing_session.meshing_utilities.delete_empty_zones( + zone_id_list=[20, 32, 87] + ) == [20, 87] + + assert meshing_session.meshing_utilities.delete_empty_zones( + zone_name_list=["hotfluid-new", "elbow.87"] + ) == [87] + + assert meshing_session.meshing_utilities.delete_empty_zones( + zone_name_pattern="*" + ) == [169, 163, 19, 28, 27, 26, 25, 24, 23, 22, 21, 20, 29, 1, 3, 34, 89, 87] + + assert meshing_session.meshing_utilities.boundary_zone_exists(zone_id=31) is False + + assert ( + meshing_session.meshing_utilities.boundary_zone_exists(zone_name="wall-inlet") + is False + ) + + assert meshing_session.meshing_utilities.interior_zone_exists(zone_id=31) is False + + assert ( + meshing_session.meshing_utilities.interior_zone_exists(zone_name="wall-inlet") + is False + ) + + assert meshing_session.meshing_utilities.cell_zone_exists(zone_id=87) is True + + assert ( + meshing_session.meshing_utilities.cell_zone_exists(zone_name="elbow.87") is True + ) + + assert meshing_session.meshing_utilities.mesh_exists() is True + + assert ( + meshing_session.meshing_utilities.replace_face_zone_suffix( + face_zone_id_list=[30, 31, 32], + separator="-suffix-", + replace_with="-with-", + merge=False, + ) + is False + ) + + assert ( + meshing_session.meshing_utilities.replace_face_zone_suffix( + face_zone_name_list=["cold-inlet", "hot-inlet"], + separator="-suffix-", + replace_with="-with-", + merge=False, + ) + is False + ) + + assert meshing_session.meshing_utilities.replace_cell_zone_suffix( + cell_zone_id_list=[87], old_suffix="fluid", new_suffix="fluid-new", merge=True + ) == [False] + + assert ( + meshing_session.meshing_utilities.replace_cell_zone_suffix( + cell_zone_name_list=["elbow-fluid-new"], + old_suffix="fluid", + new_suffix="fluid-new", + merge=True, + ) + is None + ) + + assert ( + meshing_session.meshing_utilities.replace_edge_zone_suffix( + edge_zone_id_list=[20], + old_suffix="fluid", + new_suffix="fluid-new", + merge=True, + ) + == "*the-non-printing-object*" + ) + + assert ( + meshing_session.meshing_utilities.replace_edge_zone_suffix( + edge_zone_name_list=["hot-inlet:wall-inlet:elbow-fluid:feature.21"], + old_suffix="fluid", + new_suffix="fluid-new", + merge=True, + ) + == "*the-non-printing-object*" + )