CollectionBase#
Contains classes associated with the DPF collection.
- class ansys.dpf.core.collection_base.CollectionBase(collection=None, server: ansys.dpf.core.server_types.BaseServer | None = None)#
-
entries_type:
Optional
[type
[TypeVar
(TYPE
)]]# Represents a collection of entries ordered by labels and IDs.
- Parameters:
collection (ansys.grpc.dpf.collection_pb2.Collection, optional) – Collection to create from the collection message. 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.
- property name#
Name of the Collection.
Notes
Available starting with DPF 2024 R2 pre0.
- Return type:
str
- static integral_collection(inpt, server: ansys.dpf.core.server_types.BaseServer | None = 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:
Notes
Used by default by the
'Operator'
and the``’Workflow’`` when a list is connected or returned.
- set_labels(labels)#
Set labels for scoping the collection.
- Parameters:
labels (list[str], optional) – Labels to scope entries to. For example,
["time", "complex"]
.
- 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.FieldsContainer() >>> coll.add_label('time')
- 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.FieldsContainer() >>> coll.add_label('time') >>> coll.has_label('time') True
>>> coll.has_label('complex') False
- get_entries_indices(label_space)#
Retrieve the indices of the entries corresponding a requested label space .
Notes
Available starting with DPF 2025R1.
- Parameters:
label_space (dict[str,int]) – Label space or index. For example,
{"time": 1, "complex": 0}
or the index of the field.- Returns:
indices – Indices of the entries corresponding to the request.
- Return type:
list[int], list[Field], list[MeshedRegion]
- 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_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_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 scoped to the input label.
- Return type:
- set_support(label: str, support: ansys.dpf.core.support.Support)#
Set the support of the collection for a given label.
- Return type:
None
Notes
Available starting with DPF 2023 R1.
-
entries_type:
- class ansys.dpf.core.collection_base.IntegralCollection(server=None, collection=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:
list (list[float], list[int], numpy.array) – list to transfer server side
Notes
Used by default by the
'Operator'
and the``’Workflow’`` when a list is connected or returned.- 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.FieldsContainer() >>> coll.add_label('time')
- 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_entries_indices(label_space)#
Retrieve the indices of the entries corresponding a requested label space .
Notes
Available starting with DPF 2025R1.
- Parameters:
label_space (dict[str,int]) – Label space or index. For example,
{"time": 1, "complex": 0}
or the index of the field.- Returns:
indices – Indices of the entries corresponding to the request.
- Return type:
list[int], list[Field], list[MeshedRegion]
- 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 scoped to the input label.
- Return type:
- 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_support(label: str)#
Get the support of the collection for a given label.
- Return type:
Notes
Available starting with DPF 2023 R1.
- 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.FieldsContainer() >>> coll.add_label('time') >>> coll.has_label('time') True
>>> coll.has_label('complex') False
- static integral_collection(inpt, server: ansys.dpf.core.server_types.BaseServer | None = 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:
Notes
Used by default by the
'Operator'
and the``’Workflow’`` when a list is connected or returned.
- property name#
Name of the Collection.
Notes
Available starting with DPF 2024 R2 pre0.
- Return type:
str
- set_labels(labels)#
Set labels for scoping the collection.
- Parameters:
labels (list[str], optional) – Labels to scope entries to. For example,
["time", "complex"]
.
- set_support(label: str, support: ansys.dpf.core.support.Support)#
Set the support of the collection for a given label.
- Return type:
None
Notes
Available starting with DPF 2023 R1.
-
entries_type:
Optional
[type
[TypeVar
(TYPE
)]]# Represents a collection of entries ordered by labels and IDs.
- Parameters:
collection (ansys.grpc.dpf.collection_pb2.Collection, optional) – Collection to create from the collection message. 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.
- class ansys.dpf.core.collection_base.IntCollection(list=None, server=None, collection=None)#
- entries_type#
Creates a collection of integers 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:
list (list[int], numpy.array) – list to transfer server side
Notes
Used by default by the
'Operator'
and the``’Workflow’`` when a list is connected or returned.alias of
int
- 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.FieldsContainer() >>> coll.add_label('time')
- 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_entries_indices(label_space)#
Retrieve the indices of the entries corresponding a requested label space .
Notes
Available starting with DPF 2025R1.
- Parameters:
label_space (dict[str,int]) – Label space or index. For example,
{"time": 1, "complex": 0}
or the index of the field.- Returns:
indices – Indices of the entries corresponding to the request.
- Return type:
list[int], list[Field], list[MeshedRegion]
- 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 scoped to the input label.
- Return type:
- 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_support(label: str)#
Get the support of the collection for a given label.
- Return type:
Notes
Available starting with DPF 2023 R1.
- 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.FieldsContainer() >>> coll.add_label('time') >>> coll.has_label('time') True
>>> coll.has_label('complex') False
- static integral_collection(inpt, server: ansys.dpf.core.server_types.BaseServer | None = 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:
Notes
Used by default by the
'Operator'
and the``’Workflow’`` when a list is connected or returned.
- property name#
Name of the Collection.
Notes
Available starting with DPF 2024 R2 pre0.
- Return type:
str
- set_labels(labels)#
Set labels for scoping the collection.
- Parameters:
labels (list[str], optional) – Labels to scope entries to. For example,
["time", "complex"]
.
- set_support(label: str, support: ansys.dpf.core.support.Support)#
Set the support of the collection for a given label.
- Return type:
None
Notes
Available starting with DPF 2023 R1.
- class ansys.dpf.core.collection_base.FloatCollection(list=None, server=None, collection=None)#
- entries_type#
Creates a collection of floats (double64) 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:
list (list[float], numpy.array) – list to transfer server side
Notes
Used by default by the
'Operator'
and the``’Workflow’`` when a list is connected or returned.alias of
float
- 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.FieldsContainer() >>> coll.add_label('time')
- 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_entries_indices(label_space)#
Retrieve the indices of the entries corresponding a requested label space .
Notes
Available starting with DPF 2025R1.
- Parameters:
label_space (dict[str,int]) – Label space or index. For example,
{"time": 1, "complex": 0}
or the index of the field.- Returns:
indices – Indices of the entries corresponding to the request.
- Return type:
list[int], list[Field], list[MeshedRegion]
- 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 scoped to the input label.
- Return type:
- 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_support(label: str)#
Get the support of the collection for a given label.
- Return type:
Notes
Available starting with DPF 2023 R1.
- 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.FieldsContainer() >>> coll.add_label('time') >>> coll.has_label('time') True
>>> coll.has_label('complex') False
- static integral_collection(inpt, server: ansys.dpf.core.server_types.BaseServer | None = 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:
Notes
Used by default by the
'Operator'
and the``’Workflow’`` when a list is connected or returned.
- property name#
Name of the Collection.
Notes
Available starting with DPF 2024 R2 pre0.
- Return type:
str
- set_labels(labels)#
Set labels for scoping the collection.
- Parameters:
labels (list[str], optional) – Labels to scope entries to. For example,
["time", "complex"]
.
- set_support(label: str, support: ansys.dpf.core.support.Support)#
Set the support of the collection for a given label.
- Return type:
None
Notes
Available starting with DPF 2023 R1.
- class ansys.dpf.core.collection_base.StringCollection(list=None, server=None, collection=None, local: bool = False)#
- 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.FieldsContainer() >>> coll.add_label('time')
- 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_entries_indices(label_space)#
Retrieve the indices of the entries corresponding a requested label space .
Notes
Available starting with DPF 2025R1.
- Parameters:
label_space (dict[str,int]) – Label space or index. For example,
{"time": 1, "complex": 0}
or the index of the field.- Returns:
indices – Indices of the entries corresponding to the request.
- Return type:
list[int], list[Field], list[MeshedRegion]
- 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 scoped to the input label.
- Return type:
- 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_support(label: str)#
Get the support of the collection for a given label.
- Return type:
Notes
Available starting with DPF 2023 R1.
- 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.FieldsContainer() >>> coll.add_label('time') >>> coll.has_label('time') True
>>> coll.has_label('complex') False
- static integral_collection(inpt, server: ansys.dpf.core.server_types.BaseServer | None = 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:
Notes
Used by default by the
'Operator'
and the``’Workflow’`` when a list is connected or returned.
- property name#
Name of the Collection.
Notes
Available starting with DPF 2024 R2 pre0.
- Return type:
str
- set_labels(labels)#
Set labels for scoping the collection.
- Parameters:
labels (list[str], optional) – Labels to scope entries to. For example,
["time", "complex"]
.
- set_support(label: str, support: ansys.dpf.core.support.Support)#
Set the support of the collection for a given label.
- Return type:
None
Notes
Available starting with DPF 2023 R1.
- entries_type#
Creates a collection of strings 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:
list (list[float], numpy.array) – list to transfer server side
Notes
Used by default by the
'Operator'
and the``’Workflow’`` when a list is connected or returned.alias of
str