Class ansys::dpf::Field
Last update: 25.03.2026
Data for an entity.
The field is the main simulation data container. In numerical simulations, results data are defined by values associated to entities (scoping), and these entities are a subset of a model (support). In DPF, field data is always associated to its scoping and support, making the field a self-describing piece of data. A field is also defined by its dimensionnality, unit, location... A field can for example, describe a displacement vector or norm, stresses and strains tensors, stresses and strains equivalent, min max over time of any result... It can be defined on a complete model or just on certain entities of the model thanks to its scoping. The data is stored as a vector of double values and each elementary entity has a number of components (thanks to the dimensionality, a displacement will have 3 components, a symmetrical stress matrix 6...)
Inherits from:
Members
- addStringProperty
- callAPI
- cloneToCustomTypeField
- cloneToField
- cloneToPropertyField
- createFieldWithTransformation
- data
- data
- dataPointer
- dataSize
- deep_copy
- describe
- empty
- emptyField
- entityData
- entityData
- entityDataById
- entityDataById
- entityId
- Field
- Field
- Field
- Field
- Field
- fieldDefinition
- fillCursor
- getClient
- getData
- getHeaderAsDataTree
- getStringProperty
- hasBeenMovedLocally
- hasInternalObject
- identicalPointers
- isOnCommonAPI
- isSameObject
- name
- numberOfComponents
- numberOfElementaryData
- numberOfElementaryDataByEntityId
- numberOfElementaryDataByEntityIndex
- numberOfEntities
- operator=
- operator=
- push_back
- push_back
- push_back
- reserve
- resize
- resizeDataPointer
- scoping
- setData
- setData
- setDataPointer
- setDataPointer
- setFieldDefinition
- setHeaderAsDataTree
- setName
- setScoping
- setSupport
- setSupport
- setSupport
- support
- ~DpfTypes
- ~Field
Friends
Public functions
Function Field
ansys::dpf::Field::Field(int reserved_number_of_entity=0, const std::vector< int > &dimensions={ 1 }, const Location &loc=locations::nodal)
Create a group of data with given dimensions and locations.
Parameters:
- int reserved_number_of_entity = 0 : [in] Number of entities.
- const std::vector< int > & dimensions = { 1 } : [in] Dimension of each entity.
- const Location & loc = locations::nodal : [in] Location of entities.
Return type:
Function Field
ansys::dpf::Field::Field(Client const *const client, int reserved_number_of_entity=0, const std::vector< int > &dimensions={ 1 }, const Location &loc=locations::nodal)
Create a group of data with given dimensions and locations on a server.
Parameters:
- Client const *const client: [in] Remote client.
- int reserved_number_of_entity = 0 : [in] Number of entities.
- const std::vector< int > & dimensions = { 1 } : [in] Dimension of each entity.
- const Location & loc = locations::nodal : [in] Location of entities.
Return type:
Function Field
ansys::dpf::Field::Field(int id, Client const *const client)
Retrieve an existing instance of Field on a server.
Parameters:
- int id: [in] Id of the Field object on the server's database.
- Client const *const client: [in] Client instance designating the IP, port and protocol to use.
Return type:
Function ~Field
virtual ansys::dpf::Field::~Field()
Return type:
Function Field
ansys::dpf::Field::Field(Field const &)
Parameters:
- Field const &
Return type:
Function Field
ansys::dpf::Field::Field(Field &&) noexcept
Parameters:
- Field &&
Return type:
Function operator=
Field & ansys::dpf::Field::operator=(Field const &)
Parameters:
- Field const &
Return type: Field &
Function operator=
Field & ansys::dpf::Field::operator=(Field &&) noexcept
Parameters:
- Field &&
Return type: Field &
Function identicalPointers
bool ansys::dpf::Field::identicalPointers(Field const &f) const
Compare field with input field f.
Parameters:
- Field const & f: [in] Field with which to compare.
Return type: bool
Function numberOfComponents
dp_int ansys::dpf::Field::numberOfComponents() const
Returns:
Number of components in the elementary data.
Return type: dp_int
Function numberOfEntities
dp_int ansys::dpf::Field::numberOfEntities() const
Returns:
Number of entities in the Field. Only implemented for in process udage. For gRPC usage, use scoping().size().
Return type: dp_int
Function numberOfElementaryData
dp_int ansys::dpf::Field::numberOfElementaryData() const
Returns:
Number of elementary data (size = number of components) contained in the Field.
Return type: dp_int
Function numberOfElementaryDataByEntityIndex
dp_int ansys::dpf::Field::numberOfElementaryDataByEntityIndex(dp_int entityIndex) const
Returns:
Number of elementary data by entity index.
Parameters:
- dp_int entityIndex
Return type: dp_int
Function numberOfElementaryDataByEntityId
dp_int ansys::dpf::Field::numberOfElementaryDataByEntityId(dp_int entityId) const
Returns:
Number of elementary data by entity id.
Parameters:
- dp_int entityId
Return type: dp_int
Function dataSize
dp_int ansys::dpf::Field::dataSize() const
Returns:
Size of the data container.
Return type: dp_int
Function name
std::string ansys::dpf::Field::name() const
Returns:
Name of Field.
Return type: std::string
Function setName
void ansys::dpf::Field::setName(const std::string &name)
Set name of Field.
Parameters:
- const std::string & name: [in] New name.
Return type: void
Function addStringProperty
void ansys::dpf::Field::addStringProperty(const char *key, const char *sProp) const
Add property of given key and string value. If key is already set, then value is updated with sProp.
Parameters:
- const char * key
- const char * sProp
Return type: void
Function getStringProperty
bool ansys::dpf::Field::getStringProperty(const char *key, std::string &sProp) const
Returns:
True if property of given key is set. Sprop is updated with the property's value.
Parameters:
- const char * key
- std::string & sProp
Return type: bool
Function data
dp_double *const ansys::dpf::Field::data(int &size) const
Returns:
Pointer to data array.
Parameters:
- int & size: [out] Size of returned data array.
Return type: dp_double *const
Function data
DpfVector< double > ansys::dpf::Field::data() const
Returns:
DpfVector of data array.
Return type: DpfVector< double >
Function dataPointer
DpfVector< int > ansys::dpf::Field::dataPointer() const
Returns:
DpfVector of data pointer array.
Return type: DpfVector< int >
Function getData
void ansys::dpf::Field::getData(std::vector< dp_double > &data_to_fill) const
Copy the data for all entities in a vector of double.
Parameters:
- std::vector< dp_double > & data_to_fill: [out] Vector of data for all entities.
Return type: void
Function entityData
dp_double *const ansys::dpf::Field::entityData(dp_index entity_index, dp_int &size) const
Returns:
Pointer to data array of an entity, by index.
Parameters:
- dp_index entity_index: [in] Index of entity for which to get data.
- dp_int & size: [out] Size of returned data array.
Return type: dp_double *const
Function entityData
void ansys::dpf::Field::entityData(dp_index entity_index, DpfVector< double > &data) const
Returns:
DpfVector of data array of an entity, by index.
Parameters:
- dp_index entity_index: [in] Index of entity for which to get data.
- DpfVector< double > & data: [out] Pointer to the data.
Return type: void
Function entityDataById
dp_double *const ansys::dpf::Field::entityDataById(dp_id entity_id, dp_int &size) const
Returns:
Pointer to data array of an entity, by id.
Parameters:
- dp_id entity_id: [in] Id of entity for which to get data.
- dp_int & size: [out] Size of returned data array.
Return type: dp_double *const
Function entityDataById
void ansys::dpf::Field::entityDataById(dp_id entity_id, DpfVector< double > &data) const
Returns:
DpfVector of data array of an entity, by id.
Parameters:
- dp_id entity_id: [in] Id of entity for which to get data.
- DpfVector< double > & data: [out] Pointer to the data.
Return type: void
Function entityId
dp_id ansys::dpf::Field::entityId(dp_index entity_index) const
Returns:
Entity id corresponding to a given entity index
Parameters:
- dp_index entity_index: [in] Index of entity for which to get Id.
Return type: dp_id
Function scoping
Scoping ansys::dpf::Field::scoping() const
Returns:
Scoping of the field.
Return type: Scoping
Function fieldDefinition
FieldDefinition ansys::dpf::Field::fieldDefinition() const
Returns:
FieldDefinition of the field.
Return type: FieldDefinition
Function support
Support ansys::dpf::Field::support() const
Returns:
Support of the field.
Return type: Support
Function setFieldDefinition
void ansys::dpf::Field::setFieldDefinition(FieldDefinition const &f)
Set the FieldDefinition.
Parameters:
- FieldDefinition const & f
Return type: void
Function setScoping
void ansys::dpf::Field::setScoping(ansys::dpf::Scoping const &s)
Parameters:
- ansys::dpf::Scoping const & s
Return type: void
Function setData
void ansys::dpf::Field::setData(std::vector< double > const &data)
Set the data of the field.
Parameters:
- std::vector< double > const & data: [in] Vector of data.
Return type: void
Function setData
void ansys::dpf::Field::setData(double const *const data, int size)
Set the data of the field.
Parameters:
- double const *const data: [in] List of data.
- int size: [in] Size of list.
Return type: void
Function setDataPointer
void ansys::dpf::Field::setDataPointer(std::vector< int > &data) const
Set the data pointer of the field.
Parameters:
- std::vector< int > & data: [in] Vector of data.
Return type: void
Function setDataPointer
void ansys::dpf::Field::setDataPointer(int const *const data, int size) const
Set the data pointer of the field.
Parameters:
- int const *const data: [in] List of data.
- int size: [in] Size of list.
Return type: void
Function setSupport
void ansys::dpf::Field::setSupport(ansys::dpf::Support const &s)
Set the support of the Field.
Parameters:
- ansys::dpf::Support const & s: [in] Field to support.
Return type: void
Function setSupport
void ansys::dpf::Field::setSupport(ansys::dpf::TimeFreqSupport const &s)
Set the support of the Field.
Parameters:
- ansys::dpf::TimeFreqSupport const & s: [in] TimeFreqSupport to support.
Return type: void
Function setSupport
void ansys::dpf::Field::setSupport(ansys::dpf::MeshedRegion const &s)
Set the support of the Field.
Parameters:
- ansys::dpf::MeshedRegion const & s: [in] MeshedRegion to support.
Return type: void
Function reserve
void ansys::dpf::Field::reserve(dp_int number_of_entities, dp_int overall_size=0)
Reserve the Field. Only implemented for in process udage. To reserve the size for gRPC usage, use the constructor.
Parameters:
- dp_int number_of_entities: [in] Number of entities.
- dp_int overall_size = 0 : [in] Total size of entity data.
Return type: void
Function resize
void ansys::dpf::Field::resize(dp_int number_of_entities, dp_int overall_size)
Reserve the Field.
Parameters:
- dp_int number_of_entities: [in] Number of entities.
- dp_int overall_size: [in] Total size of entity data.
Return type: void
Function resizeDataPointer
void ansys::dpf::Field::resizeDataPointer(dp_int number_of_entities)
[in] Number of entities
Resize the dataPointer array.
Parameters:
- dp_int number_of_entities
Return type: void
Function fillCursor
void ansys::dpf::Field::fillCursor(dp_index index, FieldCursor &f) const
Get data at a given index.
Parameters:
- dp_index index: [in] Index of entity for which to get data.
- FieldCursor & f: [out] FieldCursor with which to contain data.
Return type: void
Function push_back
void ansys::dpf::Field::push_back(dp_id entity_id, std::vector< dp_double > const &values)
Push back the entity data.
Parameters:
- dp_id entity_id: [in] Index of entity for which to push data.
- std::vector< dp_double > const & values: [in] Vector of data for entity.
Return type: void
Function push_back
void ansys::dpf::Field::push_back(dp_id entity_id, const dp_double *values, int size)
Push back the entity data.
Parameters:
- dp_id entity_id: [in] Index of entity for which to push data.
- const dp_double * values: [in] Ptr on data for entity.
- int size: [in] Number of entities.
Return type: void
Function push_back
void ansys::dpf::Field::push_back(dp_id entity_id, dp_double *values, int size)
Push back the entity data.
Parameters:
- dp_id entity_id: [in] Index of entity for which to push data.
- dp_double * values: [in] Ptr on data for entity.
- int size: [in] Number of entities.
Return type: void
Function deep_copy
Field ansys::dpf::Field::deep_copy(ansys::dpf::Client const *const client=nullptr) const
Make a deep copy on a given client.
Parameters:
- ansys::dpf::Client const *const client = nullptr : [in] Remote client
Return type: Field
Function cloneToCustomTypeField
CustomTypeField ansys::dpf::Field::cloneToCustomTypeField(ansys::dpf::Client const *const client=nullptr, bool const copy_ids=true, bool const copy_data_ptr=true, bool const copy_support=true) const
Creates a new custom type field object from current field without its data.
Parameters:
- ansys::dpf::Client const *const client = nullptr : [in] Remote client
- bool const copy_ids = true : [in] Boolean to decide if scoping ids are to be copied
- bool const copy_data_ptr = true : [in] Boolean to decide if data pointer is to be copied
- bool const copy_support = true : [in] Boolean to decide if the support reference is to be copied
Return type: CustomTypeField
Function cloneToField
Field ansys::dpf::Field::cloneToField(ansys::dpf::Client const *const client=nullptr, bool const copy_ids=true, bool const copy_data_ptr=true, bool const copy_support=true) const
Creates a new field object from current field without its data.
Parameters:
- ansys::dpf::Client const *const client = nullptr : [in] Remote client
- bool const copy_ids = true : [in] Boolean to decide if scoping ids are to be copied
- bool const copy_data_ptr = true : [in] Boolean to decide if data pointer is to be copied
- bool const copy_support = true : [in] Boolean to decide if the support reference is to be copied
Return type: Field
Function cloneToPropertyField
PropertyField ansys::dpf::Field::cloneToPropertyField(ansys::dpf::Client const *const client=nullptr, bool const copy_ids=true, bool const copy_data_ptr=true, bool const copy_support=true) const
Creates a new property field object from current field without its data.
Parameters:
- ansys::dpf::Client const *const client = nullptr : [in] Remote client
- bool const copy_ids = true : [in] Boolean to decide if scoping ids are to be copied
- bool const copy_data_ptr = true : [in] Boolean to decide if data pointer is to be copied
- bool const copy_support = true : [in] Boolean to decide if the support reference is to be copied
Return type: PropertyField
Function getHeaderAsDataTree
DataTree ansys::dpf::Field::getHeaderAsDataTree() const
Get the header of the Field as a DataTree object.
Return type: DataTree
Function setHeaderAsDataTree
void ansys::dpf::Field::setHeaderAsDataTree(const DataTree &datatree)
Set the header of the field using a DataTree object.
Parameters:
- const DataTree & datatree
Return type: void
Public static functions
Function emptyField
static Field ansys::dpf::Field::emptyField()
Create an empty Field. Returns:
Empty Field.
Return type: Field
Function createFieldWithTransformation
static Field ansys::dpf::Field::createFieldWithTransformation(Workflow transformation_wf, int reserved_number_of_entity=0, const std::vector< int > &dimensions={ 1 }, const Location &loc=locations::nodal, std::string const &input_name_to_connect="input_field", std::string const &output_name_to_eval="transformed_field")
Instantiate a Field with Transformation. For each call to a getter, the workflow in input is connected this Field to input_name_to_connect and the Field output in output_name_to_eval is used as the getter instance.
Parameters:
- Workflow transformation_wf: [in] Transformation workflow.
- int reserved_number_of_entity = 0 : [in] Number of entities.
- const std::vector< int > & dimensions = { 1 } : [in] Dimension of each entity.
- const Location & loc = locations::nodal
- std::string const & input_name_to_connect = "input_field" : [in] Name of the input of the workflow to connect. Should take a Field.
- std::string const & output_name_to_eval = "transformed_field" : [in] Name of the output of the workflow to evaluate. Should return a Field.
Return type: Field