Custom Fields Containers#

Contains the inherited classes from the FieldsContainer class. These new classes offer helpers to access data for specific usage, such as results split by body or split by material.

class ansys.dpf.core.custom_fields_container.ElShapeFieldsContainer(fields_container=None, server=None)#

Represents a fields container with fields split by an element shape.

Instances of this class are created when a model result is split by an element shape, such as a solid, shell, or beam.

Parameters
  • fields_container (ansys.grpc.dpf.collection_pb2.Collection or FieldsContainer, optional) – Fields container created from either a collection message or by copying an existing fields container. The default is None.

  • server (server.DPFServer, optional) – Server with the channel connected to the remote or local instance. The default is None, in which case an attempt is made to use the global server.

Examples

>>> from ansys.dpf import core as dpf
>>> from ansys.dpf.core import examples
>>> model = dpf.Model(examples.download_all_kinds_of_complexity_modal())
>>> fc = model.results.displacement.on_all_time_freqs.split_by_shape.eval()
>>> len(fc.solid_fields())
45
>>> solid_f_time_2 = fc.solid_field(2)
solid_fields(timeid=None, complexid=None)#

Retrieve a list of all fields with solid element shapes.

You can filter the list of fields with solid element shapes based on a given time, complex type, or both.

Parameters
  • timeid (int, optional) – Time ID for filtering fields with solid element shapes.

  • complexid (int, optional) – Complex type ID for filtering fields with solid element shapes. 0 is for real numbers, and 1 is for imaginary numbers.

Returns

List of fields corresponding to the request.

Return type

list

Examples

>>> from ansys.dpf import core as dpf
>>> from ansys.dpf.core import examples
>>> model = dpf.Model(examples.download_all_kinds_of_complexity_modal())
>>> fc = model.results.displacement.split_by_shape.eval()
>>> len(fc.solid_fields())
1
>>> len(fc.solid_fields(timeid=1))
1
shell_fields(timeid=None, complexid=None)#

Retrieve a list of all fields with shell element shapes.

You can filter the list of fields with shell element shapes based on a given time, complex type, or both.

Parameters
  • timeid (int, optional) – Time ID for filtering fields with shell element shapes.

  • complexid (int, optional) – Complex type ID for filtering fields with shell element shapes. 0 is for real numbers, and 1 is for imaginary numbers.

Returns

List of fields corresponding to the request.

Return type

list

Examples

>>> from ansys.dpf import core as dpf
>>> from ansys.dpf.core import examples
>>> model = dpf.Model(examples.download_all_kinds_of_complexity_modal())
>>> fc = model.results.displacement.on_all_time_freqs.split_by_shape.eval()
>>> len(fc.shell_fields())
45
>>> len(fc.shell_fields(timeid=3))
1
beam_fields(timeid=None, complexid=None)#

Retrieve a list of all fields with beam element shapes.

You can filter the list of fields with beam element shapes based on a given time, complex type, or both.

Parameters
  • timeid (int, optional) – Time ID for filtering fields with beam element shapes.

  • complexid (int, optional) – Complex type ID for filtering fields with beam element shapes. 0 is for real numbers, and 1 is for imaginary numbers.

Returns

List of fields corresponding to the request.

Return type

list

Examples

>>> from ansys.dpf import core as dpf
>>> from ansys.dpf.core import examples
>>> model = dpf.Model(examples.download_all_kinds_of_complexity_modal())
>>> fc = model.results.displacement.on_all_time_freqs.split_by_shape.eval()
>>> len(fc.beam_fields())
45
>>> len(fc.beam_fields(timeid=3))
1
solid_field(timeid=None, complexid=None)#

Retrieve a field with a solid element shape.

You can give a time, complex type, or both. If the number of fields matching the request is higher than one, an exception is raised.

Parameters
  • timeid (int, optional) – Time ID for filtering fields with solid element shapes.

  • complexid (int, optional) – Complex type ID for filtering fields with solid element shapes. 0 is for real numbers, and 1 is for imaginary numbers.

Returns

Field corresponding to the request.

Return type

class:`Field <ansys.dpf.core.field>’

Examples

>>> from ansys.dpf import core as dpf
>>> from ansys.dpf.core import examples
>>> model = dpf.Model(examples.download_all_kinds_of_complexity_modal())
>>> fc = model.results.displacement.on_all_time_freqs.split_by_shape.eval()
>>> field = fc.solid_field(timeid=3)
shell_field(timeid=None, complexid=None)#

Retrieve a field with a shell element shape.

You can give a time, complex type, or both. If the number of fields matching the request is higher than one, an exception is raised.

Parameters
  • timeid (int, optional) – Time ID for filtering fields with shell element shapes.

  • complexid (int, optional) – Complex type ID for filtering fields with shell element shapes. 0 is for real numbers, and 1 is for imaginary numbers.

Returns

Field corresponding to the request.

Return type

class:`Field <ansys.dpf.core.field>’

Examples

>>> from ansys.dpf import core as dpf
>>> from ansys.dpf.core import examples
>>> model = dpf.Model(examples.download_all_kinds_of_complexity_modal())
>>> fc = model.results.displacement.on_all_time_freqs.split_by_shape.eval()
>>> field = fc.shell_field(timeid=3)
beam_field(timeid=None, complexid=None)#

Retrieve a field with a beam element shape.

You can give a time, complex type, or both. If the number of fields matching the request is higher than one, an exception is raised.

Parameters
  • timeid (int, optional) – Time ID for filtering fields with solid element shapes.

  • complexid (int, optional) – Complex type ID for filtering fields with solid element shapes. 0 is for real numbers, and 1 is for imaginary numbers.

Returns

Field corresponding to the request.

Return type

class:`Field <ansys.dpf.core.field>’

Examples

>>> from ansys.dpf import core as dpf
>>> from ansys.dpf.core import examples
>>> model = dpf.Model(examples.download_all_kinds_of_complexity_modal())
>>> fc = model.results.displacement.on_all_time_freqs.split_by_shape.eval()
>>> field = fc.beam_field(timeid=3)
add_field(label_space, field)#

Add or update a field at a requested label space.

Parameters
  • label_space (dict[str,int]) – Label space of the requested field. For example, {“time”:1, “complex”:0}.

  • field (Field) – DPF field to add or update.

Examples

>>> from ansys.dpf import core as dpf
>>> fc= dpf.FieldsContainer()
>>> fc.labels =['time','complex']
>>> for i in range(0,20): #real fields
...     mscop = {"time":i+1,"complex":0}
...     fc.add_field(mscop,dpf.Field(nentities=i+10))
>>> for i in range(0,20): #imaginary fields
...     mscop = {"time":i+1,"complex":1}
...     fc.add_field(mscop,dpf.Field(nentities=i+10))
add_field_by_time_id(field, timeid=1)#

Add or update a field at a requested time ID.

fieldField

DPF field to add or update.

timeid: int, optional

Time ID for the requested time set. The default is 1.

add_imaginary_field(field, timeid=1)#

Add or update an imaginary field at a requested time ID.

Parameters
  • field (Field) – DPF field to add or update.

  • timeid (int, optional) – Time ID for the requested time set. The default is 1.

add_label(label, default_value=None)#

Add the requested label to scope the collection.

Parameters
  • label (str) – Labels to scope the entries to. For example, "time".

  • default_value (int, optional) – Default value for existing fields in the collection. The default is None.

Examples

>>> from ansys.dpf import core as dpf
>>> coll = dpf.Collection(dpf.types.field)
>>> coll.add_label('time')
deep_copy(server=None)#

Create a deep copy of the fields container’s data (and its fields) on a given server.

This method is useful for passing data from one server instance to another.

Parameters

server (ansys.dpf.core.server, optional) – Server with the channel connected to the remote or local instance. The default is None, in which case an attempt is made to use the global server.

Returns

fields_container_copy

Return type

FieldsContainer

Examples

>>> from ansys.dpf import core as dpf
>>> from ansys.dpf.core import examples
>>> transient = examples.download_transient_result()
>>> model = dpf.Model(transient)
>>> disp = model.results.displacement()
>>> disp.inputs.time_scoping.connect([1,5])
>>> fields_container = disp.outputs.fields_container()
>>> other_server = dpf.start_local_server(as_global=False)
>>> deep_copy = fields_container.deep_copy(server=other_server)
get_available_ids_for_label(label='time')#

Retrieve the IDs assigned to an input label.

Parameters

label (str) – Name of the input label. The default is "time".

Returns

ids – List of IDs assigned to the input label.

Return type

list[int]

get_field(label_space_or_index)#

Retrieves the field at a requested index or label space.

An exception is raised if the number of fields matching the request is greater than one.

Parameters

label_space_or_index (dict[str,int], int) – Scoping of the requested fields. For example, {"time": 1, "complex": 0} or the index of the field.

Returns

field – Field corresponding to the request.

Return type

Field

Examples

>>> from ansys.dpf import core as dpf
>>> fc = dpf.fields_container_factory.over_time_freq_fields_container(
...     [dpf.Field(nentities=10)]
... )
>>> field = fc.get_field({"time":1})
get_field_by_time_complex_ids(timeid=None, complexid=None)#

Retrieve a field at a requested time ID or complex ID.

An exception is raised if the number of fields matching the request is greater than one.

Parameters
  • timeid (int, optional) – Time ID or frequency ID, which is the one-based index of the result set.

  • complexid (int, optional) – Complex ID, where 1 is for imaginary and 0 is for real.

Returns

fields – Field corresponding to the request

Return type

Field

Examples

Extract the fifth time set of a transient analysis.

>>> from ansys.dpf import core as dpf
>>> from ansys.dpf.core import examples
>>> transient = examples.download_transient_result()
>>> model = dpf.Model(transient)
>>> len(model.metadata.time_freq_support.time_frequencies)
35
>>> disp = model.results.displacement()
>>> disp.inputs.time_scoping.connect([1,5])
>>> fields_container = disp.outputs.fields_container()
>>> field_set_5 =fields_container.get_fields_by_time_complex_ids(5)
get_field_by_time_id(timeid=None)#

Retrieves the complex field at a requested time.

Parameters

timeid (int, optional) – Time ID, which is the one-based index of the result set.

Returns

fields – Fields corresponding to the request.

Return type

Field

get_fields(label_space)#

Retrieve the fields at a requested index or label space.

Parameters

label_space (dict[str,int]) – Scoping of the requested fields. For example, {"time": 1, "complex": 0}.

Returns

fields – Fields corresponding to the request.

Return type

list[Field]

Examples

>>> from ansys.dpf import core as dpf
>>> fc= dpf.FieldsContainer()
>>> fc.labels =['time','complex']
>>> #real fields
>>> for i in range(0,20):
...     mscop = {"time":i+1,"complex":0}
...     fc.add_field(mscop,dpf.Field(nentities=i+10))
>>> #imaginary fields
>>> for i in range(0,20):
...     mscop = {"time":i+1,"complex":1}
...     fc.add_field(mscop,dpf.Field(nentities=i+10))
>>> fields = fc.get_fields({"time":2})
>>> # imaginary and real fields of time 2
>>> len(fields)
2
get_fields_by_time_complex_ids(timeid=None, complexid=None)#

Retrieve fields at a requested time ID or complex ID.

Parameters
  • timeid (int, optional) – Time ID or frequency ID, which is the one-based index of the result set.

  • complexid (int, optional) – Complex ID, where 1 is for imaginary and 0 is for real.

Returns

fields – Fields corresponding to the request.

Return type

list[Field]

Examples

Extract the fifth time set of a transient analysis.

>>> from ansys.dpf import core as dpf
>>> from ansys.dpf.core import examples
>>> transient = examples.download_transient_result()
>>> model = dpf.Model(transient)
>>> len(model.metadata.time_freq_support.time_frequencies)
35
>>> disp = model.results.displacement()
>>> disp.inputs.time_scoping.connect([1,5])
>>> fields_container = disp.outputs.fields_container()
>>> field_set_5 =fields_container.get_fields_by_time_complex_ids(5)
get_imaginary_field(timeid=None)#

Retrieve the complex field at a requested time.

Parameters

timeid (int, optional) – Time ID, which is the one-based index of the result set.

Returns

fields – Field corresponding to the request.

Return type

Field

get_imaginary_fields(timeid=None)#

Retrieve the complex fields at a requested time.

Parameters

timeid (int, optional) – Time ID, which is the one-based index of the result set.

Returns

fields – Fields corresponding to the request.

Return type

list[Field]

get_label_scoping(label='time')#

Retrieve the scoping for an input label.

This method allows you to retrieve a list of IDs for a given input label in the collection. For example, if the label el_type exists in the collection, you can use the get_lable_scoping method to retrieve a list of IDS with this label. You can then use these IDs to request a given entity inside the collection.

Parameters

label (str) – Name of the input label.

Returns

scoping – IDs scopped to the input label.

Return type

Scoping

get_label_space(index)#

Retrieve the label space of an entry at a requested index.

Parameters

index (int) – Index of the entry.

Returns

label_space – Scoping of the requested entry. For example, {"time": 1, "complex": 0}.

Return type

dict(str:int)

get_time_scoping()#

Retrieves the time scoping containing the time sets.

Returns

scoping – Scoping containing the time set IDs available in the fields container.

Return type

Scoping

has_label(label)#

Check if a collection has a specified label.

Parameters

label (str) – Label to search for. For example, "time".

Returns

True when successful, False when failed.

Return type

bool

Examples

>>> from ansys.dpf import core as dpf
>>> coll = dpf.Collection(dpf.types.field)
>>> coll.add_label('time')
>>> coll.has_label('time')
True
>>> coll.has_label('complex')
False
static integral_collection(inpt, server: Optional[ansys.dpf.core.server.DpfServer] = None)#

Creates a collection of integral type with a list.

The collection of integral is the equivalent of an array of data sent server side. It can be used to efficiently stream large data to the server.

Parameters

inpt (list[float], list[int], numpy.array) – list to transfer server side

Return type

Collection

Notes

Used by default by the 'Operator' and the``’Workflow’`` when a list is connected or returned.

property labels#

Retrieve labels scoping the collection.

Returns

labels – List of labels that entries are scoped to. For example, ["time", "complex"].

Return type

list[str]

select_component(index)#

Select fields containing only the component index.

Fields can be selected only by component index as multiple fields may contain a different number of components.

Parameters

index (int) – Index of the component.

Returns

fields – Fields container with one component selected in each field.

Return type

FieldsContainer

Examples

Select using a component index.

>>> from ansys.dpf import core as dpf
>>> from ansys.dpf.core import examples
>>> transient = examples.download_transient_result()
>>> model = dpf.Model(transient)
>>> disp = model.results.displacement()
>>> disp.inputs.time_scoping.connect([1,5])
>>> fields_container = disp.outputs.fields_container()
>>> disp_x_fields = fields_container.select_component(0)
>>> my_field = disp_x_fields[0]
set_labels(labels)#

Set labels for scoping the collection.

Parameters

labels (list[str], optional) – Labels to scope entries to. For example, ["time", "complex"].

property time_freq_support#

Time frequency support.

class ansys.dpf.core.custom_fields_container.BodyFieldsContainer(fields_container=None, server=None)#

Represents a fields container with fields split by a body.

Instances of this class are created when a model result is split by a body, which is an MAPDL material property.

Parameters
  • fields_container (ansys.grpc.dpf.collection_pb2.Collection or FieldsContainer, optional) – Fields container created from either a collection message or by copying an existing fields container. The default is None.

  • server (server.DPFServer, optional) – Server with the channel connected to the remote or local instance. The default is None, in which case an attempt is made to use the global server.

Examples

>>> from ansys.dpf import core as dpf
>>> from ansys.dpf.core import examples
>>> model = dpf.Model(examples.download_all_kinds_of_complexity_modal())
>>> fc = model.results.displacement.on_all_time_freqs.split_by_body.eval()
>>> fc.get_mat_scoping().ids[3]
45
>>> len(fc.get_fields_by_mat_id(45))
45
>>> f_time_2 = fc.get_field_by_mat_id(45, timeid=2)
get_fields_by_mat_id(matid, timeid=None, complexid=None)#

Retrieve a list of all fields for a material ID.

You can filter the list of fields for a material ID based on a given time, complex type, or both.

Parameters
  • matid (int, optional) – Material ID. To request available material IDs, you can use the get_mat_scoping method.

  • timeid (int, optional) – Time ID for filtering fields with the given material ID.

  • complexid (int, optional) – Complex type ID for filtering fields with the given material ID. 0 is for real numbers, and 1 is for imaginary numbers.

Returns

List of fields corresponding to the request.

Return type

List

Examples

>>> from ansys.dpf import core as dpf
>>> from ansys.dpf.core import examples
>>> model = dpf.Model(examples.download_all_kinds_of_complexity_modal())
>>> fc = model.results.displacement.on_all_time_freqs.split_by_body.eval()
>>> len(fc.get_fields_by_mat_id(1))
45
>>> len(fc.get_fields_by_mat_id(1, timeid=3))
1
get_field_by_mat_id(matid, timeid=None, complexid=None)#

Retrieve a field with a given material ID.

You can filter the field based on a given time, complex type, or both.

Parameters
  • matid (int, optional) – Material ID. To request available material IDs, you can use the get_mat_scoping method.

  • timeid (int, optional) – Time ID for filtering fields with the given material ID.

  • complexid (int, optional) – Complex type ID for filtering fields with the given material ID. 0 is for real numbers, and 1 is for imaginary numbers.

Returns

Field corresponding to the request.

Return type

class:`Field <ansys.dpf.core.field>’

Examples

>>> from ansys.dpf import core as dpf
>>> from ansys.dpf.core import examples
>>> model = dpf.Model(examples.download_all_kinds_of_complexity_modal())
>>> fc = model.results.displacement.on_all_time_freqs.split_by_body.eval()
>>> f_time_2 = fc.get_field_by_mat_id(45, timeid=2)
get_mat_scoping()#

Retrieves the material or body scoping containing material IDs.

Returns

Field corresponding to the request. Scoping containing the material IDs available in the fields container.

Return type

class:`Scoping <ansys.dpf.core.scoping>’

add_field(label_space, field)#

Add or update a field at a requested label space.

Parameters
  • label_space (dict[str,int]) – Label space of the requested field. For example, {“time”:1, “complex”:0}.

  • field (Field) – DPF field to add or update.

Examples

>>> from ansys.dpf import core as dpf
>>> fc= dpf.FieldsContainer()
>>> fc.labels =['time','complex']
>>> for i in range(0,20): #real fields
...     mscop = {"time":i+1,"complex":0}
...     fc.add_field(mscop,dpf.Field(nentities=i+10))
>>> for i in range(0,20): #imaginary fields
...     mscop = {"time":i+1,"complex":1}
...     fc.add_field(mscop,dpf.Field(nentities=i+10))
add_field_by_time_id(field, timeid=1)#

Add or update a field at a requested time ID.

fieldField

DPF field to add or update.

timeid: int, optional

Time ID for the requested time set. The default is 1.

add_imaginary_field(field, timeid=1)#

Add or update an imaginary field at a requested time ID.

Parameters
  • field (Field) – DPF field to add or update.

  • timeid (int, optional) – Time ID for the requested time set. The default is 1.

add_label(label, default_value=None)#

Add the requested label to scope the collection.

Parameters
  • label (str) – Labels to scope the entries to. For example, "time".

  • default_value (int, optional) – Default value for existing fields in the collection. The default is None.

Examples

>>> from ansys.dpf import core as dpf
>>> coll = dpf.Collection(dpf.types.field)
>>> coll.add_label('time')
deep_copy(server=None)#

Create a deep copy of the fields container’s data (and its fields) on a given server.

This method is useful for passing data from one server instance to another.

Parameters

server (ansys.dpf.core.server, optional) – Server with the channel connected to the remote or local instance. The default is None, in which case an attempt is made to use the global server.

Returns

fields_container_copy

Return type

FieldsContainer

Examples

>>> from ansys.dpf import core as dpf
>>> from ansys.dpf.core import examples
>>> transient = examples.download_transient_result()
>>> model = dpf.Model(transient)
>>> disp = model.results.displacement()
>>> disp.inputs.time_scoping.connect([1,5])
>>> fields_container = disp.outputs.fields_container()
>>> other_server = dpf.start_local_server(as_global=False)
>>> deep_copy = fields_container.deep_copy(server=other_server)
get_available_ids_for_label(label='time')#

Retrieve the IDs assigned to an input label.

Parameters

label (str) – Name of the input label. The default is "time".

Returns

ids – List of IDs assigned to the input label.

Return type

list[int]

get_field(label_space_or_index)#

Retrieves the field at a requested index or label space.

An exception is raised if the number of fields matching the request is greater than one.

Parameters

label_space_or_index (dict[str,int], int) – Scoping of the requested fields. For example, {"time": 1, "complex": 0} or the index of the field.

Returns

field – Field corresponding to the request.

Return type

Field

Examples

>>> from ansys.dpf import core as dpf
>>> fc = dpf.fields_container_factory.over_time_freq_fields_container(
...     [dpf.Field(nentities=10)]
... )
>>> field = fc.get_field({"time":1})
get_field_by_time_complex_ids(timeid=None, complexid=None)#

Retrieve a field at a requested time ID or complex ID.

An exception is raised if the number of fields matching the request is greater than one.

Parameters
  • timeid (int, optional) – Time ID or frequency ID, which is the one-based index of the result set.

  • complexid (int, optional) – Complex ID, where 1 is for imaginary and 0 is for real.

Returns

fields – Field corresponding to the request

Return type

Field

Examples

Extract the fifth time set of a transient analysis.

>>> from ansys.dpf import core as dpf
>>> from ansys.dpf.core import examples
>>> transient = examples.download_transient_result()
>>> model = dpf.Model(transient)
>>> len(model.metadata.time_freq_support.time_frequencies)
35
>>> disp = model.results.displacement()
>>> disp.inputs.time_scoping.connect([1,5])
>>> fields_container = disp.outputs.fields_container()
>>> field_set_5 =fields_container.get_fields_by_time_complex_ids(5)
get_field_by_time_id(timeid=None)#

Retrieves the complex field at a requested time.

Parameters

timeid (int, optional) – Time ID, which is the one-based index of the result set.

Returns

fields – Fields corresponding to the request.

Return type

Field

get_fields(label_space)#

Retrieve the fields at a requested index or label space.

Parameters

label_space (dict[str,int]) – Scoping of the requested fields. For example, {"time": 1, "complex": 0}.

Returns

fields – Fields corresponding to the request.

Return type

list[Field]

Examples

>>> from ansys.dpf import core as dpf
>>> fc= dpf.FieldsContainer()
>>> fc.labels =['time','complex']
>>> #real fields
>>> for i in range(0,20):
...     mscop = {"time":i+1,"complex":0}
...     fc.add_field(mscop,dpf.Field(nentities=i+10))
>>> #imaginary fields
>>> for i in range(0,20):
...     mscop = {"time":i+1,"complex":1}
...     fc.add_field(mscop,dpf.Field(nentities=i+10))
>>> fields = fc.get_fields({"time":2})
>>> # imaginary and real fields of time 2
>>> len(fields)
2
get_fields_by_time_complex_ids(timeid=None, complexid=None)#

Retrieve fields at a requested time ID or complex ID.

Parameters
  • timeid (int, optional) – Time ID or frequency ID, which is the one-based index of the result set.

  • complexid (int, optional) – Complex ID, where 1 is for imaginary and 0 is for real.

Returns

fields – Fields corresponding to the request.

Return type

list[Field]

Examples

Extract the fifth time set of a transient analysis.

>>> from ansys.dpf import core as dpf
>>> from ansys.dpf.core import examples
>>> transient = examples.download_transient_result()
>>> model = dpf.Model(transient)
>>> len(model.metadata.time_freq_support.time_frequencies)
35
>>> disp = model.results.displacement()
>>> disp.inputs.time_scoping.connect([1,5])
>>> fields_container = disp.outputs.fields_container()
>>> field_set_5 =fields_container.get_fields_by_time_complex_ids(5)
get_imaginary_field(timeid=None)#

Retrieve the complex field at a requested time.

Parameters

timeid (int, optional) – Time ID, which is the one-based index of the result set.

Returns

fields – Field corresponding to the request.

Return type

Field

get_imaginary_fields(timeid=None)#

Retrieve the complex fields at a requested time.

Parameters

timeid (int, optional) – Time ID, which is the one-based index of the result set.

Returns

fields – Fields corresponding to the request.

Return type

list[Field]

get_label_scoping(label='time')#

Retrieve the scoping for an input label.

This method allows you to retrieve a list of IDs for a given input label in the collection. For example, if the label el_type exists in the collection, you can use the get_lable_scoping method to retrieve a list of IDS with this label. You can then use these IDs to request a given entity inside the collection.

Parameters

label (str) – Name of the input label.

Returns

scoping – IDs scopped to the input label.

Return type

Scoping

get_label_space(index)#

Retrieve the label space of an entry at a requested index.

Parameters

index (int) – Index of the entry.

Returns

label_space – Scoping of the requested entry. For example, {"time": 1, "complex": 0}.

Return type

dict(str:int)

get_time_scoping()#

Retrieves the time scoping containing the time sets.

Returns

scoping – Scoping containing the time set IDs available in the fields container.

Return type

Scoping

has_label(label)#

Check if a collection has a specified label.

Parameters

label (str) – Label to search for. For example, "time".

Returns

True when successful, False when failed.

Return type

bool

Examples

>>> from ansys.dpf import core as dpf
>>> coll = dpf.Collection(dpf.types.field)
>>> coll.add_label('time')
>>> coll.has_label('time')
True
>>> coll.has_label('complex')
False
static integral_collection(inpt, server: Optional[ansys.dpf.core.server.DpfServer] = None)#

Creates a collection of integral type with a list.

The collection of integral is the equivalent of an array of data sent server side. It can be used to efficiently stream large data to the server.

Parameters

inpt (list[float], list[int], numpy.array) – list to transfer server side

Return type

Collection

Notes

Used by default by the 'Operator' and the``’Workflow’`` when a list is connected or returned.

property labels#

Retrieve labels scoping the collection.

Returns

labels – List of labels that entries are scoped to. For example, ["time", "complex"].

Return type

list[str]

select_component(index)#

Select fields containing only the component index.

Fields can be selected only by component index as multiple fields may contain a different number of components.

Parameters

index (int) – Index of the component.

Returns

fields – Fields container with one component selected in each field.

Return type

FieldsContainer

Examples

Select using a component index.

>>> from ansys.dpf import core as dpf
>>> from ansys.dpf.core import examples
>>> transient = examples.download_transient_result()
>>> model = dpf.Model(transient)
>>> disp = model.results.displacement()
>>> disp.inputs.time_scoping.connect([1,5])
>>> fields_container = disp.outputs.fields_container()
>>> disp_x_fields = fields_container.select_component(0)
>>> my_field = disp_x_fields[0]
set_labels(labels)#

Set labels for scoping the collection.

Parameters

labels (list[str], optional) – Labels to scope entries to. For example, ["time", "complex"].

property time_freq_support#

Time frequency support.