    

 ## On this page

  

 

 # ansys::dpf::FieldsContainer Class Reference

 Last update: 16.07.2025 

Contains a group of fields. [More...](classansys_1_1dpf_1_1FieldsContainer.xhtml#details)

`#include <dpf_api.h>`

Inherits ansys::dpf::CollectionBase.

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

 [FieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml#acf61fba680e2cf1bfeefc199751fc8aa) ([Client](classansys_1_1dpf_1_1Client.xhtml) const \*const client)  [FieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml#ac721796f129c6e8986be8ce5977eefcc) ([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))  [FieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml#a8f56a88941a626857bb11528368f08e6) (int id, [Client](classansys_1_1dpf_1_1Client.xhtml) const \*const client)  [FieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml#a22e1ed19ab76ad96df74d2084c9ea4f4) (const std::vector&lt; std::string &gt; &amp;[labels](structansys_1_1dpf_1_1labels.xhtml)) <a id="a85f22edc2a63a092cf00e9fc839a28e6" name="a85f22edc2a63a092cf00e9fc839a28e6"></a> **FieldsContainer** ([FieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml) const &amp;) <a id="abedc3efe1ad10ebdb110da6561a858e8" name="abedc3efe1ad10ebdb110da6561a858e8"></a> **FieldsContainer** ([FieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml) &amp;&amp;) noexcept <a id="a8c309f116e976d6270f9e7ccbc320fad" name="a8c309f116e976d6270f9e7ccbc320fad"></a>[FieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml) &amp; **operator=** ([FieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml) const &amp;) <a id="ae1fc1fa17432b002face34b00493093e" name="ae1fc1fa17432b002face34b00493093e"></a>[FieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml) &amp; **operator=** ([FieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml) &amp;&amp;) noexcept [Field](classansys_1_1dpf_1_1Field.xhtml) [operator\[\]](classansys_1_1dpf_1_1FieldsContainer.xhtml#aea6b234cdf457204b5fa9c8e62c7b691) ([dp\_int](namespaceansys_1_1dpf.xhtml#a60d181a1f9d29cc7cc38b25dac4401f0) index) [Field](classansys_1_1dpf_1_1Field.xhtml) [at](classansys_1_1dpf_1_1FieldsContainer.xhtml#addfee935e69fe9fb9e0e533449f9a5bc) ([dp\_index](namespaceansys_1_1dpf.xhtml#a417548d1b705a9ba54ba9429afe68920) index) const [Field](classansys_1_1dpf_1_1Field.xhtml) [at](classansys_1_1dpf_1_1FieldsContainer.xhtml#a475eafcf1caa61c8113d4ea4dbcaa881) ([dp\_index](namespaceansys_1_1dpf.xhtml#a417548d1b705a9ba54ba9429afe68920) index) const void [update](classansys_1_1dpf_1_1FieldsContainer.xhtml#a9f0704e94d480481e50abd20df33317c) ([Field](classansys_1_1dpf_1_1Field.xhtml) &amp;f, [dp\_index](namespaceansys_1_1dpf.xhtml#a417548d1b705a9ba54ba9429afe68920) index) void [add](classansys_1_1dpf_1_1FieldsContainer.xhtml#a0c6bd75cbd78e7a25784ccc4a9f609d5) ([LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) const &amp;lab\_space, [Field](classansys_1_1dpf_1_1Field.xhtml) const &amp;f) std::vector&lt; [Field](classansys_1_1dpf_1_1Field.xhtml) &gt; [getFields](classansys_1_1dpf_1_1FieldsContainer.xhtml#aaa1bd58f282cf7e3bebb1fd1cfe6adbc) ([LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) const &amp;lab\_space) const [Field](classansys_1_1dpf_1_1Field.xhtml) [getField](classansys_1_1dpf_1_1FieldsContainer.xhtml#aeb12b6212b016653f1eb325f19a9d1ce) ([LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) const &amp;lab\_space) const std::vector&lt; int &gt; [getFieldsIndeces](classansys_1_1dpf_1_1FieldsContainer.xhtml#a3a8ce9d9bf9a5ad8e4e3efb22d224cef) ([LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) const &amp;lab\_space) const std::vector&lt; [Field](classansys_1_1dpf_1_1Field.xhtml) &gt; [getFieldsForTimeId](classansys_1_1dpf_1_1FieldsContainer.xhtml#a45536132d19f7a61af3ff18e660ad8de) ([dp\_int](namespaceansys_1_1dpf.xhtml#a60d181a1f9d29cc7cc38b25dac4401f0) time\_id, [dp\_int](namespaceansys_1_1dpf.xhtml#a60d181a1f9d29cc7cc38b25dac4401f0) complex\_id=0) const [FieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml) [createSubFieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml#a218a256c1ff051e4c3b9e979f1af3599) ([LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) const &amp;lab\_space) const [FieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml) [deep\_copy](classansys_1_1dpf_1_1FieldsContainer.xhtml#a7292a30f43f3d0276829f2a704569304) ([ansys::dpf::Client](classansys_1_1dpf_1_1Client.xhtml) const \*const client=nullptr) const ## <a id="pub-static-methods" name="pub-static-methods"></a>Static Public Member Functions

static [FieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml) [emptyFieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml#af4bcbf19662088a80192c4306e76eab9) () <a id="details" name="details"></a>## Detailed Description

Contains a group of fields.

[FieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml) is a group of fields, used mainly in transient, harmonic, modal or multi-steps static analysis, where we can have a field for each time step or for each frequency. Consequently the fields container can describle a complete analysis with all its details.

The fields container is designed as a set of fields ordered through labels and ids. Labels identify how the fields are filtered. The most common fields container have the label "time" with ids corresponding to each time sets, the label "complex" will allow to separate real parts (id=0) from imaginary parts (id=1) in a harmonic analysis.

See also[Using collections and labels](group__group__12.xhtml) Examples[AveragingTest.cpp](AveragingTest_8cpp-example.xhtml#_a6), [CompleteRST.cpp](CompleteRST_8cpp-example.xhtml#_a29), [DataApis.cpp](DataApis_8cpp-example.xhtml#_a37), [DataExport.cpp](DataExport_8cpp-example.xhtml#_a4), [ModelTest.cpp](ModelTest_8cpp-example.xhtml#_a47), [OperatorsApis.cpp](OperatorsApis_8cpp-example.xhtml#_a5), [ResultTest.cpp](ResultTest_8cpp-example.xhtml#_a22), and [WorkflowExamples.cpp](WorkflowExamples_8cpp-example.xhtml#_a5).

## Constructor &amp; Destructor Documentation

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

 ansys::dpf::FieldsContainer::FieldsContainer  ( [Client](classansys_1_1dpf_1_1Client.xhtml) const \*const  *client*) 

Create a new fields container on a server.

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



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

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

Create a collection of fields 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 fields. 



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

 ansys::dpf::FieldsContainer::FieldsContainer  ( int  *id*,    [Client](classansys_1_1dpf_1_1Client.xhtml) const \*const  *client*   ) 

Retrieve an existing instance of [FieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml "Contains a group of fields.") on a server.

Parameters \[in\]idId of the [FieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml "Contains a group of fields.") object on the server's database. \[in\]client[Client](classansys_1_1dpf_1_1Client.xhtml) instance designating the IP, port and protocol to use. 



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

 ansys::dpf::FieldsContainer::FieldsContainer  ( const std::vector&lt; std::string &gt; &amp;  *labels*) 

Create a collection of fields with the given labels.

Parameters \[in\]labelsLabels for fields. 



## Member Function Documentation

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

 void ansys::dpf::FieldsContainer::add  ( [LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) const &amp;  *lab\_space*,    [Field](classansys_1_1dpf_1_1Field.xhtml) const &amp;  *f*   ) 

Add [Field](classansys_1_1dpf_1_1Field.xhtml) to [LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml).

Parameters \[in\]lab\_space[LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) to which to add [Field](classansys_1_1dpf_1_1Field.xhtml). \[in\]f[Field](classansys_1_1dpf_1_1Field.xhtml) to add to [LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml). Examples[DataApis.cpp](DataApis_8cpp-example.xhtml#a41), and [DataExport.cpp](DataExport_8cpp-example.xhtml#a33).



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

 [Field](classansys_1_1dpf_1_1Field.xhtml) ansys::dpf::FieldsContainer::at  ( [dp\_index](namespaceansys_1_1dpf.xhtml#a417548d1b705a9ba54ba9429afe68920)  *index*) 

Get field at index.

Returns[Field](classansys_1_1dpf_1_1Field.xhtml) given by index. Parameters \[in\]indexIndex of field within container. Examples[AveragingTest.cpp](AveragingTest_8cpp-example.xhtml#a8), and [CompleteRST.cpp](CompleteRST_8cpp-example.xhtml#a32).



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

 const [Field](classansys_1_1dpf_1_1Field.xhtml) ansys::dpf::FieldsContainer::at  ( [dp\_index](namespaceansys_1_1dpf.xhtml#a417548d1b705a9ba54ba9429afe68920)  *index*)  const

Get field at index.

Returns[Field](classansys_1_1dpf_1_1Field.xhtml) given by index. Parameters \[in\]indexIndex of field. 



<a id="a218a256c1ff051e4c3b9e979f1af3599" name="a218a256c1ff051e4c3b9e979f1af3599"></a>## [◆ ](#a218a256c1ff051e4c3b9e979f1af3599)createSubFieldsContainer()

 [FieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml) ansys::dpf::FieldsContainer::createSubFieldsContainer  ( [LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) const &amp;  *lab\_space*)  const

Create a new fields container with all the fields corresponding to the label space in input.

ReturnsCreated fields container. Parameters \[in\]lab\_space[LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) from which to get fields. 



<a id="a7292a30f43f3d0276829f2a704569304" name="a7292a30f43f3d0276829f2a704569304"></a>## [◆ ](#a7292a30f43f3d0276829f2a704569304)deep\_copy()

 [FieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml) ansys::dpf::FieldsContainer::deep\_copy  ( [ansys::dpf::Client](classansys_1_1dpf_1_1Client.xhtml) const \*const  *client* = `nullptr`)  const

Create a new [FieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml "Contains a group of fields.") on a server by copying all the data of this [FieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml "Contains a group of fields.").

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



<a id="af4bcbf19662088a80192c4306e76eab9" name="af4bcbf19662088a80192c4306e76eab9"></a>## [◆ ](#af4bcbf19662088a80192c4306e76eab9)emptyFieldsContainer()

 static [FieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml) ansys::dpf::FieldsContainer::emptyFieldsContainer  ( )   static 

Create an empty fields container.

ReturnsEmpty [FieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml). Examples[DataExport.cpp](DataExport_8cpp-example.xhtml#a39).



<a id="aeb12b6212b016653f1eb325f19a9d1ce" name="aeb12b6212b016653f1eb325f19a9d1ce"></a>## [◆ ](#aeb12b6212b016653f1eb325f19a9d1ce)getField()

 [Field](classansys_1_1dpf_1_1Field.xhtml) ansys::dpf::FieldsContainer::getField  ( [LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) const &amp;  *lab\_space*)  const

ReturnsFirst [Field](classansys_1_1dpf_1_1Field.xhtml) given by [LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) Parameters \[in\]lab\_space[LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) for which to get field. Examples[DataExport.cpp](DataExport_8cpp-example.xhtml#a35).



<a id="aaa1bd58f282cf7e3bebb1fd1cfe6adbc" name="aaa1bd58f282cf7e3bebb1fd1cfe6adbc"></a>## [◆ ](#aaa1bd58f282cf7e3bebb1fd1cfe6adbc)getFields()

 std::vector&lt; [Field](classansys_1_1dpf_1_1Field.xhtml) &gt; ansys::dpf::FieldsContainer::getFields  ( [LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) const &amp;  *lab\_space*)  const

ReturnsFields given by [LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) Parameters \[in\]lab\_space[LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) for which to get fields. 



<a id="a45536132d19f7a61af3ff18e660ad8de" name="a45536132d19f7a61af3ff18e660ad8de"></a>## [◆ ](#a45536132d19f7a61af3ff18e660ad8de)getFieldsForTimeId()

 std::vector&lt; [Field](classansys_1_1dpf_1_1Field.xhtml) &gt; ansys::dpf::FieldsContainer::getFieldsForTimeId  ( [dp\_int](namespaceansys_1_1dpf.xhtml#a60d181a1f9d29cc7cc38b25dac4401f0)  *time\_id*,    [dp\_int](namespaceansys_1_1dpf.xhtml#a60d181a1f9d29cc7cc38b25dac4401f0)  *complex\_id* = `0`   )  const

ReturnsReal or imaginary (by default real) Fields at given time set. Parameters \[in\]time\_idTime Set Id (1 to # of time sets). \[in\]complex\_idFlag indicating to return imaginary part of result (0 = real part, 1 = imaginary part). 



<a id="a3a8ce9d9bf9a5ad8e4e3efb22d224cef" name="a3a8ce9d9bf9a5ad8e4e3efb22d224cef"></a>## [◆ ](#a3a8ce9d9bf9a5ad8e4e3efb22d224cef)getFieldsIndeces()

 std::vector&lt; int &gt; ansys::dpf::FieldsContainer::getFieldsIndeces  ( [LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) const &amp;  *lab\_space*)  const

Returns[Field](classansys_1_1dpf_1_1Field.xhtml "Data for an entity.") indices for field given by [LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) Parameters \[in\]lab\_space[LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) defining field for which to get indices. 



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

 [Field](classansys_1_1dpf_1_1Field.xhtml) ansys::dpf::FieldsContainer::operator\[\]  ( [dp\_int](namespaceansys_1_1dpf.xhtml#a60d181a1f9d29cc7cc38b25dac4401f0)  *index*) 

Get field at index.

Returns[Field](classansys_1_1dpf_1_1Field.xhtml) given by index. Parameters \[in\]indexIndex of field within container. 



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

 void ansys::dpf::FieldsContainer::update  ( [Field](classansys_1_1dpf_1_1Field.xhtml) &amp;  *f*,    [dp\_index](namespaceansys_1_1dpf.xhtml#a417548d1b705a9ba54ba9429afe68920)  *index*   ) 

Update [Field](classansys_1_1dpf_1_1Field.xhtml "Data for an entity.") at index

Parameters \[in\]fNew field data. \[in\]indexIndex of field within container.