    

 ## On this page

  

 

 # Class ansys::dpf::StringField

 Last update: 25.03.2026 

<a id="classansys-dpf-stringfield"></a>

![](https://img.shields.io/badge/language-C%2B%2B-blue "C++")![](https://img.shields.io/badge/-public-brightgreen "public")

Holds string data describing a Property located on given entities (the [StringField](classansys-dpf-stringfield.md#classansys-dpf-stringfield)'s data is bounded with its scoping). Is the equivalent of the [Field](classansys-dpf-field.md#classansys-dpf-field) but with string values data (and not double values).

**Inherits from**:

- [ansys::dpf::DpfTypes](classansys-dpf-dpftypes.md#classansys-dpf-dpftypes)

## Members

- [callAPI](classansys-dpf-dpftypes.md#classansys-dpf-dpftypes-1aea34d37e0c080126eff70db34bf46597)
- [data](classansys-dpf-stringfield.md#classansys-dpf-stringfield-1a4c6e1215a605ec027834fb45ae658fd7)
- [dataSize](classansys-dpf-stringfield.md#classansys-dpf-stringfield-1aeba443e66b156da5c91910e924cb2e7f)
- [describe](classansys-dpf-dpftypes.md#classansys-dpf-dpftypes-1a9977945710983bc03d2940fa007847b2)
- [empty](classansys-dpf-dpftypes.md#classansys-dpf-dpftypes-1a39cd546c42518e2332be8f287db95459)
- [emptyStringField](classansys-dpf-stringfield.md#classansys-dpf-stringfield-1ada5af3070f3550810a80a2130b816e4e)
- [entityData](classansys-dpf-stringfield.md#classansys-dpf-stringfield-1ae4d965f29b0169db846487806a63f0ae)
- [entityDataById](classansys-dpf-stringfield.md#classansys-dpf-stringfield-1a640dbd602194655feae974b6661a0864)
- [getClient](classansys-dpf-dpftypes.md#classansys-dpf-dpftypes-1a968afd9daa0b0f13b65a2ac61369d73a)
- [getData](classansys-dpf-stringfield.md#classansys-dpf-stringfield-1ae411e3f2e6c484b88ae6bb0388ab5126)
- [hasBeenMovedLocally](classansys-dpf-dpftypes.md#classansys-dpf-dpftypes-1a1a5634202c15404b6b24e8f50e51cb66)
- [hasInternalObject](classansys-dpf-dpftypes.md#classansys-dpf-dpftypes-1ae198f89868d85c7db6dc1a934a1d3c15)
- [isOnCommonAPI](classansys-dpf-dpftypes.md#classansys-dpf-dpftypes-1a9f9789ff61cc9d400a2a344830706b73)
- [isSameObject](classansys-dpf-dpftypes.md#classansys-dpf-dpftypes-1aa64d5f8fcd7d85ad6ebf708494dbefd7)
- [location](classansys-dpf-stringfield.md#classansys-dpf-stringfield-1a36498c54c9f757124419a3bc56218339)
- [operator=](classansys-dpf-stringfield.md#classansys-dpf-stringfield-1a8c5b159bd81a9ed0479e5a7552230d9d)
- [operator=](classansys-dpf-stringfield.md#classansys-dpf-stringfield-1ac803950756f1fbf53ad35e02604fb9b6)
- [push\_back](classansys-dpf-stringfield.md#classansys-dpf-stringfield-1a06eaa63c638cbe234067442096a3318a)
- [push\_back](classansys-dpf-stringfield.md#classansys-dpf-stringfield-1a9371a94961b517ac01791fff526a00d1)
- [reserve](classansys-dpf-stringfield.md#classansys-dpf-stringfield-1a87afeb83d4e137acc852fcc620ce232c)
- [resize](classansys-dpf-stringfield.md#classansys-dpf-stringfield-1aec82d7162816699fa809d59547545b76)
- [scoping](classansys-dpf-stringfield.md#classansys-dpf-stringfield-1aeeb9940f52222c264618d0788360300a)
- [setData](classansys-dpf-stringfield.md#classansys-dpf-stringfield-1a75fe878c8660665182a13809d521aee8)
- [setScoping](classansys-dpf-stringfield.md#classansys-dpf-stringfield-1a0b6d8c1c684bc28745a7f7c274c9b49d)
- [StringField](classansys-dpf-stringfield.md#classansys-dpf-stringfield-1a6515537907890dc10ff89602c897a960)
- [StringField](classansys-dpf-stringfield.md#classansys-dpf-stringfield-1a25f8ec9565065dd41156b707ecde16f2)
- [StringField](classansys-dpf-stringfield.md#classansys-dpf-stringfield-1a89883fda363ca4d9447b12492fa2cea2)
- [StringField](classansys-dpf-stringfield.md#classansys-dpf-stringfield-1ac32f4025219a0e1e03cea942fef67fc1)
- [StringField](classansys-dpf-stringfield.md#classansys-dpf-stringfield-1ac2c96f3bd937542c25f6640fe9765019)
- [~DpfTypes](classansys-dpf-dpftypes.md#classansys-dpf-dpftypes-1ab7c83b6ea160c2b115e056f6c312112f)
- [~StringField](classansys-dpf-stringfield.md#classansys-dpf-stringfield-1a5da02acc15e3c94f278e054e2efc2bc7)

## Friends

## Public static functions

<a id="classansys-dpf-stringfield-1ada5af3070f3550810a80a2130b816e4e"></a>

### Function emptyStringField

![](https://img.shields.io/badge/-public-brightgreen "public")![](https://img.shields.io/badge/-static-lightgrey "static")

```cpp
static StringField ansys::dpf::StringField::emptyStringField()

```

**Return type**: StringField

## Public functions

<a id="classansys-dpf-stringfield-1a5da02acc15e3c94f278e054e2efc2bc7"></a>

### Function ~StringField

![](https://img.shields.io/badge/-public-brightgreen "public")

```cpp
virtual ansys::dpf::StringField::~StringField()

```

**Return type**:

<a id="classansys-dpf-stringfield-1a6515537907890dc10ff89602c897a960"></a>

### Function StringField

![](https://img.shields.io/badge/-public-brightgreen "public")

```cpp
ansys::dpf::StringField::StringField(Client const *const client, dp_int number_of_entities=0, dp_int data_size=0)

```

Create an empty property field with a client.

**Parameters**:

- [Client](classansys-dpf-client.md#classansys-dpf-client) const \*const **client**: \[in\] [Client](classansys-dpf-client.md#classansys-dpf-client) to create the property field on.
- [dp\_int](namespaceansys-dpf.md#namespaceansys-dpf-1a60d181a1f9d29cc7cc38b25dac4401f0) **number\_of\_entities** = 0 : \[in\] Number of entities reserved.
- [dp\_int](namespaceansys-dpf.md#namespaceansys-dpf-1a60d181a1f9d29cc7cc38b25dac4401f0) **data\_size** = 0 : \[in\] Reserved size of data.

**Return type**:

<a id="classansys-dpf-stringfield-1a25f8ec9565065dd41156b707ecde16f2"></a>

### Function StringField

![](https://img.shields.io/badge/-public-brightgreen "public")

```cpp
ansys::dpf::StringField::StringField(int id, Client const *const client)

```

Retrieve an existing instance of [StringField](classansys-dpf-stringfield.md#classansys-dpf-stringfield) on a server.

**Parameters**:

- int **id**: \[in\] Id of the [StringField](classansys-dpf-stringfield.md#classansys-dpf-stringfield) object on the server's database.
- [Client](classansys-dpf-client.md#classansys-dpf-client) const \*const **client**: \[in\] [Client](classansys-dpf-client.md#classansys-dpf-client) instance designating the IP, port and protocol to use.

**Return type**:

<a id="classansys-dpf-stringfield-1a89883fda363ca4d9447b12492fa2cea2"></a>

### Function StringField

![](https://img.shields.io/badge/-public-brightgreen "public")

```cpp
ansys::dpf::StringField::StringField(dp_int number_of_entities=0, dp_int data_size=0)

```

Create a property with number of entities and data size.

**Parameters**:

- [dp\_int](namespaceansys-dpf.md#namespaceansys-dpf-1a60d181a1f9d29cc7cc38b25dac4401f0) **number\_of\_entities** = 0 : \[in\] Number of entities reserved.
- [dp\_int](namespaceansys-dpf.md#namespaceansys-dpf-1a60d181a1f9d29cc7cc38b25dac4401f0) **data\_size** = 0 : \[in\] Reserved size of data.

**Return type**:

<a id="classansys-dpf-stringfield-1ac32f4025219a0e1e03cea942fef67fc1"></a>

### Function StringField

![](https://img.shields.io/badge/-public-brightgreen "public")

```cpp
ansys::dpf::StringField::StringField(StringField const &)

```

**Parameters**:

- StringField const &amp;

**Return type**:

<a id="classansys-dpf-stringfield-1ac2c96f3bd937542c25f6640fe9765019"></a>

### Function StringField

![](https://img.shields.io/badge/-public-brightgreen "public")

```cpp
ansys::dpf::StringField::StringField(StringField &&) noexcept

```

**Parameters**:

- StringField &amp;&amp;

**Return type**:

<a id="classansys-dpf-stringfield-1a8c5b159bd81a9ed0479e5a7552230d9d"></a>

### Function operator=

![](https://img.shields.io/badge/-public-brightgreen "public")

```cpp
StringField & ansys::dpf::StringField::operator=(StringField const &)

```

**Parameters**:

- StringField const &amp;

**Return type**: StringField &amp;

<a id="classansys-dpf-stringfield-1ac803950756f1fbf53ad35e02604fb9b6"></a>

### Function operator=

![](https://img.shields.io/badge/-public-brightgreen "public")

```cpp
StringField & ansys::dpf::StringField::operator=(StringField &&) noexcept

```

**Parameters**:

- StringField &amp;&amp;

**Return type**: StringField &amp;

<a id="classansys-dpf-stringfield-1a36498c54c9f757124419a3bc56218339"></a>

### Function location

![](https://img.shields.io/badge/-public-brightgreen "public")![](https://img.shields.io/badge/-const-lightblue "const")

```cpp
Location ansys::dpf::StringField::location() const

```

**Returns**:

[Location](structansys-dpf-location.md#structansys-dpf-location) of the property.

**Return type**: [Location](structansys-dpf-location.md#structansys-dpf-location)

<a id="classansys-dpf-stringfield-1aeeb9940f52222c264618d0788360300a"></a>

### Function scoping

![](https://img.shields.io/badge/-public-brightgreen "public")![](https://img.shields.io/badge/-const-lightblue "const")

```cpp
Scoping ansys::dpf::StringField::scoping() const

```

**Returns**:

[Scoping](classansys-dpf-scoping.md#classansys-dpf-scoping) of the property.

**Return type**: [Scoping](classansys-dpf-scoping.md#classansys-dpf-scoping)

<a id="classansys-dpf-stringfield-1aeba443e66b156da5c91910e924cb2e7f"></a>

### Function dataSize

![](https://img.shields.io/badge/-public-brightgreen "public")![](https://img.shields.io/badge/-const-lightblue "const")

```cpp
dp_int ansys::dpf::StringField::dataSize() const

```

**Returns**:

Size of the data container.

**Return type**: [dp\_int](namespaceansys-dpf.md#namespaceansys-dpf-1a60d181a1f9d29cc7cc38b25dac4401f0)

<a id="classansys-dpf-stringfield-1a06eaa63c638cbe234067442096a3318a"></a>

### Function push\_back

![](https://img.shields.io/badge/-public-brightgreen "public")

```cpp
void ansys::dpf::StringField::push_back(dp_id entity_id, std::vector< std::string > const &values)

```

Push back the entity data.

**Parameters**:

- [dp\_id](namespaceansys-dpf.md#namespaceansys-dpf-1ab4574c9af3f2bb8011da7d1f4c8da20e) **entity\_id**: \[in\] Id of entity for which to push data.
- std::vector&lt; std::string &gt; const &amp; **values**: \[in\] Vector of data for entity.

**Return type**: void

<a id="classansys-dpf-stringfield-1a9371a94961b517ac01791fff526a00d1"></a>

### Function push\_back

![](https://img.shields.io/badge/-public-brightgreen "public")

```cpp
void ansys::dpf::StringField::push_back(dp_id entity_id, const std::string *values, dp_index size)

```

Push back the entity data.

**Parameters**:

- [dp\_id](namespaceansys-dpf.md#namespaceansys-dpf-1ab4574c9af3f2bb8011da7d1f4c8da20e) **entity\_id**: \[in\] Id of entity for which to push data.
- const std::string \* **values**: \[in\] Vector of data for entity.
- [dp\_index](namespaceansys-dpf.md#namespaceansys-dpf-1a417548d1b705a9ba54ba9429afe68920) **size**: \[in\] Number of entities.

**Return type**: void

<a id="classansys-dpf-stringfield-1a75fe878c8660665182a13809d521aee8"></a>

### Function setData

![](https://img.shields.io/badge/-public-brightgreen "public")

```cpp
void ansys::dpf::StringField::setData(std::vector< std::string > const &data)

```

Set the data of the property field.

**Parameters**:

- std::vector&lt; std::string &gt; const &amp; **data**: \[in\] Vector of data.

**Return type**: void

<a id="classansys-dpf-stringfield-1a0b6d8c1c684bc28745a7f7c274c9b49d"></a>

### Function setScoping

![](https://img.shields.io/badge/-public-brightgreen "public")

```cpp
void ansys::dpf::StringField::setScoping(ansys::dpf::Scoping &s)

```

Set the scoping of the property field.

**Parameters**:

- [ansys::dpf::Scoping](classansys-dpf-scoping.md#classansys-dpf-scoping) &amp; **s**

**Return type**: void

<a id="classansys-dpf-stringfield-1a4c6e1215a605ec027834fb45ae658fd7"></a>

### Function data

![](https://img.shields.io/badge/-public-brightgreen "public")![](https://img.shields.io/badge/-const-lightblue "const")

```cpp
DpfVector< std::string > ansys::dpf::StringField::data() const

```

**Returns**:

[DpfVector](classansys-dpf-dpfvector.md#classansys-dpf-dpfvector) of data array.

**Return type**: DpfVector&lt; std::string &gt;

<a id="classansys-dpf-stringfield-1ae411e3f2e6c484b88ae6bb0388ab5126"></a>

### Function getData

![](https://img.shields.io/badge/-public-brightgreen "public")![](https://img.shields.io/badge/-const-lightblue "const")

```cpp
void ansys::dpf::StringField::getData(std::vector< std::string > &values_to_fill) const

```

Get all data for property entities.

**Parameters**:

- std::vector&lt; std::string &gt; &amp; **values\_to\_fill**: \[out\] Property entity data.

**Return type**: void

<a id="classansys-dpf-stringfield-1ae4d965f29b0169db846487806a63f0ae"></a>

### Function entityData

![](https://img.shields.io/badge/-public-brightgreen "public")![](https://img.shields.io/badge/-const-lightblue "const")

```cpp
void ansys::dpf::StringField::entityData(dp_index entity_index, DpfVector< std::string > &data) const

```

**Returns**:

[DpfVector](classansys-dpf-dpfvector.md#classansys-dpf-dpfvector) of data array of an entity, by index.

**Parameters**:

- [dp\_index](namespaceansys-dpf.md#namespaceansys-dpf-1a417548d1b705a9ba54ba9429afe68920) **entity\_index**: \[in\] Index of entity for which to get data.
- DpfVector&lt; std::string &gt; &amp; **data**: \[out\] Pointer to the data.

**Return type**: void

<a id="classansys-dpf-stringfield-1a640dbd602194655feae974b6661a0864"></a>

### Function entityDataById

![](https://img.shields.io/badge/-public-brightgreen "public")![](https://img.shields.io/badge/-const-lightblue "const")

```cpp
void ansys::dpf::StringField::entityDataById(dp_id entity_id, DpfVector< std::string > &data) const

```

**Returns**:

[DpfVector](classansys-dpf-dpfvector.md#classansys-dpf-dpfvector) of data array of an entity, by id.

**Parameters**:

- [dp\_id](namespaceansys-dpf.md#namespaceansys-dpf-1ab4574c9af3f2bb8011da7d1f4c8da20e) **entity\_id**: \[in\] Id of entity for which to get data.
- DpfVector&lt; std::string &gt; &amp; **data**: \[out\] Pointer to the data.

**Return type**: void

<a id="classansys-dpf-stringfield-1a87afeb83d4e137acc852fcc620ce232c"></a>

### Function reserve

![](https://img.shields.io/badge/-public-brightgreen "public")

```cpp
void ansys::dpf::StringField::reserve(dp_int number_of_entities, dp_int overall_size=0)

```

Reserve the [Field](classansys-dpf-field.md#classansys-dpf-field). Only implemented for in process udage. To reserve the size for gRPC usage, use the constructor.

**Parameters**:

- [dp\_int](namespaceansys-dpf.md#namespaceansys-dpf-1a60d181a1f9d29cc7cc38b25dac4401f0) **number\_of\_entities**: \[in\] Number of entities.
- [dp\_int](namespaceansys-dpf.md#namespaceansys-dpf-1a60d181a1f9d29cc7cc38b25dac4401f0) **overall\_size** = 0 : \[in\] Total size of entity data.

**Return type**: void

<a id="classansys-dpf-stringfield-1aec82d7162816699fa809d59547545b76"></a>

### Function resize

![](https://img.shields.io/badge/-public-brightgreen "public")

```cpp
void ansys::dpf::StringField::resize(dp_int number_of_entities, dp_int overall_size)

```

Reserve the [Field](classansys-dpf-field.md#classansys-dpf-field).

**Parameters**:

- [dp\_int](namespaceansys-dpf.md#namespaceansys-dpf-1a60d181a1f9d29cc7cc38b25dac4401f0) **number\_of\_entities**: \[in\] Number of entities.
- [dp\_int](namespaceansys-dpf.md#namespaceansys-dpf-1a60d181a1f9d29cc7cc38b25dac4401f0) **overall\_size**: \[in\] Total size of entity data.

**Return type**: void