    

 ## On this page

  

 

 # ansys::dpf::StringField Class Reference

 Last update: 16.07.2025 

`#include <dpf_api.h>`

Inheritance diagram for ansys::dpf::StringField:

 ![](/sites/default/files/migrate-content/dpf_cpp_client_library_2024_r1/classansys_1_1dpf_1_1StringField.png)



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

 [StringField](classansys_1_1dpf_1_1StringField.xhtml#a6515537907890dc10ff89602c897a960) ([Client](classansys_1_1dpf_1_1Client.xhtml) const \*const client, [dp\_int](namespaceansys_1_1dpf.xhtml#a60d181a1f9d29cc7cc38b25dac4401f0) number\_of\_entities=0, [dp\_int](namespaceansys_1_1dpf.xhtml#a60d181a1f9d29cc7cc38b25dac4401f0) data\_size=0)  [StringField](classansys_1_1dpf_1_1StringField.xhtml#a25f8ec9565065dd41156b707ecde16f2) (int id, [Client](classansys_1_1dpf_1_1Client.xhtml) const \*const client)  [StringField](classansys_1_1dpf_1_1StringField.xhtml#a89883fda363ca4d9447b12492fa2cea2) ([dp\_int](namespaceansys_1_1dpf.xhtml#a60d181a1f9d29cc7cc38b25dac4401f0) number\_of\_entities=0, [dp\_int](namespaceansys_1_1dpf.xhtml#a60d181a1f9d29cc7cc38b25dac4401f0) data\_size=0) <a id="ac32f4025219a0e1e03cea942fef67fc1" name="ac32f4025219a0e1e03cea942fef67fc1"></a> **StringField** ([StringField](classansys_1_1dpf_1_1StringField.xhtml) const &amp;) <a id="a5efaafbd95905a87e40b9e3c9dd9f763" name="a5efaafbd95905a87e40b9e3c9dd9f763"></a> **StringField** ([StringField](classansys_1_1dpf_1_1StringField.xhtml) &amp;&amp;) <a id="a8c5b159bd81a9ed0479e5a7552230d9d" name="a8c5b159bd81a9ed0479e5a7552230d9d"></a>[StringField](classansys_1_1dpf_1_1StringField.xhtml) &amp; **operator=** ([StringField](classansys_1_1dpf_1_1StringField.xhtml) const &amp;) <a id="a8b4bdff0db9fa460b304b8d41c0b1973" name="a8b4bdff0db9fa460b304b8d41c0b1973"></a>[StringField](classansys_1_1dpf_1_1StringField.xhtml) &amp; **operator=** ([StringField](classansys_1_1dpf_1_1StringField.xhtml) &amp;&amp;) [Location](structansys_1_1dpf_1_1Location.xhtml) [location](classansys_1_1dpf_1_1StringField.xhtml#a36498c54c9f757124419a3bc56218339) () const [Scoping](classansys_1_1dpf_1_1Scoping.xhtml) [scoping](classansys_1_1dpf_1_1StringField.xhtml#aeeb9940f52222c264618d0788360300a) () const [dp\_int](namespaceansys_1_1dpf.xhtml#a60d181a1f9d29cc7cc38b25dac4401f0) [dataSize](classansys_1_1dpf_1_1StringField.xhtml#aeba443e66b156da5c91910e924cb2e7f) () const void [push\_back](classansys_1_1dpf_1_1StringField.xhtml#a06eaa63c638cbe234067442096a3318a) ([dp\_id](namespaceansys_1_1dpf.xhtml#ab4574c9af3f2bb8011da7d1f4c8da20e) entity\_id, std::vector&lt; std::string &gt; const &amp;values) void [setData](classansys_1_1dpf_1_1StringField.xhtml#a75fe878c8660665182a13809d521aee8) (std::vector&lt; std::string &gt; const &amp;[data](classansys_1_1dpf_1_1StringField.xhtml#a4c6e1215a605ec027834fb45ae658fd7)) void [setScoping](classansys_1_1dpf_1_1StringField.xhtml#a0b6d8c1c684bc28745a7f7c274c9b49d) ([ansys::dpf::Scoping](classansys_1_1dpf_1_1Scoping.xhtml) &amp;s) [DpfVector](classansys_1_1dpf_1_1DpfVector.xhtml)&lt; std::string &gt; [data](classansys_1_1dpf_1_1StringField.xhtml#a4c6e1215a605ec027834fb45ae658fd7) () const void [getData](classansys_1_1dpf_1_1StringField.xhtml#ae411e3f2e6c484b88ae6bb0388ab5126) (std::vector&lt; std::string &gt; &amp;values\_to\_fill) const void [entityData](classansys_1_1dpf_1_1StringField.xhtml#ae4d965f29b0169db846487806a63f0ae) ([dp\_index](namespaceansys_1_1dpf.xhtml#a417548d1b705a9ba54ba9429afe68920) entity\_index, [DpfVector](classansys_1_1dpf_1_1DpfVector.xhtml)&lt; std::string &gt; &amp;[data](classansys_1_1dpf_1_1StringField.xhtml#a4c6e1215a605ec027834fb45ae658fd7)) const void [entityDataById](classansys_1_1dpf_1_1StringField.xhtml#a640dbd602194655feae974b6661a0864) ([dp\_id](namespaceansys_1_1dpf.xhtml#ab4574c9af3f2bb8011da7d1f4c8da20e) entity\_id, [DpfVector](classansys_1_1dpf_1_1DpfVector.xhtml)&lt; std::string &gt; &amp;[data](classansys_1_1dpf_1_1StringField.xhtml#a4c6e1215a605ec027834fb45ae658fd7)) const void [reserve](classansys_1_1dpf_1_1StringField.xhtml#a87afeb83d4e137acc852fcc620ce232c) ([dp\_int](namespaceansys_1_1dpf.xhtml#a60d181a1f9d29cc7cc38b25dac4401f0) number\_of\_entities, [dp\_int](namespaceansys_1_1dpf.xhtml#a60d181a1f9d29cc7cc38b25dac4401f0) overall\_size=0) void [resize](classansys_1_1dpf_1_1StringField.xhtml#aec82d7162816699fa809d59547545b76) ([dp\_int](namespaceansys_1_1dpf.xhtml#a60d181a1f9d29cc7cc38b25dac4401f0) number\_of\_entities, [dp\_int](namespaceansys_1_1dpf.xhtml#a60d181a1f9d29cc7cc38b25dac4401f0) overall\_size) ![-](/sites/default/files/migrate-content/dpf_cpp_client_library_2024_r1/closed.png) Public Member Functions inherited from [ansys::dpf::DpfTypes](classansys_1_1dpf_1_1DpfTypes.xhtml)virtual bool [empty](classansys_1_1dpf_1_1DpfTypes.xhtml#a39cd546c42518e2332be8f287db95459) () const virtual bool [hasInternalObject](classansys_1_1dpf_1_1DpfTypes.xhtml#ae198f89868d85c7db6dc1a934a1d3c15) () const virtual std::string [describe](classansys_1_1dpf_1_1DpfTypes.xhtml#a9977945710983bc03d2940fa007847b2) () const so::API const \* [callAPI](classansys_1_1dpf_1_1DpfTypes.xhtml#aea34d37e0c080126eff70db34bf46597) () const bool [isOnCommonAPI](classansys_1_1dpf_1_1DpfTypes.xhtml#a9f9789ff61cc9d400a2a344830706b73) () const bool [getClient](classansys_1_1dpf_1_1DpfTypes.xhtml#a968afd9daa0b0f13b65a2ac61369d73a) ([Client](classansys_1_1dpf_1_1Client.xhtml) &amp;client) const bool [hasBeenMovedLocally](classansys_1_1dpf_1_1DpfTypes.xhtml#a1a5634202c15404b6b24e8f50e51cb66) () const bool [isSameObject](classansys_1_1dpf_1_1DpfTypes.xhtml#aa64d5f8fcd7d85ad6ebf708494dbefd7) ([DpfTypes](classansys_1_1dpf_1_1DpfTypes.xhtml) const &amp;rhs) const ## <a id="pub-static-methods" name="pub-static-methods"></a>Static Public Member Functions

<a id="ada5af3070f3550810a80a2130b816e4e" name="ada5af3070f3550810a80a2130b816e4e"></a>static [StringField](classansys_1_1dpf_1_1StringField.xhtml) **emptyStringField** () <a id="details" name="details"></a>## Detailed Description

Holds string data describing a Property located on given entities (the [StringField](classansys_1_1dpf_1_1StringField.xhtml)'s data is bounded with its scoping). Is the equivalent of the [Field](classansys_1_1dpf_1_1Field.xhtml "Data for an entity.") but with string values data (and not double values).



## Constructor &amp; Destructor Documentation

<a id="a6515537907890dc10ff89602c897a960" name="a6515537907890dc10ff89602c897a960"></a>## [◆ ](#a6515537907890dc10ff89602c897a960)StringField() \[1/3\]

 ansys::dpf::StringField::StringField  ( [Client](classansys_1_1dpf_1_1Client.xhtml) const \*const  *client*,    [dp\_int](namespaceansys_1_1dpf.xhtml#a60d181a1f9d29cc7cc38b25dac4401f0)  *number\_of\_entities* = `0`,    [dp\_int](namespaceansys_1_1dpf.xhtml#a60d181a1f9d29cc7cc38b25dac4401f0)  *data\_size* = `0`   ) 

Create an empty property field with a client.

Parameters \[in\]client[Client](classansys_1_1dpf_1_1Client.xhtml) to create the property field on. \[in\]number\_of\_entitiesNumber of entities reserved. \[in\]data\_sizeReserved size of data. 



<a id="a25f8ec9565065dd41156b707ecde16f2" name="a25f8ec9565065dd41156b707ecde16f2"></a>## [◆ ](#a25f8ec9565065dd41156b707ecde16f2)StringField() \[2/3\]

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

Retrieve an existing instance of [StringField](classansys_1_1dpf_1_1StringField.xhtml) on a server.

Parameters \[in\]idId of the [StringField](classansys_1_1dpf_1_1StringField.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. 



<a id="a89883fda363ca4d9447b12492fa2cea2" name="a89883fda363ca4d9447b12492fa2cea2"></a>## [◆ ](#a89883fda363ca4d9447b12492fa2cea2)StringField() \[3/3\]

 ansys::dpf::StringField::StringField  ( [dp\_int](namespaceansys_1_1dpf.xhtml#a60d181a1f9d29cc7cc38b25dac4401f0)  *number\_of\_entities* = `0`,    [dp\_int](namespaceansys_1_1dpf.xhtml#a60d181a1f9d29cc7cc38b25dac4401f0)  *data\_size* = `0`   ) 

Create a property with number of entities and data size.

Parameters \[in\]number\_of\_entitiesNumber of entities reserved. \[in\]data\_sizeReserved size of data. 



## Member Function Documentation

<a id="a4c6e1215a605ec027834fb45ae658fd7" name="a4c6e1215a605ec027834fb45ae658fd7"></a>## [◆ ](#a4c6e1215a605ec027834fb45ae658fd7)data()

 [DpfVector](classansys_1_1dpf_1_1DpfVector.xhtml)&lt; std::string &gt; ansys::dpf::StringField::data  ( )  const

Returns[DpfVector](classansys_1_1dpf_1_1DpfVector.xhtml) of data array. 



<a id="aeba443e66b156da5c91910e924cb2e7f" name="aeba443e66b156da5c91910e924cb2e7f"></a>## [◆ ](#aeba443e66b156da5c91910e924cb2e7f)dataSize()

 [dp\_int](namespaceansys_1_1dpf.xhtml#a60d181a1f9d29cc7cc38b25dac4401f0) ansys::dpf::StringField::dataSize  ( )  const

ReturnsSize of the data container. 



<a id="ae4d965f29b0169db846487806a63f0ae" name="ae4d965f29b0169db846487806a63f0ae"></a>## [◆ ](#ae4d965f29b0169db846487806a63f0ae)entityData()

 void ansys::dpf::StringField::entityData  ( [dp\_index](namespaceansys_1_1dpf.xhtml#a417548d1b705a9ba54ba9429afe68920)  *entity\_index*,    [DpfVector](classansys_1_1dpf_1_1DpfVector.xhtml)&lt; std::string &gt; &amp;  *data*   )  const

Returns[DpfVector](classansys_1_1dpf_1_1DpfVector.xhtml) of data array of an entity, by index. Parameters \[in\]entity\_indexIndex of entity for which to get data. \[out\]dataPointer to the data. 



<a id="a640dbd602194655feae974b6661a0864" name="a640dbd602194655feae974b6661a0864"></a>## [◆ ](#a640dbd602194655feae974b6661a0864)entityDataById()

 void ansys::dpf::StringField::entityDataById  ( [dp\_id](namespaceansys_1_1dpf.xhtml#ab4574c9af3f2bb8011da7d1f4c8da20e)  *entity\_id*,    [DpfVector](classansys_1_1dpf_1_1DpfVector.xhtml)&lt; std::string &gt; &amp;  *data*   )  const

Returns[DpfVector](classansys_1_1dpf_1_1DpfVector.xhtml) of data array of an entity, by id. Parameters \[in\]entity\_idId of entity for which to get data. \[out\]dataPointer to the data. 



<a id="ae411e3f2e6c484b88ae6bb0388ab5126" name="ae411e3f2e6c484b88ae6bb0388ab5126"></a>## [◆ ](#ae411e3f2e6c484b88ae6bb0388ab5126)getData()

 void ansys::dpf::StringField::getData  ( std::vector&lt; std::string &gt; &amp;  *values\_to\_fill*)  const

Get all data for property entities.

Parameters \[out\]values\_to\_fillProperty entity data. 



<a id="a36498c54c9f757124419a3bc56218339" name="a36498c54c9f757124419a3bc56218339"></a>## [◆ ](#a36498c54c9f757124419a3bc56218339)location()

 [Location](structansys_1_1dpf_1_1Location.xhtml) ansys::dpf::StringField::location  ( )  const

Returns[Location](structansys_1_1dpf_1_1Location.xhtml) of the property. 



<a id="a06eaa63c638cbe234067442096a3318a" name="a06eaa63c638cbe234067442096a3318a"></a>## [◆ ](#a06eaa63c638cbe234067442096a3318a)push\_back()

 void ansys::dpf::StringField::push\_back  ( [dp\_id](namespaceansys_1_1dpf.xhtml#ab4574c9af3f2bb8011da7d1f4c8da20e)  *entity\_id*,    std::vector&lt; std::string &gt; const &amp;  *values*   ) 

Push back the entity data.

Parameters \[in\]entity\_idId of entity for which to push data. \[in\]valuesVector of data for entity. 



<a id="a87afeb83d4e137acc852fcc620ce232c" name="a87afeb83d4e137acc852fcc620ce232c"></a>## [◆ ](#a87afeb83d4e137acc852fcc620ce232c)reserve()

 void ansys::dpf::StringField::reserve  ( [dp\_int](namespaceansys_1_1dpf.xhtml#a60d181a1f9d29cc7cc38b25dac4401f0)  *number\_of\_entities*,    [dp\_int](namespaceansys_1_1dpf.xhtml#a60d181a1f9d29cc7cc38b25dac4401f0)  *overall\_size* = `0`   ) 

Reserve the [Field](classansys_1_1dpf_1_1Field.xhtml "Data for an entity."). Only implemented for in process udage. To reserve the size for gRPC usage, use the constructor.

Parameters \[in\]number\_of\_entitiesNumber of entities. \[in\]overall\_sizeTotal size of entity data. 



<a id="aec82d7162816699fa809d59547545b76" name="aec82d7162816699fa809d59547545b76"></a>## [◆ ](#aec82d7162816699fa809d59547545b76)resize()

 void ansys::dpf::StringField::resize  ( [dp\_int](namespaceansys_1_1dpf.xhtml#a60d181a1f9d29cc7cc38b25dac4401f0)  *number\_of\_entities*,    [dp\_int](namespaceansys_1_1dpf.xhtml#a60d181a1f9d29cc7cc38b25dac4401f0)  *overall\_size*   ) 

Reserve the [Field](classansys_1_1dpf_1_1Field.xhtml "Data for an entity.").

Parameters \[in\]number\_of\_entitiesNumber of entities. \[in\]overall\_sizeTotal size of entity data. 



<a id="aeeb9940f52222c264618d0788360300a" name="aeeb9940f52222c264618d0788360300a"></a>## [◆ ](#aeeb9940f52222c264618d0788360300a)scoping()

 [Scoping](classansys_1_1dpf_1_1Scoping.xhtml) ansys::dpf::StringField::scoping  ( )  const

Returns[Scoping](classansys_1_1dpf_1_1Scoping.xhtml) of the property. 



<a id="a75fe878c8660665182a13809d521aee8" name="a75fe878c8660665182a13809d521aee8"></a>## [◆ ](#a75fe878c8660665182a13809d521aee8)setData()

 void ansys::dpf::StringField::setData  ( std::vector&lt; std::string &gt; const &amp;  *data*) 

Set the data of the property field.

Parameters \[in\]dataVector of data. 



<a id="a0b6d8c1c684bc28745a7f7c274c9b49d" name="a0b6d8c1c684bc28745a7f7c274c9b49d"></a>## [◆ ](#a0b6d8c1c684bc28745a7f7c274c9b49d)setScoping()

 void ansys::dpf::StringField::setScoping  ( [ansys::dpf::Scoping](classansys_1_1dpf_1_1Scoping.xhtml) &amp;  *s*) 

Set the scoping of the property field.