:class:`Collection` =================== .. py:class:: ansys.dpf.core.collection.Collection(collection=None, server=None, entries_type: type = None) Bases: :py:obj:`ansys.dpf.core.collection_base.CollectionBase`\ [\ :py:obj:`ansys.dpf.core.collection_base.TYPE`\ ] Represents a collection of dpf objects organised by label spaces. :param collection: ansys.dpf.core.Collection, optional Create a collection from a collection message or create a copy from an existing collection. The default is ``None``. :type collection: ansys.grpc.dpf.collection_pb2.Collection or :param server: 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. :type server: ansys.dpf.core.server, optional :param entries_type: Type of the entries in the collection. :type entries_type: type .. rubric:: Notes Class available with server's version starting at 8.1 (Ansys 2024 R2 pre1). .. py:currentmodule:: Collection Overview -------- .. tab-set:: .. tab-item:: Methods .. list-table:: :header-rows: 0 :widths: auto * - :py:attr:`~create_subtype` - Create dpf instance of any type, which has been cast to its original type. * - :py:attr:`~get_entries` - Retrieve the entries at a label space. * - :py:attr:`~get_entry` - Retrieve the entry at a requested index or label space. * - :py:attr:`~add_entry` - Add or update the entry at a requested label space. Import detail ------------- .. code-block:: python from ansys.dpf.core.collection import Collection Method detail ------------- .. py:method:: create_subtype(obj_by_copy) Create dpf instance of any type, which has been cast to its original type. .. py:method:: get_entries(label_space) Retrieve the entries at a label space. :param label_space: Entries corresponding to a filter (label space) in the input. For example: ``{"elshape":1, "body":12}`` :type label_space: dict[str,int] :returns: **entries** -- Entries corresponding to the request. :rtype: list[self.type] .. py:method:: get_entry(label_space_or_index) -> ansys.dpf.core.collection_base.TYPE Retrieve the entry at a requested index or label space. Raises an exception if the request returns more than one entry. :param label_space_or_index: Scoping of the requested entry, such as ``{"time": 1, "complex": 0}`` or the index of the mesh. :type label_space_or_index: dict[str,int] , int :returns: **entry** -- Entry corresponding to the request. :rtype: self.type .. py:method:: add_entry(label_space, entry) Add or update the entry at a requested label space. :param label_space: Label space of the requested meshes. For example, {"elshape":1, "body":12}. :type label_space: dict[str,int] :param entry: DPF entry to add or update. :type entry: self.type