    

 ## On this page

  

 

 # ansys::dpf::Collection&lt; DataT &gt; Class Template Reference

 Last update: 16.07.2025 

`#include <dpf_api.h>`

Inherits ansys::dpf::CollectionBase.

## <a id="pub-methods" name="pub-methods"></a>Public Member Functions

<a id="ad71430265c0f1891bd415082f28b0d36" name="ad71430265c0f1891bd415082f28b0d36"></a> **Collection** ([Collection](classansys_1_1dpf_1_1Collection.xhtml)&lt; DataT &gt; const &amp;) <a id="ac67a41f31cce324a441d456ccfadbe1f" name="ac67a41f31cce324a441d456ccfadbe1f"></a> **Collection** ([Collection](classansys_1_1dpf_1_1Collection.xhtml)&lt; DataT &gt; &amp;&amp;) noexcept  [Collection](classansys_1_1dpf_1_1Collection.xhtml#ac50cf5a210cd3d391525a18c3abefca3) (std::vector&lt; std::string &gt; const &amp;[labels](structansys_1_1dpf_1_1labels.xhtml))  [Collection](classansys_1_1dpf_1_1Collection.xhtml#ad86df2fa4903a8891826f44b195dc344) ([Client](classansys_1_1dpf_1_1Client.xhtml) const \*const client)  [Collection](classansys_1_1dpf_1_1Collection.xhtml#acbbfa8b0684530e727c378eeb5c8d46f) ([Client](classansys_1_1dpf_1_1Client.xhtml) const \*const client, std::vector&lt; std::string &gt; const &amp;[labels](structansys_1_1dpf_1_1labels.xhtml))  [Collection](classansys_1_1dpf_1_1Collection.xhtml#a37fdf6aad0fc6b3ebcb39c1a03f78429) (int id, [Client](classansys_1_1dpf_1_1Client.xhtml) const \*const client) <a id="aee0b20090571d8d9218bc48ca542b6c3" name="aee0b20090571d8d9218bc48ca542b6c3"></a>[Collection](classansys_1_1dpf_1_1Collection.xhtml) &amp; **operator=** ([Collection](classansys_1_1dpf_1_1Collection.xhtml)&lt; DataT &gt; const &amp;) <a id="a782d90e147798e3e81b7b5b331fa8eb0" name="a782d90e147798e3e81b7b5b331fa8eb0"></a>[Collection](classansys_1_1dpf_1_1Collection.xhtml) &amp; **operator=** ([Collection](classansys_1_1dpf_1_1Collection.xhtml)&lt; DataT &gt; &amp;&amp;) noexcept DataT [operator\[\]](classansys_1_1dpf_1_1Collection.xhtml#a65acae9c8be4c94b19a82c28ae4419f7) ([dp\_int](namespaceansys_1_1dpf.xhtml#a60d181a1f9d29cc7cc38b25dac4401f0) index) DataT [at](classansys_1_1dpf_1_1Collection.xhtml#ad69525d9782d30f290d3f250576aa3d1) ([dp\_index](namespaceansys_1_1dpf.xhtml#a417548d1b705a9ba54ba9429afe68920) index) const DataT [at](classansys_1_1dpf_1_1Collection.xhtml#ab5a9fa1e466cf9e36ae26d5419768c6d) ([dp\_index](namespaceansys_1_1dpf.xhtml#a417548d1b705a9ba54ba9429afe68920) index) const void [update](classansys_1_1dpf_1_1Collection.xhtml#a2ee31954dd991137fe535f3a3b3ffeed) (DataT &amp;f, [dp\_index](namespaceansys_1_1dpf.xhtml#a417548d1b705a9ba54ba9429afe68920) index) void [add](classansys_1_1dpf_1_1Collection.xhtml#afc36f19a39c1909d695f80ff22e0eeb0) ([LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) const &amp;[labels](structansys_1_1dpf_1_1labels.xhtml), DataT const &amp;f, bool can\_replace=true) std::vector&lt; DataT &gt; [getEntries](classansys_1_1dpf_1_1Collection.xhtml#a04b6d0e9e544f69be27dcfc3c79d5537) ([LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) const &amp;label\_space) const DataT [getEntry](classansys_1_1dpf_1_1Collection.xhtml#a6dea8d438075e38470c4b9a46ca9ec07) ([LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) const &amp;label\_space) const <a id="a8e724ea1528d5244ffb4860e67a39698" name="a8e724ea1528d5244ffb4860e67a39698"></a>std::vector&lt; [dp\_index](namespaceansys_1_1dpf.xhtml#a417548d1b705a9ba54ba9429afe68920) &gt; **getEntriesIndices** ([LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) const &amp;lab\_space) const <a id="a027dbff1f436f77a4857899ef78e6b15" name="a027dbff1f436f77a4857899ef78e6b15"></a>[Collection](classansys_1_1dpf_1_1Collection.xhtml)&lt; DataT &gt; **createSubCollection** ([LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) const &amp;lab\_space) const create a [Collection](classansys_1_1dpf_1_1Collection.xhtml) with all the entries corresponding to the label space in input   
 ## <a id="pub-static-methods" name="pub-static-methods"></a>Static Public Member Functions

static [Collection](classansys_1_1dpf_1_1Collection.xhtml)&lt; DataT &gt; [emptyCollection](classansys_1_1dpf_1_1Collection.xhtml#a545436af4a3a2c404796ab128ad06890) () <a id="details" name="details"></a>## Detailed Description

template&lt;typename DataT&gt;  
class ansys::dpf::Collection&lt; DataT &gt;

Contains a group of entries of same type. The AnyCollection is designed as a set of entries ordered through labels and ids. Labels identify how the entries are filtered.

See also[Any](classansys_1_1dpf_1_1Any.xhtml)

## Constructor &amp; Destructor Documentation

<a id="ac50cf5a210cd3d391525a18c3abefca3" name="ac50cf5a210cd3d391525a18c3abefca3"></a>## [◆ ](#ac50cf5a210cd3d391525a18c3abefca3)Collection() \[1/4\]

template&lt;typename DataT &gt; 

 [ansys::dpf::Collection](classansys_1_1dpf_1_1Collection.xhtml)&lt; DataT &gt;::[Collection](classansys_1_1dpf_1_1Collection.xhtml)  ( std::vector&lt; std::string &gt; const &amp;  *labels*) 

Create container for a group of entries with the given labels.

Parameters \[in\]labelsLabels for group of entries. 



<a id="ad86df2fa4903a8891826f44b195dc344" name="ad86df2fa4903a8891826f44b195dc344"></a>## [◆ ](#ad86df2fa4903a8891826f44b195dc344)Collection() \[2/4\]

template&lt;typename DataT &gt; 

 [ansys::dpf::Collection](classansys_1_1dpf_1_1Collection.xhtml)&lt; DataT &gt;::[Collection](classansys_1_1dpf_1_1Collection.xhtml)  ( [Client](classansys_1_1dpf_1_1Client.xhtml) const \*const  *client*) 

Create a new collection on a server.

Parameters \[in\]client[Client](classansys_1_1dpf_1_1Client.xhtml) instance designating the IP, port and protocol to use. 



<a id="acbbfa8b0684530e727c378eeb5c8d46f" name="acbbfa8b0684530e727c378eeb5c8d46f"></a>## [◆ ](#acbbfa8b0684530e727c378eeb5c8d46f)Collection() \[3/4\]

template&lt;typename DataT &gt; 

 [ansys::dpf::Collection](classansys_1_1dpf_1_1Collection.xhtml)&lt; DataT &gt;::[Collection](classansys_1_1dpf_1_1Collection.xhtml)  ( [Client](classansys_1_1dpf_1_1Client.xhtml) const \*const  *client*,    std::vector&lt; std::string &gt; const &amp;  *labels*   ) 

Create a collection with the given labels on a server.

Parameters \[in\]client[Client](classansys_1_1dpf_1_1Client.xhtml) instance designating the IP, port and protocol to use. \[in\]labelsLabels for meshes. 



<a id="a37fdf6aad0fc6b3ebcb39c1a03f78429" name="a37fdf6aad0fc6b3ebcb39c1a03f78429"></a>## [◆ ](#a37fdf6aad0fc6b3ebcb39c1a03f78429)Collection() \[4/4\]

template&lt;typename DataT &gt; 

 [ansys::dpf::Collection](classansys_1_1dpf_1_1Collection.xhtml)&lt; DataT &gt;::[Collection](classansys_1_1dpf_1_1Collection.xhtml)  ( int  *id*,    [Client](classansys_1_1dpf_1_1Client.xhtml) const \*const  *client*   ) 

Retrieve an existing instance of [Collection](classansys_1_1dpf_1_1Collection.xhtml) on a server.

Parameters \[in\]idId of the [Collection](classansys_1_1dpf_1_1Collection.xhtml) object on the server's database. \[in\]client[Client](classansys_1_1dpf_1_1Client.xhtml) instance designating the IP, port and protocol to use. 



## Member Function Documentation

<a id="afc36f19a39c1909d695f80ff22e0eeb0" name="afc36f19a39c1909d695f80ff22e0eeb0"></a>## [◆ ](#afc36f19a39c1909d695f80ff22e0eeb0)add()

template&lt;typename DataT &gt; 

 void [ansys::dpf::Collection](classansys_1_1dpf_1_1Collection.xhtml)&lt; DataT &gt;::add  ( [LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) const &amp;  *labels*,    DataT const &amp;  *f*,    bool  *can\_replace* = `true`   ) 

Add [Any](classansys_1_1dpf_1_1Any.xhtml) with given label space.

Parameters \[in\]labels[Label](structansys_1_1dpf_1_1Label.xhtml) space for [Any](classansys_1_1dpf_1_1Any.xhtml). \[in\]f[Any](classansys_1_1dpf_1_1Any.xhtml) to add. \[in\]can\_replaceif can\_replace is false, then, the entity is pushed back without checking if the label space already exists, available starting with 2024R2. 



<a id="ad69525d9782d30f290d3f250576aa3d1" name="ad69525d9782d30f290d3f250576aa3d1"></a>## [◆ ](#ad69525d9782d30f290d3f250576aa3d1)at() \[1/2\]

template&lt;typename DataT &gt; 

 DataT [ansys::dpf::Collection](classansys_1_1dpf_1_1Collection.xhtml)&lt; DataT &gt;::at  ( [dp\_index](namespaceansys_1_1dpf.xhtml#a417548d1b705a9ba54ba9429afe68920)  *index*) 

ReturnsDataT for given index. Parameters \[in\]indexIndex of [Any](classansys_1_1dpf_1_1Any.xhtml) to get. 



<a id="ab5a9fa1e466cf9e36ae26d5419768c6d" name="ab5a9fa1e466cf9e36ae26d5419768c6d"></a>## [◆ ](#ab5a9fa1e466cf9e36ae26d5419768c6d)at() \[2/2\]

template&lt;typename DataT &gt; 

 const DataT [ansys::dpf::Collection](classansys_1_1dpf_1_1Collection.xhtml)&lt; DataT &gt;::at  ( [dp\_index](namespaceansys_1_1dpf.xhtml#a417548d1b705a9ba54ba9429afe68920)  *index*)  const

ReturnsDataT for given index. Parameters \[in\]indexIndex of [Any](classansys_1_1dpf_1_1Any.xhtml) to get. 



<a id="a545436af4a3a2c404796ab128ad06890" name="a545436af4a3a2c404796ab128ad06890"></a>## [◆ ](#a545436af4a3a2c404796ab128ad06890)emptyCollection()

template&lt;typename DataT &gt; 

 [Collection](classansys_1_1dpf_1_1Collection.xhtml)&lt; DataT &gt; [ansys::dpf::Collection](classansys_1_1dpf_1_1Collection.xhtml)&lt; DataT &gt;::emptyCollection  static 

Create an empty container.

ReturnsEmpty container. 



<a id="a04b6d0e9e544f69be27dcfc3c79d5537" name="a04b6d0e9e544f69be27dcfc3c79d5537"></a>## [◆ ](#a04b6d0e9e544f69be27dcfc3c79d5537)getEntries()

template&lt;typename DataT &gt; 

 std::vector&lt; DataT &gt; [ansys::dpf::Collection](classansys_1_1dpf_1_1Collection.xhtml)&lt; DataT &gt;::getEntries  ( [LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) const &amp;  *label\_space*)  const

ReturnsVector of entries for given label space. Parameters \[in\]label\_space[Label](structansys_1_1dpf_1_1Label.xhtml) space for which to get entries. 



<a id="a6dea8d438075e38470c4b9a46ca9ec07" name="a6dea8d438075e38470c4b9a46ca9ec07"></a>## [◆ ](#a6dea8d438075e38470c4b9a46ca9ec07)getEntry()

template&lt;typename DataT &gt; 

 DataT [ansys::dpf::Collection](classansys_1_1dpf_1_1Collection.xhtml)&lt; DataT &gt;::getEntry  ( [LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) const &amp;  *label\_space*)  const

ReturnsFirst [Any](classansys_1_1dpf_1_1Any.xhtml) for given label space. Parameters \[in\]label\_space[Label](structansys_1_1dpf_1_1Label.xhtml) space for which to get [Any](classansys_1_1dpf_1_1Any.xhtml). 



<a id="a65acae9c8be4c94b19a82c28ae4419f7" name="a65acae9c8be4c94b19a82c28ae4419f7"></a>## [◆ ](#a65acae9c8be4c94b19a82c28ae4419f7)operator\[\]()

template&lt;typename DataT &gt; 

 DataT [ansys::dpf::Collection](classansys_1_1dpf_1_1Collection.xhtml)&lt; DataT &gt;::operator\[\]  ( [dp\_int](namespaceansys_1_1dpf.xhtml#a60d181a1f9d29cc7cc38b25dac4401f0)  *index*) 

Returns[Any](classansys_1_1dpf_1_1Any.xhtml) for given index. Parameters \[in\]indexIndex of entries within container. 



<a id="a2ee31954dd991137fe535f3a3b3ffeed" name="a2ee31954dd991137fe535f3a3b3ffeed"></a>## [◆ ](#a2ee31954dd991137fe535f3a3b3ffeed)update()

template&lt;typename DataT &gt; 

 void [ansys::dpf::Collection](classansys_1_1dpf_1_1Collection.xhtml)&lt; DataT &gt;::update  ( DataT &amp;  *f*,    [dp\_index](namespaceansys_1_1dpf.xhtml#a417548d1b705a9ba54ba9429afe68920)  *index*   ) 

Update a [Any](classansys_1_1dpf_1_1Any.xhtml) at index.

Parameters \[in\]fNew [Any](classansys_1_1dpf_1_1Any.xhtml). \[in\]indexIndex of [Any](classansys_1_1dpf_1_1Any.xhtml) to update.