-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
404befa
commit e2642c8
Showing
27 changed files
with
10,866 additions
and
13 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
323 changes: 323 additions & 0 deletions
323
src/ansys/dpf/core/operators/metadata/coordinate_system_data_provider.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,323 @@ | ||
""" | ||
coordinate_system_data_provider | ||
Autogenerated DPF operator classes. | ||
""" | ||
|
||
from warnings import warn | ||
from ansys.dpf.core.dpf_operator import Operator | ||
from ansys.dpf.core.inputs import Input, _Inputs | ||
from ansys.dpf.core.outputs import Output, _Outputs | ||
from ansys.dpf.core.operators.specification import PinSpecification, Specification | ||
|
||
|
||
class coordinate_system_data_provider(Operator): | ||
"""Reads coordinate systems data from the result files contained in the | ||
streams or data sources. | ||
Parameters | ||
---------- | ||
solver_coordinate_system_ids : int, optional | ||
Coorfinate system ids to recover used by the | ||
solver. if not set, all available | ||
materials to be recovered. | ||
streams : StreamsContainer, optional | ||
Result file container allowed to be kept open | ||
to cache data. | ||
data_sources : DataSources | ||
Result file path container, used if no | ||
streams are set. | ||
Returns | ||
------- | ||
coordinate_system_data1 : GenericDataContainer | ||
coordinate_system_data2 : GenericDataContainer | ||
Examples | ||
-------- | ||
>>> from ansys.dpf import core as dpf | ||
>>> # Instantiate operator | ||
>>> op = dpf.operators.metadata.coordinate_system_data_provider() | ||
>>> # Make input connections | ||
>>> my_solver_coordinate_system_ids = int() | ||
>>> op.inputs.solver_coordinate_system_ids.connect(my_solver_coordinate_system_ids) | ||
>>> my_streams = dpf.StreamsContainer() | ||
>>> op.inputs.streams.connect(my_streams) | ||
>>> my_data_sources = dpf.DataSources() | ||
>>> op.inputs.data_sources.connect(my_data_sources) | ||
>>> # Instantiate operator and connect inputs in one line | ||
>>> op = dpf.operators.metadata.coordinate_system_data_provider( | ||
... solver_coordinate_system_ids=my_solver_coordinate_system_ids, | ||
... streams=my_streams, | ||
... data_sources=my_data_sources, | ||
... ) | ||
>>> # Get output data | ||
>>> result_coordinate_system_data1 = op.outputs.coordinate_system_data1() | ||
>>> result_coordinate_system_data2 = op.outputs.coordinate_system_data2() | ||
""" | ||
|
||
def __init__( | ||
self, | ||
solver_coordinate_system_ids=None, | ||
streams=None, | ||
data_sources=None, | ||
config=None, | ||
server=None, | ||
): | ||
super().__init__( | ||
name="coordinate_systems_data_provider", config=config, server=server | ||
) | ||
self._inputs = InputsCoordinateSystemDataProvider(self) | ||
self._outputs = OutputsCoordinateSystemDataProvider(self) | ||
if solver_coordinate_system_ids is not None: | ||
self.inputs.solver_coordinate_system_ids.connect( | ||
solver_coordinate_system_ids | ||
) | ||
if streams is not None: | ||
self.inputs.streams.connect(streams) | ||
if data_sources is not None: | ||
self.inputs.data_sources.connect(data_sources) | ||
|
||
@staticmethod | ||
def _spec(): | ||
description = """Reads coordinate systems data from the result files contained in the | ||
streams or data sources.""" | ||
spec = Specification( | ||
description=description, | ||
map_input_pin_spec={ | ||
1: PinSpecification( | ||
name="solver_coordinate_system_ids", | ||
type_names=["int32", "vector<int32>"], | ||
optional=True, | ||
document="""Coorfinate system ids to recover used by the | ||
solver. if not set, all available | ||
materials to be recovered.""", | ||
), | ||
3: PinSpecification( | ||
name="streams", | ||
type_names=["streams_container"], | ||
optional=True, | ||
document="""Result file container allowed to be kept open | ||
to cache data.""", | ||
), | ||
4: PinSpecification( | ||
name="data_sources", | ||
type_names=["data_sources"], | ||
optional=False, | ||
document="""Result file path container, used if no | ||
streams are set.""", | ||
), | ||
}, | ||
map_output_pin_spec={ | ||
0: PinSpecification( | ||
name="coordinate_system_data1", | ||
type_names=["generic_data_container"], | ||
optional=False, | ||
document="""""", | ||
), | ||
1: PinSpecification( | ||
name="coordinate_system_data2", | ||
type_names=["generic_data_container"], | ||
optional=False, | ||
document="""""", | ||
), | ||
}, | ||
) | ||
return spec | ||
|
||
@staticmethod | ||
def default_config(server=None): | ||
"""Returns the default config of the operator. | ||
This config can then be changed to the user needs and be used to | ||
instantiate the operator. The Configuration allows to customize | ||
how the operation will be processed by the operator. | ||
Parameters | ||
---------- | ||
server : server.DPFServer, optional | ||
Server with channel connected to the remote or local instance. When | ||
``None``, attempts to use the global server. | ||
""" | ||
return Operator.default_config( | ||
name="coordinate_systems_data_provider", server=server | ||
) | ||
|
||
@property | ||
def inputs(self): | ||
"""Enables to connect inputs to the operator | ||
Returns | ||
-------- | ||
inputs : InputsCoordinateSystemDataProvider | ||
""" | ||
return super().inputs | ||
|
||
@property | ||
def outputs(self): | ||
"""Enables to get outputs of the operator by evaluating it | ||
Returns | ||
-------- | ||
outputs : OutputsCoordinateSystemDataProvider | ||
""" | ||
return super().outputs | ||
|
||
|
||
class InputsCoordinateSystemDataProvider(_Inputs): | ||
"""Intermediate class used to connect user inputs to | ||
coordinate_system_data_provider operator. | ||
Examples | ||
-------- | ||
>>> from ansys.dpf import core as dpf | ||
>>> op = dpf.operators.metadata.coordinate_system_data_provider() | ||
>>> my_solver_coordinate_system_ids = int() | ||
>>> op.inputs.solver_coordinate_system_ids.connect(my_solver_coordinate_system_ids) | ||
>>> my_streams = dpf.StreamsContainer() | ||
>>> op.inputs.streams.connect(my_streams) | ||
>>> my_data_sources = dpf.DataSources() | ||
>>> op.inputs.data_sources.connect(my_data_sources) | ||
""" | ||
|
||
def __init__(self, op: Operator): | ||
super().__init__(coordinate_system_data_provider._spec().inputs, op) | ||
self._solver_coordinate_system_ids = Input( | ||
coordinate_system_data_provider._spec().input_pin(1), 1, op, -1 | ||
) | ||
self._inputs.append(self._solver_coordinate_system_ids) | ||
self._streams = Input( | ||
coordinate_system_data_provider._spec().input_pin(3), 3, op, -1 | ||
) | ||
self._inputs.append(self._streams) | ||
self._data_sources = Input( | ||
coordinate_system_data_provider._spec().input_pin(4), 4, op, -1 | ||
) | ||
self._inputs.append(self._data_sources) | ||
|
||
@property | ||
def solver_coordinate_system_ids(self): | ||
"""Allows to connect solver_coordinate_system_ids input to the operator. | ||
Coorfinate system ids to recover used by the | ||
solver. if not set, all available | ||
materials to be recovered. | ||
Parameters | ||
---------- | ||
my_solver_coordinate_system_ids : int | ||
Examples | ||
-------- | ||
>>> from ansys.dpf import core as dpf | ||
>>> op = dpf.operators.metadata.coordinate_system_data_provider() | ||
>>> op.inputs.solver_coordinate_system_ids.connect(my_solver_coordinate_system_ids) | ||
>>> # or | ||
>>> op.inputs.solver_coordinate_system_ids(my_solver_coordinate_system_ids) | ||
""" | ||
return self._solver_coordinate_system_ids | ||
|
||
@property | ||
def streams(self): | ||
"""Allows to connect streams input to the operator. | ||
Result file container allowed to be kept open | ||
to cache data. | ||
Parameters | ||
---------- | ||
my_streams : StreamsContainer | ||
Examples | ||
-------- | ||
>>> from ansys.dpf import core as dpf | ||
>>> op = dpf.operators.metadata.coordinate_system_data_provider() | ||
>>> op.inputs.streams.connect(my_streams) | ||
>>> # or | ||
>>> op.inputs.streams(my_streams) | ||
""" | ||
return self._streams | ||
|
||
@property | ||
def data_sources(self): | ||
"""Allows to connect data_sources input to the operator. | ||
Result file path container, used if no | ||
streams are set. | ||
Parameters | ||
---------- | ||
my_data_sources : DataSources | ||
Examples | ||
-------- | ||
>>> from ansys.dpf import core as dpf | ||
>>> op = dpf.operators.metadata.coordinate_system_data_provider() | ||
>>> op.inputs.data_sources.connect(my_data_sources) | ||
>>> # or | ||
>>> op.inputs.data_sources(my_data_sources) | ||
""" | ||
return self._data_sources | ||
|
||
|
||
class OutputsCoordinateSystemDataProvider(_Outputs): | ||
"""Intermediate class used to get outputs from | ||
coordinate_system_data_provider operator. | ||
Examples | ||
-------- | ||
>>> from ansys.dpf import core as dpf | ||
>>> op = dpf.operators.metadata.coordinate_system_data_provider() | ||
>>> # Connect inputs : op.inputs. ... | ||
>>> result_coordinate_system_data1 = op.outputs.coordinate_system_data1() | ||
>>> result_coordinate_system_data2 = op.outputs.coordinate_system_data2() | ||
""" | ||
|
||
def __init__(self, op: Operator): | ||
super().__init__(coordinate_system_data_provider._spec().outputs, op) | ||
self._coordinate_system_data1 = Output( | ||
coordinate_system_data_provider._spec().output_pin(0), 0, op | ||
) | ||
self._outputs.append(self._coordinate_system_data1) | ||
self._coordinate_system_data2 = Output( | ||
coordinate_system_data_provider._spec().output_pin(1), 1, op | ||
) | ||
self._outputs.append(self._coordinate_system_data2) | ||
|
||
@property | ||
def coordinate_system_data1(self): | ||
"""Allows to get coordinate_system_data1 output of the operator | ||
Returns | ||
---------- | ||
my_coordinate_system_data1 : GenericDataContainer | ||
Examples | ||
-------- | ||
>>> from ansys.dpf import core as dpf | ||
>>> op = dpf.operators.metadata.coordinate_system_data_provider() | ||
>>> # Connect inputs : op.inputs. ... | ||
>>> result_coordinate_system_data1 = op.outputs.coordinate_system_data1() | ||
""" # noqa: E501 | ||
return self._coordinate_system_data1 | ||
|
||
@property | ||
def coordinate_system_data2(self): | ||
"""Allows to get coordinate_system_data2 output of the operator | ||
Returns | ||
---------- | ||
my_coordinate_system_data2 : GenericDataContainer | ||
Examples | ||
-------- | ||
>>> from ansys.dpf import core as dpf | ||
>>> op = dpf.operators.metadata.coordinate_system_data_provider() | ||
>>> # Connect inputs : op.inputs. ... | ||
>>> result_coordinate_system_data2 = op.outputs.coordinate_system_data2() | ||
""" # noqa: E501 | ||
return self._coordinate_system_data2 |
Oops, something went wrong.