Skip to content
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
87 changes: 7 additions & 80 deletions docs/source/_static/dpf_operators.html

Large diffs are not rendered by default.

65 changes: 54 additions & 11 deletions src/ansys/dpf/core/operators/math/accumulate_level_over_label_fc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@


class accumulate_level_over_label_fc(Operator):
"""Compute the component-wise sum over all the fields having the same id
for the label set in input in the fields container and apply
"""Compute the component-wise sum over all the fields that have the same
ID as the label set as input in the fields container and apply
10.0xlog10(data/10xx-12) on the result. This computation can be
incremental, if the input fields container is connected and the
operator is ran several time, the output field will be on all the
inputs connected
incremental. If the input fields container is connected and the
operator is run multiple times, the output field will be on all
the connected inputs.

Parameters
----------
fields_container : FieldsContainer
label : str, optional
Label of the fields container where it should
operate.


Examples
Expand All @@ -33,33 +36,39 @@ class accumulate_level_over_label_fc(Operator):
>>> # Make input connections
>>> my_fields_container = dpf.FieldsContainer()
>>> op.inputs.fields_container.connect(my_fields_container)
>>> my_label = str()
>>> op.inputs.label.connect(my_label)

>>> # Instantiate operator and connect inputs in one line
>>> op = dpf.operators.math.accumulate_level_over_label_fc(
... fields_container=my_fields_container,
... label=my_label,
... )

>>> # Get output data
>>> result_field = op.outputs.field()
"""

def __init__(self, fields_container=None, config=None, server=None):
def __init__(self, fields_container=None, label=None, config=None, server=None):
super().__init__(
name="accumulate_level_over_label_fc", config=config, server=server
)
self._inputs = InputsAccumulateLevelOverLabelFc(self)
self._outputs = OutputsAccumulateLevelOverLabelFc(self)
if fields_container is not None:
self.inputs.fields_container.connect(fields_container)
if label is not None:
self.inputs.label.connect(label)

@staticmethod
def _spec():
description = """Compute the component-wise sum over all the fields having the same id
for the label set in input in the fields container and
description = """Compute the component-wise sum over all the fields that have the same
ID as the label set as input in the fields container and
apply 10.0xlog10(data/10xx-12) on the result. This
computation can be incremental, if the input fields
container is connected and the operator is ran several
time, the output field will be on all the inputs connected"""
computation can be incremental. If the input fields
container is connected and the operator is run multiple
times, the output field will be on all the connected
inputs."""
spec = Specification(
description=description,
map_input_pin_spec={
Expand All @@ -69,6 +78,13 @@ def _spec():
optional=False,
document="""""",
),
1: PinSpecification(
name="label",
type_names=["string"],
optional=True,
document="""Label of the fields container where it should
operate.""",
),
},
map_output_pin_spec={
0: PinSpecification(
Expand Down Expand Up @@ -130,6 +146,8 @@ class InputsAccumulateLevelOverLabelFc(_Inputs):
>>> op = dpf.operators.math.accumulate_level_over_label_fc()
>>> my_fields_container = dpf.FieldsContainer()
>>> op.inputs.fields_container.connect(my_fields_container)
>>> my_label = str()
>>> op.inputs.label.connect(my_label)
"""

def __init__(self, op: Operator):
Expand All @@ -138,6 +156,10 @@ def __init__(self, op: Operator):
accumulate_level_over_label_fc._spec().input_pin(0), 0, op, -1
)
self._inputs.append(self._fields_container)
self._label = Input(
accumulate_level_over_label_fc._spec().input_pin(1), 1, op, -1
)
self._inputs.append(self._label)

@property
def fields_container(self):
Expand All @@ -157,6 +179,27 @@ def fields_container(self):
"""
return self._fields_container

@property
def label(self):
"""Allows to connect label input to the operator.

Label of the fields container where it should
operate.

Parameters
----------
my_label : str

Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.math.accumulate_level_over_label_fc()
>>> op.inputs.label.connect(my_label)
>>> # or
>>> op.inputs.label(my_label)
"""
return self._label


class OutputsAccumulateLevelOverLabelFc(_Outputs):
"""Intermediate class used to get outputs from
Expand Down
64 changes: 53 additions & 11 deletions src/ansys/dpf/core/operators/math/accumulate_min_over_label_fc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@


class accumulate_min_over_label_fc(Operator):
"""Compute the component-wise sum over all the fields having the same id
for the label set in input in the fields container and take its
opposite. This computation can be incremental, if the input fields
container is connected and the operator is ran several time, the
output field will be on all the inputs connected
"""Compute the component-wise sum over all the fields that have the same
ID as the label set as input in the fields container and take its
opposite. This computation can be incremental. If the input fields
container is connected and the operator is run multiple times, the
output field will be on all the connected inputs.

Parameters
----------
fields_container : FieldsContainer
label : str, optional
Label of the fields container where it should
operate.


Examples
Expand All @@ -32,33 +35,38 @@ class accumulate_min_over_label_fc(Operator):
>>> # Make input connections
>>> my_fields_container = dpf.FieldsContainer()
>>> op.inputs.fields_container.connect(my_fields_container)
>>> my_label = str()
>>> op.inputs.label.connect(my_label)

>>> # Instantiate operator and connect inputs in one line
>>> op = dpf.operators.math.accumulate_min_over_label_fc(
... fields_container=my_fields_container,
... label=my_label,
... )

>>> # Get output data
>>> result_field = op.outputs.field()
"""

def __init__(self, fields_container=None, config=None, server=None):
def __init__(self, fields_container=None, label=None, config=None, server=None):
super().__init__(
name="accumulate_min_over_label_fc", config=config, server=server
)
self._inputs = InputsAccumulateMinOverLabelFc(self)
self._outputs = OutputsAccumulateMinOverLabelFc(self)
if fields_container is not None:
self.inputs.fields_container.connect(fields_container)
if label is not None:
self.inputs.label.connect(label)

@staticmethod
def _spec():
description = """Compute the component-wise sum over all the fields having the same id
for the label set in input in the fields container and
take its opposite. This computation can be incremental, if
description = """Compute the component-wise sum over all the fields that have the same
ID as the label set as input in the fields container and
take its opposite. This computation can be incremental. If
the input fields container is connected and the operator
is ran several time, the output field will be on all the
inputs connected"""
is run multiple times, the output field will be on all the
connected inputs."""
spec = Specification(
description=description,
map_input_pin_spec={
Expand All @@ -68,6 +76,13 @@ def _spec():
optional=False,
document="""""",
),
1: PinSpecification(
name="label",
type_names=["string"],
optional=True,
document="""Label of the fields container where it should
operate.""",
),
},
map_output_pin_spec={
0: PinSpecification(
Expand Down Expand Up @@ -129,6 +144,8 @@ class InputsAccumulateMinOverLabelFc(_Inputs):
>>> op = dpf.operators.math.accumulate_min_over_label_fc()
>>> my_fields_container = dpf.FieldsContainer()
>>> op.inputs.fields_container.connect(my_fields_container)
>>> my_label = str()
>>> op.inputs.label.connect(my_label)
"""

def __init__(self, op: Operator):
Expand All @@ -137,6 +154,10 @@ def __init__(self, op: Operator):
accumulate_min_over_label_fc._spec().input_pin(0), 0, op, -1
)
self._inputs.append(self._fields_container)
self._label = Input(
accumulate_min_over_label_fc._spec().input_pin(1), 1, op, -1
)
self._inputs.append(self._label)

@property
def fields_container(self):
Expand All @@ -156,6 +177,27 @@ def fields_container(self):
"""
return self._fields_container

@property
def label(self):
"""Allows to connect label input to the operator.

Label of the fields container where it should
operate.

Parameters
----------
my_label : str

Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.math.accumulate_min_over_label_fc()
>>> op.inputs.label.connect(my_label)
>>> # or
>>> op.inputs.label(my_label)
"""
return self._label


class OutputsAccumulateMinOverLabelFc(_Outputs):
"""Intermediate class used to get outputs from
Expand Down
63 changes: 52 additions & 11 deletions src/ansys/dpf/core/operators/math/accumulate_over_label_fc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@


class accumulate_over_label_fc(Operator):
"""Compute the component-wise sum over all the fields having the same id
for the label set in input in the fields container. This
computation can be incremental, if the input fields container is
connected and the operator is ran several time, the output field
will be on all the inputs connected
"""Compute the component-wise sum over all the fields that have the same
ID as the label set as input in the fields container. This
computation can be incremental. If the input fields container is
connected and the operator is run multiple times, the output field
will be on all the connected inputs.

Parameters
----------
fields_container : FieldsContainer
label : str, optional
Label of the fields container where it should
operate.


Examples
Expand All @@ -32,30 +35,36 @@ class accumulate_over_label_fc(Operator):
>>> # Make input connections
>>> my_fields_container = dpf.FieldsContainer()
>>> op.inputs.fields_container.connect(my_fields_container)
>>> my_label = str()
>>> op.inputs.label.connect(my_label)

>>> # Instantiate operator and connect inputs in one line
>>> op = dpf.operators.math.accumulate_over_label_fc(
... fields_container=my_fields_container,
... label=my_label,
... )

>>> # Get output data
>>> result_field = op.outputs.field()
"""

def __init__(self, fields_container=None, config=None, server=None):
def __init__(self, fields_container=None, label=None, config=None, server=None):
super().__init__(name="accumulate_over_label_fc", config=config, server=server)
self._inputs = InputsAccumulateOverLabelFc(self)
self._outputs = OutputsAccumulateOverLabelFc(self)
if fields_container is not None:
self.inputs.fields_container.connect(fields_container)
if label is not None:
self.inputs.label.connect(label)

@staticmethod
def _spec():
description = """Compute the component-wise sum over all the fields having the same id
for the label set in input in the fields container. This
computation can be incremental, if the input fields
container is connected and the operator is ran several
time, the output field will be on all the inputs connected"""
description = """Compute the component-wise sum over all the fields that have the same
ID as the label set as input in the fields container. This
computation can be incremental. If the input fields
container is connected and the operator is run multiple
times, the output field will be on all the connected
inputs."""
spec = Specification(
description=description,
map_input_pin_spec={
Expand All @@ -65,6 +74,13 @@ def _spec():
optional=False,
document="""""",
),
1: PinSpecification(
name="label",
type_names=["string"],
optional=True,
document="""Label of the fields container where it should
operate.""",
),
},
map_output_pin_spec={
0: PinSpecification(
Expand Down Expand Up @@ -124,6 +140,8 @@ class InputsAccumulateOverLabelFc(_Inputs):
>>> op = dpf.operators.math.accumulate_over_label_fc()
>>> my_fields_container = dpf.FieldsContainer()
>>> op.inputs.fields_container.connect(my_fields_container)
>>> my_label = str()
>>> op.inputs.label.connect(my_label)
"""

def __init__(self, op: Operator):
Expand All @@ -132,6 +150,8 @@ def __init__(self, op: Operator):
accumulate_over_label_fc._spec().input_pin(0), 0, op, -1
)
self._inputs.append(self._fields_container)
self._label = Input(accumulate_over_label_fc._spec().input_pin(1), 1, op, -1)
self._inputs.append(self._label)

@property
def fields_container(self):
Expand All @@ -151,6 +171,27 @@ def fields_container(self):
"""
return self._fields_container

@property
def label(self):
"""Allows to connect label input to the operator.

Label of the fields container where it should
operate.

Parameters
----------
my_label : str

Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.math.accumulate_over_label_fc()
>>> op.inputs.label.connect(my_label)
>>> # or
>>> op.inputs.label(my_label)
"""
return self._label


class OutputsAccumulateOverLabelFc(_Outputs):
"""Intermediate class used to get outputs from
Expand Down
Loading