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

SVAR data access #1560

Merged
merged 1 commit into from
Apr 26, 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 setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
shutil.copy2(_README_FILE, _DOCS_FILE)

install_requires = [
"ansys-api-fluent==0.3.11",
"ansys-api-fluent==0.3.12",
"ansys-platform-instancemanagement~=1.0",
"grpcio>=1.30.0",
"numpy>=1.21.5",
Expand Down
13 changes: 12 additions & 1 deletion src/ansys/fluent/core/fluent_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from ansys.fluent.core.services.reduction import Reduction, ReductionService
from ansys.fluent.core.services.scheme_eval import SchemeEval, SchemeEvalService
from ansys.fluent.core.services.settings import SettingsService
from ansys.fluent.core.services.svar import SVARData, SVARInfo, SVARService
from ansys.fluent.core.streaming_services.datamodel_event_streaming import (
DatamodelEvents,
)
Expand Down Expand Up @@ -228,11 +229,13 @@ def __init__(

self._field_data_service = FieldDataService(self._channel, self._metadata)
self.field_info = FieldInfo(self._field_data_service)

self.field_data = FieldData(
self._field_data_service, self.field_info, _IsDataValid(self.scheme_eval)
)

self._svar_service = SVARService(self._channel, self._metadata)
self.svar_info = SVARInfo(self._svar_service)

self.journal = Journal(self.scheme_eval)

self._cleanup_on_exit = cleanup_on_exit
Expand All @@ -257,6 +260,14 @@ def __init__(
)
FluentConnection._monitor_thread.cbs.append(self._finalizer)

@property
def svar_data(self) -> SVARData:
"""Return the SVARData handle."""
try:
return SVARData(self._svar_service, self.svar_info)
except RuntimeError:
return None

@property
def id(self) -> str:
"""Return the session id."""
Expand Down
6 changes: 6 additions & 0 deletions src/ansys/fluent/core/services/field_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,12 @@ class _FieldDataConstants:
FieldDataProtoModule.FieldType.FLOAT_ARRAY: np.float32,
FieldDataProtoModule.FieldType.DOUBLE_ARRAY: np.float64,
}
np_data_type_to_proto_field_type = {
np.int32: FieldDataProtoModule.FieldType.INT_ARRAY,
np.int64: FieldDataProtoModule.FieldType.LONG_ARRAY,
np.float32: FieldDataProtoModule.FieldType.FLOAT_ARRAY,
np.float64: FieldDataProtoModule.FieldType.DOUBLE_ARRAY,
}
chunk_size = 256 * 1024
bytes_stream = True
payloadTags = {
Expand Down
Loading