Skip to main content

DPF C++ Client Library 2025 R2

ansys::dpf::Collection< DataT > Class Template Reference

Last update: 16.07.2025

#include <dpf_api.h>

Inherits ansys::dpf::CollectionBase.

Public Member Functions

 Collection (Collection< DataT > const &)
 
 Collection (Collection< DataT > &&) noexcept
 
 Collection (std::vector< std::string > const &labels)
 
 Collection (Client const *const client)
 
 Collection (Client const *const client, std::vector< std::string > const &labels)
 
 Collection (int id, Client const *const client)
 
Collectionoperator= (Collection< DataT > const &)
 
Collectionoperator= (Collection< DataT > &&) noexcept
 
DataT operator[] (dp_int index)
 
DataT at (dp_index index)
 
const DataT at (dp_index index) const
 
void update (DataT &f, dp_index index)
 
void add (LabelSpace const &labels, DataT const &f, bool can_replace=true)
 
std::vector< DataT > getEntries (LabelSpace const &label_space) const
 
DataT getEntry (LabelSpace const &label_space) const
 
std::vector< dp_indexgetEntriesIndices (LabelSpace const &lab_space) const
 
Collection< DataT > createSubCollection (LabelSpace const &lab_space) const
 create a Collection with all the entries corresponding to the label space in input
 

Static Public Member Functions

static Collection< DataT > emptyCollection ()
 

Detailed Description

template<typename DataT>
class ansys::dpf::Collection< DataT >

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

Constructor & Destructor Documentation

◆ Collection() [1/4]

template<typename DataT >
ansys::dpf::Collection< DataT >::Collection ( std::vector< std::string > const &  labels)

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

Parameters
[in]labelsLabels for group of entries.

◆ Collection() [2/4]

template<typename DataT >
ansys::dpf::Collection< DataT >::Collection ( Client const *const  client)

Create a new collection on a server.

Parameters
[in]clientClient instance designating the IP, port and protocol to use.

◆ Collection() [3/4]

template<typename DataT >
ansys::dpf::Collection< DataT >::Collection ( Client const *const  client,
std::vector< std::string > const &  labels 
)

Create a collection with the given labels on a server.

Parameters
[in]clientClient instance designating the IP, port and protocol to use.
[in]labelsLabels for meshes.

◆ Collection() [4/4]

template<typename DataT >
ansys::dpf::Collection< DataT >::Collection ( int  id,
Client const *const  client 
)

Retrieve an existing instance of Collection on a server.

Parameters
[in]idId of the Collection object on the server's database.
[in]clientClient instance designating the IP, port and protocol to use.

Member Function Documentation

◆ add()

template<typename DataT >
void ansys::dpf::Collection< DataT >::add ( LabelSpace const &  labels,
DataT const &  f,
bool  can_replace = true 
)

Add Any with given label space.

Parameters
[in]labelsLabel space for Any.
[in]fAny 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.

◆ at() [1/2]

template<typename DataT >
DataT ansys::dpf::Collection< DataT >::at ( dp_index  index)
Returns
DataT for given index.
Parameters
[in]indexIndex of Any to get.

◆ at() [2/2]

template<typename DataT >
const DataT ansys::dpf::Collection< DataT >::at ( dp_index  index) const
Returns
DataT for given index.
Parameters
[in]indexIndex of Any to get.

◆ emptyCollection()

template<typename DataT >
Collection< DataT > ansys::dpf::Collection< DataT >::emptyCollection
static

Create an empty container.

Returns
Empty container.

◆ getEntries()

template<typename DataT >
std::vector< DataT > ansys::dpf::Collection< DataT >::getEntries ( LabelSpace const &  label_space) const
Returns
Vector of entries for given label space.
Parameters
[in]label_spaceLabel space for which to get entries.

◆ getEntry()

template<typename DataT >
DataT ansys::dpf::Collection< DataT >::getEntry ( LabelSpace const &  label_space) const
Returns
First Any for given label space.
Parameters
[in]label_spaceLabel space for which to get Any.

◆ operator[]()

template<typename DataT >
DataT ansys::dpf::Collection< DataT >::operator[] ( dp_int  index)
Returns
Any for given index.
Parameters
[in]indexIndex of entries within container.

◆ update()

template<typename DataT >
void ansys::dpf::Collection< DataT >::update ( DataT &  f,
dp_index  index 
)

Update a Any at index.

Parameters
[in]fNew Any.
[in]indexIndex of Any to update.

Connect with Ansys