Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update code from server for dev6 #587

Merged
merged 2 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.dev2'
DOCKER_IMAGE_TAG: '24.1.0.dev6'
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.dev3"
version = "0.5.0.dev6"
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
1 change: 1 addition & 0 deletions src/ansys/meshing/prime/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
from ansys.meshing.prime.autogen.thinvolumecontrolstructs import *
from ansys.meshing.prime.autogen.volumemeshtoolstructs import *
from ansys.meshing.prime.autogen.volumesweeperstructs import *
from ansys.meshing.prime.autogen.topodatastructs import *
from ansys.meshing.prime.autogen.topoutilitystructs import *
from ansys.meshing.prime.autogen.morpherstructs import *
from ansys.meshing.prime.autogen.morpherbcsstructs import *
Expand Down
124 changes: 124 additions & 0 deletions src/ansys/meshing/prime/autogen/controlstructs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1263,3 +1263,127 @@ def warning_code(self) -> WarningCode:
@warning_code.setter
def warning_code(self, value: WarningCode):
self._warning_code = value

class SetParamsResults(CoreObject):
"""Results associated with the set parameters operation.
"""
_default_params = {}

def __initialize(
self,
error_code: ErrorCode,
warning_code: WarningCode):
self._error_code = ErrorCode(error_code)
self._warning_code = WarningCode(warning_code)

def __init__(
self,
model: CommunicationManager=None,
error_code: ErrorCode = None,
warning_code: WarningCode = None,
json_data : dict = None,
**kwargs):
"""Initializes the SetParamsResults.

Parameters
----------
model: Model
Model to create a SetParamsResults object with default parameters.
error_code: ErrorCode, optional
Error code associated with the set parameters operation.
warning_code: WarningCode, optional
Warning code associated with the set parameters operation.
json_data: dict, optional
JSON dictionary to create a SetParamsResults object with provided parameters.

Examples
--------
>>> set_params_results = prime.SetParamsResults(model = model)
"""
if json_data:
self.__initialize(
ErrorCode(json_data["errorCode"] if "errorCode" in json_data else None),
WarningCode(json_data["warningCode"] if "warningCode" in json_data else None))
else:
all_field_specified = all(arg is not None for arg in [error_code, warning_code])
if all_field_specified:
self.__initialize(
error_code,
warning_code)
else:
if model is None:
raise ValueError("Invalid assignment. Either pass model or specify all properties")
else:
param_json = model._communicator.initialize_params(model, "SetParamsResults")
json_data = param_json["SetParamsResults"] if "SetParamsResults" in param_json else {}
self.__initialize(
error_code if error_code is not None else ( SetParamsResults._default_params["error_code"] if "error_code" in SetParamsResults._default_params else ErrorCode(json_data["errorCode"] if "errorCode" in json_data else None)),
warning_code if warning_code is not None else ( SetParamsResults._default_params["warning_code"] if "warning_code" in SetParamsResults._default_params else WarningCode(json_data["warningCode"] if "warningCode" 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 ]
[setattr(type(self), key, property(lambda self, key = key: self._custom_params[key] if key in self._custom_params else None,
lambda self, value, key = key : self._custom_params.update({ key: value }))) for key in kwargs]
self._freeze()

@staticmethod
def set_default(
error_code: ErrorCode = None,
warning_code: WarningCode = None):
"""Set the default values of SetParamsResults.

Parameters
----------
error_code: ErrorCode, optional
Error code associated with the set parameters operation.
warning_code: WarningCode, optional
Warning code associated with the set parameters operation.
"""
args = locals()
[SetParamsResults._default_params.update({ key: value }) for key, value in args.items() if value is not None]

@staticmethod
def print_default():
"""Print the default values of SetParamsResults.

Examples
--------
>>> SetParamsResults.print_default()
"""
message = ""
message += ''.join(str(key) + ' : ' + str(value) + '\n' for key, value in SetParamsResults._default_params.items())
print(message)

def _jsonify(self) -> Dict[str, Any]:
json_data = {}
if self._error_code is not None:
json_data["errorCode"] = self._error_code
if self._warning_code is not None:
json_data["warningCode"] = self._warning_code
[ 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\nwarning_code : %s" % (self._error_code, self._warning_code)
message += ''.join('\n' + str(key) + ' : ' + str(value) for key, value in self._custom_params.items())
return message

@property
def error_code(self) -> ErrorCode:
"""Error code associated with the set parameters operation.
"""
return self._error_code

@error_code.setter
def error_code(self, value: ErrorCode):
self._error_code = value

@property
def warning_code(self) -> WarningCode:
"""Warning code associated with the set parameters operation.
"""
return self._warning_code

@warning_code.setter
def warning_code(self, value: WarningCode):
self._warning_code = value
37 changes: 30 additions & 7 deletions src/ansys/meshing/prime/autogen/featureextractionstructs.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ def __initialize(
separate_features: bool,
separation_angle: float,
disconnect_with_faces: bool,
label_name: str):
label_name: str,
number_of_threads: int):
self._replace = replace
self._feature_angle = feature_angle
self._separate_features = separate_features
self._separation_angle = separation_angle
self._disconnect_with_faces = disconnect_with_faces
self._label_name = label_name
self._number_of_threads = number_of_threads

def __init__(
self,
Expand All @@ -37,6 +39,7 @@ def __init__(
separation_angle: float = None,
disconnect_with_faces: bool = None,
label_name: str = None,
number_of_threads: int = None,
json_data : dict = None,
**kwargs):
"""Initializes the ExtractFeatureParams.
Expand All @@ -57,6 +60,8 @@ def __init__(
Option to disconnect edges from faces. If false, edges remain connected to faces by sharing nodes.
label_name: str, optional
Label name to be assigned to extracted features.
number_of_threads: int, optional
Number of threads used for multithreading.
json_data: dict, optional
JSON dictionary to create a ExtractFeatureParams object with provided parameters.

Expand All @@ -71,17 +76,19 @@ def __init__(
json_data["separateFeatures"] if "separateFeatures" in json_data else None,
json_data["separationAngle"] if "separationAngle" in json_data else None,
json_data["disconnectWithFaces"] if "disconnectWithFaces" in json_data else None,
json_data["labelName"] if "labelName" in json_data else None)
json_data["labelName"] if "labelName" in json_data else None,
json_data["numberOfThreads"] if "numberOfThreads" in json_data else None)
else:
all_field_specified = all(arg is not None for arg in [replace, feature_angle, separate_features, separation_angle, disconnect_with_faces, label_name])
all_field_specified = all(arg is not None for arg in [replace, feature_angle, separate_features, separation_angle, disconnect_with_faces, label_name, number_of_threads])
if all_field_specified:
self.__initialize(
replace,
feature_angle,
separate_features,
separation_angle,
disconnect_with_faces,
label_name)
label_name,
number_of_threads)
else:
if model is None:
raise ValueError("Invalid assignment. Either pass model or specify all properties")
Expand All @@ -94,7 +101,8 @@ def __init__(
separate_features if separate_features is not None else ( ExtractFeatureParams._default_params["separate_features"] if "separate_features" in ExtractFeatureParams._default_params else (json_data["separateFeatures"] if "separateFeatures" in json_data else None)),
separation_angle if separation_angle is not None else ( ExtractFeatureParams._default_params["separation_angle"] if "separation_angle" in ExtractFeatureParams._default_params else (json_data["separationAngle"] if "separationAngle" in json_data else None)),
disconnect_with_faces if disconnect_with_faces is not None else ( ExtractFeatureParams._default_params["disconnect_with_faces"] if "disconnect_with_faces" in ExtractFeatureParams._default_params else (json_data["disconnectWithFaces"] if "disconnectWithFaces" in json_data else None)),
label_name if label_name is not None else ( ExtractFeatureParams._default_params["label_name"] if "label_name" in ExtractFeatureParams._default_params else (json_data["labelName"] if "labelName" in json_data else None)))
label_name if label_name is not None else ( ExtractFeatureParams._default_params["label_name"] if "label_name" in ExtractFeatureParams._default_params else (json_data["labelName"] if "labelName" in json_data else None)),
number_of_threads if number_of_threads is not None else ( ExtractFeatureParams._default_params["number_of_threads"] if "number_of_threads" in ExtractFeatureParams._default_params else (json_data["numberOfThreads"] if "numberOfThreads" 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 @@ -109,7 +117,8 @@ def set_default(
separate_features: bool = None,
separation_angle: float = None,
disconnect_with_faces: bool = None,
label_name: str = None):
label_name: str = None,
number_of_threads: int = None):
"""Set the default values of ExtractFeatureParams.

Parameters
Expand All @@ -126,6 +135,8 @@ def set_default(
Option to disconnect edges from faces. If false, edges remain connected to faces by sharing nodes.
label_name: str, optional
Label name to be assigned to extracted features.
number_of_threads: int, optional
Number of threads used for multithreading.
"""
args = locals()
[ExtractFeatureParams._default_params.update({ key: value }) for key, value in args.items() if value is not None]
Expand Down Expand Up @@ -156,11 +167,13 @@ def _jsonify(self) -> Dict[str, Any]:
json_data["disconnectWithFaces"] = self._disconnect_with_faces
if self._label_name is not None:
json_data["labelName"] = self._label_name
if self._number_of_threads is not None:
json_data["numberOfThreads"] = self._number_of_threads
[ 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 = "replace : %s\nfeature_angle : %s\nseparate_features : %s\nseparation_angle : %s\ndisconnect_with_faces : %s\nlabel_name : %s" % (self._replace, self._feature_angle, self._separate_features, self._separation_angle, self._disconnect_with_faces, self._label_name)
message = "replace : %s\nfeature_angle : %s\nseparate_features : %s\nseparation_angle : %s\ndisconnect_with_faces : %s\nlabel_name : %s\nnumber_of_threads : %s" % (self._replace, self._feature_angle, self._separate_features, self._separation_angle, self._disconnect_with_faces, self._label_name, self._number_of_threads)
message += ''.join('\n' + str(key) + ' : ' + str(value) for key, value in self._custom_params.items())
return message

Expand Down Expand Up @@ -224,6 +237,16 @@ def label_name(self) -> str:
def label_name(self, value: str):
self._label_name = value

@property
def number_of_threads(self) -> int:
"""Number of threads used for multithreading.
"""
return self._number_of_threads

@number_of_threads.setter
def number_of_threads(self, value: int):
self._number_of_threads = value

class ExtractFeatureResults(CoreObject):
"""Result of edge zonelet extraction by angle.
"""
Expand Down
Loading
Loading