> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ansys::dpf::FieldsContainer Class Reference

Contains a group of fields.

`#include <dpf_api.h>`

Inherits ansys::dpf::CollectionBase.

## Public Member Functions

| Type | Name |
| - | - |
| | [FieldsContainer](#acf61fba680e2cf1bfeefc199751fc8aa) ([Client](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Client.md) const \*const client) |
| | [FieldsContainer](#ac721796f129c6e8986be8ce5977eefcc) ([Client](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Client.md) const \*const client, std::vector\< std::string > const &[labels](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/structansys_1_1dpf_1_1labels.md)) |
| | [FieldsContainer](#a8f56a88941a626857bb11528368f08e6) (int id, [Client](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Client.md) const \*const client) |
| | [FieldsContainer](#a22e1ed19ab76ad96df74d2084c9ea4f4) (const std::vector\< std::string > &[labels](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/structansys_1_1dpf_1_1labels.md)) |
| | **FieldsContainer** ([FieldsContainer](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1FieldsContainer.md) const &) |
| | **FieldsContainer** ([FieldsContainer](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1FieldsContainer.md) &&) noexcept |
| [FieldsContainer](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1FieldsContainer.md) & | **operator=** ([FieldsContainer](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1FieldsContainer.md) const &) |
| [FieldsContainer](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1FieldsContainer.md) & | **operator=** ([FieldsContainer](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1FieldsContainer.md) &&) noexcept |
| [Field](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Field.md) | [operator\[\]](#aea6b234cdf457204b5fa9c8e62c7b691) ([dp\_int](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/namespaceansys_1_1dpf#a60d181a1f9d29cc7cc38b25dac4401f0) index) |
| [Field](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Field.md) | [at](#addfee935e69fe9fb9e0e533449f9a5bc) ([dp\_index](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/namespaceansys_1_1dpf#a417548d1b705a9ba54ba9429afe68920) index) |
| const [Field](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Field.md) | [at](#a475eafcf1caa61c8113d4ea4dbcaa881) ([dp\_index](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/namespaceansys_1_1dpf#a417548d1b705a9ba54ba9429afe68920) index) const |
| void | [update](#a9f0704e94d480481e50abd20df33317c) ([Field](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Field.md) \&f, [dp\_index](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/namespaceansys_1_1dpf#a417548d1b705a9ba54ba9429afe68920) index) |
| void | [add](#a0c6bd75cbd78e7a25784ccc4a9f609d5) ([LabelSpace](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1LabelSpace.md) const \&lab\_space, [Field](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Field.md) const \&f) |
| std::vector\< [Field](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Field.md) > | [getFields](#aaa1bd58f282cf7e3bebb1fd1cfe6adbc) ([LabelSpace](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1LabelSpace.md) const \&lab\_space) const |
| [Field](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Field.md) | [getField](#aeb12b6212b016653f1eb325f19a9d1ce) ([LabelSpace](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1LabelSpace.md) const \&lab\_space) const |
| std::vector\< int > | [getFieldsIndeces](#a3a8ce9d9bf9a5ad8e4e3efb22d224cef) ([LabelSpace](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1LabelSpace.md) const \&lab\_space) const |
| std::vector\< [Field](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Field.md) > | [getFieldsForTimeId](#a45536132d19f7a61af3ff18e660ad8de) ([dp\_int](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/namespaceansys_1_1dpf#a60d181a1f9d29cc7cc38b25dac4401f0) time\_id, [dp\_int](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/namespaceansys_1_1dpf#a60d181a1f9d29cc7cc38b25dac4401f0) complex\_id=0) const |
| [FieldsContainer](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1FieldsContainer.md) | [createSubFieldsContainer](#a218a256c1ff051e4c3b9e979f1af3599) ([LabelSpace](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1LabelSpace.md) const \&lab\_space) const |
| [FieldsContainer](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1FieldsContainer.md) | [deep\_copy](#a7292a30f43f3d0276829f2a704569304) ([ansys::dpf::Client](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Client.md) const \*const client=nullptr) const |

## Static Public Member Functions

| Type | Name |
| - | - |
| static [FieldsContainer](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1FieldsContainer.md) | [emptyFieldsContainer](#af4bcbf19662088a80192c4306e76eab9) () |

## Detailed Description

Contains a group of fields.

[FieldsContainer](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1FieldsContainer.md) 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](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/group__group__12.md)

**Examples**

[AveragingTest.cpp](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/AveragingTest_8cpp-example.md), [CompleteRST.cpp](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/CompleteRST_8cpp-example.md), [DataApis.cpp](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/DataApis_8cpp-example.md), [DataExport.cpp](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/DataExport_8cpp-example.md), [ModelTest.cpp](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/ModelTest_8cpp-example.md), [OperatorsApis.cpp](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/OperatorsApis_8cpp-example.md), [ResultTest.cpp](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/ResultTest_8cpp-example.md), and [WorkflowExamples.cpp](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/WorkflowExamples_8cpp-example.md).

## Constructor & Destructor Documentation

### FieldsContainer() \[1/4]

```cpp theme={null}
ansys::dpf::FieldsContainer::FieldsContainer(Client const *const client)
```

Create a new fields container on a server.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | client | [Client](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Client.md) instance designating the IP, port and protocol to use. |

### FieldsContainer() \[2/4]

```cpp theme={null}
ansys::dpf::FieldsContainer::FieldsContainer(
    Client const *const client,
    std::vector< std::string > const & labels
)
```

Create a collection of fields with the given labels on a server.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | client | [Client](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Client.md) instance designating the IP, port and protocol to use. |
| \[in] | labels | Labels for fields. |

### FieldsContainer() \[3/4]

```cpp theme={null}
ansys::dpf::FieldsContainer::FieldsContainer(
    int id,
    Client const *const client
)
```

Retrieve an existing instance of [FieldsContainer](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1FieldsContainer.md) on a server. \


**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | id | Id of the [FieldsContainer](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1FieldsContainer.md) object on the server's database. |
| \[in] | client | [Client](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Client.md) instance designating the IP, port and protocol to use. |

### FieldsContainer() \[4/4]

```cpp theme={null}
ansys::dpf::FieldsContainer::FieldsContainer(const std::vector< std::string > & labels)
```

Create a collection of fields with the given labels.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | labels | Labels for fields. |

## Member Function Documentation

### add()

```cpp theme={null}
void ansys::dpf::FieldsContainer::add(
    LabelSpace const & lab_space,
    Field const & f
)
```

Add [Field](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Field.md) to [LabelSpace](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1LabelSpace.md).

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | lab\_space | [LabelSpace](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1LabelSpace.md) to which to add [Field](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Field.md). |
| \[in] | f | [Field](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Field.md) to add to [LabelSpace](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1LabelSpace.md). |

**Examples**

[DataApis.cpp](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/DataApis_8cpp-example.md), and [DataExport.cpp](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/DataExport_8cpp-example.md).

### at() \[1/2]

```cpp theme={null}
Field ansys::dpf::FieldsContainer::at(dp_index index)
```

Get field at index.

**Returns**

[Field](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Field.md) given by index.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | index | Index of field within container. |

**Examples**

[AveragingTest.cpp](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/AveragingTest_8cpp-example.md), and [CompleteRST.cpp](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/CompleteRST_8cpp-example.md).

### at() \[2/2]

```cpp theme={null}
const Field ansys::dpf::FieldsContainer::at(dp_index index) const
```

Get field at index.

**Returns**

[Field](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Field.md) given by index.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | index | Index of field. |

### createSubFieldsContainer()

```cpp theme={null}
FieldsContainer ansys::dpf::FieldsContainer::createSubFieldsContainer(
    LabelSpace const & lab_space
) const
```

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

**Returns**

Created fields container.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | lab\_space | [LabelSpace](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1LabelSpace.md) from which to get fields. |

### deep\_copy()

```cpp theme={null}
FieldsContainer ansys::dpf::FieldsContainer::deep_copy(
    ansys::dpf::Client const *const client = nullptr
) const
```

Create a new [FieldsContainer](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1FieldsContainer.md) on a server by copying all the data of this [FieldsContainer](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1FieldsContainer.md).

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | client | [Client](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Client.md) instance designating the IP, port and protocol to use. |

### emptyFieldsContainer()

```cpp theme={null}
static FieldsContainer ansys::dpf::FieldsContainer::emptyFieldsContainer()
```

`static`

Create an empty fields container.

**Returns**

Empty [FieldsContainer](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1FieldsContainer.md).

**Examples**

[DataExport.cpp](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/DataExport_8cpp-example.md).

### getField()

```cpp theme={null}
Field ansys::dpf::FieldsContainer::getField(LabelSpace const & lab_space) const
```

**Returns**

First [Field](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Field.md) given by [LabelSpace](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1LabelSpace.md)

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | lab\_space | [LabelSpace](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1LabelSpace.md) for which to get field. |

**Examples**

[DataExport.cpp](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/DataExport_8cpp-example.md).

### getFields()

```cpp theme={null}
std::vector< Field > ansys::dpf::FieldsContainer::getFields(LabelSpace const & lab_space) const
```

**Returns**

Fields given by [LabelSpace](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1LabelSpace.md)

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | lab\_space | [LabelSpace](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1LabelSpace.md) for which to get fields. |

### getFieldsForTimeId()

```cpp theme={null}
std::vector< Field > ansys::dpf::FieldsContainer::getFieldsForTimeId(
    dp_int time_id,
    dp_int complex_id = 0
) const
```

**Returns**

Real or imaginary (by default real) Fields at given time set.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | time\_id | Time Set Id (1 to # of time sets). |
| \[in] | complex\_id | Flag indicating to return imaginary part of result (0 = real part, 1 = imaginary part). |

### getFieldsIndeces()

```cpp theme={null}
std::vector< int > ansys::dpf::FieldsContainer::getFieldsIndeces(
    LabelSpace const & lab_space
) const
```

**Returns**

[Field](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Field.md) indices for field given by [LabelSpace](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1LabelSpace.md)

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | lab\_space | [LabelSpace](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1LabelSpace.md) defining field for which to get indices. |

### operator\[]\()

```cpp theme={null}
Field ansys::dpf::FieldsContainer::operator[](dp_int index)
```

Get field at index.

**Returns**

[Field](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Field.md) given by index.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | index | Index of field within container. |

### update()

```cpp theme={null}
void ansys::dpf::FieldsContainer::update(
    Field & f,
    dp_index index
)
```

Update [Field](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Field.md) at index

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | f | New field data. |
| \[in] | index | Index of field within container. |
