Skip to content

Commit

Permalink
Update server APIs for dev10 (#645)
Browse files Browse the repository at this point in the history
  • Loading branch information
ninad-kamat authored Nov 7, 2023
1 parent 5a0f6bb commit aa8ab22
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:

env:
DOCKER_IMAGE_NAME: ghcr.io/ansys/prime
DOCKER_IMAGE_TAG: '24.1.0.dev9'
DOCKER_IMAGE_TAG: '24.1.0.dev10'
MAIN_PYTHON_VERSION: '3.9'
PACKAGE_NAME: 'ansys-meshing-prime'
PACKAGE_NAMESPACE: 'ansys.meshing.prime'
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi"

[project]
name = "ansys-meshing-prime"
version = "0.5.0.dev9"
version = "0.5.0.dev10"
description = "PyPrimeMesh is a Python client to Ansys Prime Server, which delivers core Ansys meshing technology."
readme = "README.md"
requires-python = ">=3.8,<4"
Expand Down
49 changes: 42 additions & 7 deletions src/ansys/meshing/prime/autogen/fileiostructs.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,13 +500,16 @@ class FileWriteResults(CoreObject):

def __initialize(
self,
error_code: ErrorCode):
error_code: ErrorCode,
warning_codes: List[WarningCode]):
self._error_code = ErrorCode(error_code)
self._warning_codes = warning_codes

def __init__(
self,
model: CommunicationManager=None,
error_code: ErrorCode = None,
warning_codes: List[WarningCode] = None,
json_data : dict = None,
**kwargs):
"""Initializes the FileWriteResults.
Expand All @@ -517,6 +520,8 @@ def __init__(
Model to create a FileWriteResults object with default parameters.
error_code: ErrorCode, optional
Error code if file write operation is unsuccessful.
warning_codes: List[WarningCode], optional
Warning codes associated with the file write operation.
json_data: dict, optional
JSON dictionary to create a FileWriteResults object with provided parameters.
Expand All @@ -526,20 +531,23 @@ def __init__(
"""
if json_data:
self.__initialize(
ErrorCode(json_data["errorCode"] if "errorCode" in json_data else None))
ErrorCode(json_data["errorCode"] if "errorCode" in json_data else None),
[WarningCode(data) for data in json_data["warningCodes"]] if "warningCodes" in json_data else None)
else:
all_field_specified = all(arg is not None for arg in [error_code])
all_field_specified = all(arg is not None for arg in [error_code, warning_codes])
if all_field_specified:
self.__initialize(
error_code)
error_code,
warning_codes)
else:
if model is None:
raise ValueError("Invalid assignment. Either pass model or specify all properties")
else:
param_json = model._communicator.initialize_params(model, "FileWriteResults")
json_data = param_json["FileWriteResults"] if "FileWriteResults" in param_json else {}
self.__initialize(
error_code if error_code is not None else ( FileWriteResults._default_params["error_code"] if "error_code" in FileWriteResults._default_params else ErrorCode(json_data["errorCode"] if "errorCode" in json_data else None)))
error_code if error_code is not None else ( FileWriteResults._default_params["error_code"] if "error_code" in FileWriteResults._default_params else ErrorCode(json_data["errorCode"] if "errorCode" in json_data else None)),
warning_codes if warning_codes is not None else ( FileWriteResults._default_params["warning_codes"] if "warning_codes" in FileWriteResults._default_params else [WarningCode(data) for data in (json_data["warningCodes"] if "warningCodes" in json_data else None)]))
self._custom_params = kwargs
if model is not None:
[ model._logger.warning(f'Unsupported argument : {key}') for key in kwargs ]
Expand All @@ -549,13 +557,16 @@ def __init__(

@staticmethod
def set_default(
error_code: ErrorCode = None):
error_code: ErrorCode = None,
warning_codes: List[WarningCode] = None):
"""Set the default values of FileWriteResults.
Parameters
----------
error_code: ErrorCode, optional
Error code if file write operation is unsuccessful.
warning_codes: List[WarningCode], optional
Warning codes associated with the file write operation.
"""
args = locals()
[FileWriteResults._default_params.update({ key: value }) for key, value in args.items() if value is not None]
Expand All @@ -576,11 +587,13 @@ def _jsonify(self) -> Dict[str, Any]:
json_data = {}
if self._error_code is not None:
json_data["errorCode"] = self._error_code
if self._warning_codes is not None:
json_data["warningCodes"] = [data for data in self._warning_codes]
[ json_data.update({ utils.to_camel_case(key) : value }) for key, value in self._custom_params.items()]
return json_data

def __str__(self) -> str:
message = "error_code : %s" % (self._error_code)
message = "error_code : %s\nwarning_codes : %s" % (self._error_code, '[' + ''.join('\n' + str(data) for data in self._warning_codes) + ']')
message += ''.join('\n' + str(key) + ' : ' + str(value) for key, value in self._custom_params.items())
return message

Expand All @@ -594,6 +607,16 @@ def error_code(self) -> ErrorCode:
def error_code(self, value: ErrorCode):
self._error_code = value

@property
def warning_codes(self) -> List[WarningCode]:
"""Warning codes associated with the file write operation.
"""
return self._warning_codes

@warning_codes.setter
def warning_codes(self, value: List[WarningCode]):
self._warning_codes = value

class ReadSizeFieldParams(CoreObject):
"""Parameters used to read size field file.
"""
Expand Down Expand Up @@ -2460,16 +2483,22 @@ def __init__(
Model to create a ExportMapdlCdbParams object with default parameters.
material_properties: str, optional
Materials in CDB format that will be added to the file.
This parameter is a Beta. Parameter behavior and name may change in future.
boundary_conditions: str, optional
Boundary conditions in CDB format that will be appended to the file.
This parameter is a Beta. Parameter behavior and name may change in future.
write_cells: bool, optional
Option to write out cells as part of the file.
This parameter is a Beta. Parameter behavior and name may change in future.
enable_face_based_labels: bool, optional
Option to write element components for labels.
This parameter is a Beta. Parameter behavior and name may change in future.
write_by_zones: bool, optional
Option to write zones in the file.
This parameter is a Beta. Parameter behavior and name may change in future.
simulation_type: CdbSimulationType, optional
Simulation type for the file.
This parameter is a Beta. Parameter behavior and name may change in future.
json_data: dict, optional
JSON dictionary to create a ExportMapdlCdbParams object with provided parameters.
Expand Down Expand Up @@ -2580,6 +2609,7 @@ def __str__(self) -> str:
@property
def material_properties(self) -> str:
"""Materials in CDB format that will be added to the file.
This parameter is a Beta. Parameter behavior and name may change in future.
"""
return self._material_properties

Expand All @@ -2590,6 +2620,7 @@ def material_properties(self, value: str):
@property
def boundary_conditions(self) -> str:
"""Boundary conditions in CDB format that will be appended to the file.
This parameter is a Beta. Parameter behavior and name may change in future.
"""
return self._boundary_conditions

Expand All @@ -2600,6 +2631,7 @@ def boundary_conditions(self, value: str):
@property
def write_cells(self) -> bool:
"""Option to write out cells as part of the file.
This parameter is a Beta. Parameter behavior and name may change in future.
"""
return self._write_cells

Expand All @@ -2610,6 +2642,7 @@ def write_cells(self, value: bool):
@property
def enable_face_based_labels(self) -> bool:
"""Option to write element components for labels.
This parameter is a Beta. Parameter behavior and name may change in future.
"""
return self._enable_face_based_labels

Expand All @@ -2620,6 +2653,7 @@ def enable_face_based_labels(self, value: bool):
@property
def write_by_zones(self) -> bool:
"""Option to write zones in the file.
This parameter is a Beta. Parameter behavior and name may change in future.
"""
return self._write_by_zones

Expand All @@ -2630,6 +2664,7 @@ def write_by_zones(self, value: bool):
@property
def simulation_type(self) -> CdbSimulationType:
"""Simulation type for the file.
This parameter is a Beta. Parameter behavior and name may change in future.
"""
return self._simulation_type

Expand Down
2 changes: 2 additions & 0 deletions src/ansys/meshing/prime/autogen/primeconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,8 @@ class WarningCode(enum.IntEnum):
"""Maximum value of min aspect ratio from selected prism controls is considered for all selected prism controls."""
PARTNOTINPARTSCOPE = 601
"""Selected part is not in the part scope of the periodic control."""
NUMERICPARTNAMERENAMETOALPHANUMERIC = 701
"""Numeric part name renamed to alphanumeric name."""
SURFERLAYEREDQUADFAILED = 1800
"""Layered quad failed with surfer."""
SURFERDEGENERATEFACE = 1801
Expand Down
1 change: 1 addition & 0 deletions src/ansys/meshing/prime/internals/error_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@
WarningCode.OVERRIDEVOLUMESCOPEENTITY: "Invalid volume scope entity, override by volume.",
WarningCode.MAXOFPRISMCONTROLSMINASPECTRATIO: "Maximum value of min aspect ratio from selected prism controls is considered for all selected prism controls.",
WarningCode.PARTNOTINPARTSCOPE: "The selected part is not in the part scope of the periodic control.",
WarningCode.NUMERICPARTNAMERENAMETOALPHANUMERIC: "Numeric part name renamed to alphanumeric name.",
WarningCode.OVERRIDESUGGESTEDNAME: "Given name not available. Overriding it with unique name.",
WarningCode.WRAPPER_SIZECONTROLNOTDEFINED: "No size controls provided for wrapper. Global sizes will be used.",
WarningCode.WRAPPER_SIZECONTROLNOTSUPPORTED: "Size control is not supported in wrapper. Skipping it.",
Expand Down

0 comments on commit aa8ab22

Please sign in to comment.