Skip to main content

DPF C++ client library 2023 R2

ansys::dpf::CustomTypeField Class Reference

Last update: 10.07.2023

#include <dpf_api.h>

Inheritance diagram for ansys::dpf::CustomTypeField:
ansys::dpf::DpfTypes

Public Member Functions

template<typename UnitaryDataType >
 CustomTypeField (Client const *const client, UnitaryDataType *, dp_int reserved_number_of_entities=0, dp_int reserved_num_unitary_data=0)
 
template<typename UnitaryDataType >
 CustomTypeField (UnitaryDataType *, dp_int reserved_number_of_entities=0, dp_int reserved_num_unitary_data=0)
 
 CustomTypeField (Client const *const client, dp_int unitary_data_num_bytes, dp_int reserved_number_of_entities=0, dp_int reserved_num_unitary_data=0)
 
 CustomTypeField (dp_int unitary_data_num_bytes, dp_int reserved_number_of_entities=0, dp_int reserved_num_unitary_data=0)
 
 CustomTypeField (CustomTypeField const &)
 
 CustomTypeField (CustomTypeField &&)
 
CustomTypeFieldoperator= (CustomTypeField const &)
 
CustomTypeFieldoperator= (CustomTypeField &&)
 
bool identicalPointers (CustomTypeField const &f) const
 
std::string name () const
 
void setName (const std::string &name)
 
Scoping scoping () const
 
dp_int dataSize () const
 
dp_int numberOfComponents () const
 
dp_int numberOfEntities () const
 
dp_int numberOfElementaryData () const
 
template<typename UnitaryDataType >
void push_back (dp_id entity_id, std::vector< UnitaryDataType > const &values)
 
template<typename UnitaryDataType >
void push_back (dp_id entity_id, const UnitaryDataType *values, dp_int size)
 
template<typename UnitaryDataType >
void setData (std::vector< UnitaryDataType > const &data)
 
template<typename UnitaryDataType >
void setData (UnitaryDataType const *const data, int size)
 
void setDataPointer (std::vector< dp_int > const &data)
 
void setDataPointer (dp_int const *const data, int size)
 
void setScoping (ansys::dpf::Scoping &s)
 
template<typename UnitaryDataType >
void getData (std::vector< UnitaryDataType > &values_to_fill) const
 
template<typename UnitaryDataType >
DpfVector< UnitaryDataType > data () const
 
DpfVector< int > dataPointer () const
 
template<typename UnitaryDataType >
void entityData (dp_index entity_index, DpfVector< UnitaryDataType > &data) const
 
template<typename UnitaryDataType >
void entityDataById (dp_id entity_id, DpfVector< UnitaryDataType > &data) const
 
void reserve (dp_int number_of_entities, dp_int overall_size=0)
 
void resize (dp_int number_of_entities, dp_int overall_size)
 
FieldDefinition fieldDefinition () const
 
Support support () const
 
void setSupport (ansys::dpf::Support &s)
 
void setFieldDefinition (FieldDefinition const &f)
 
template<typename UnitaryDataType >
bool isOfUnitaryType () const
 
- Public Member Functions inherited from ansys::dpf::DpfTypes
virtual bool empty () const
 
virtual std::string describe () const
 
so::API const * callAPI () const
 
bool isOnCommonAPI () const
 
bool getClient (Client &client) const
 
bool hasBeenMovedLocally () const
 
bool isSameObject (DpfTypes const &rhs) const
 

Static Public Member Functions

static CustomTypeField emptyCustomTypeField ()
 

Detailed Description

Holds data located on given entities (the Field's data is bounded with its scoping). The unitary data type can be chosen by the user (it can be int32, float, char...). Is the equivalent of the Field but with custom type values data. (and not double values).

Constructor & Destructor Documentation

◆ CustomTypeField() [1/4]

template<typename UnitaryDataType >
ansys::dpf::CustomTypeField::CustomTypeField ( Client const *const  client,
UnitaryDataType *  ,
dp_int  reserved_number_of_entities = 0,
dp_int  reserved_num_unitary_data = 0 
)

Create an empty custom type field with a client. The unitary data type will be UnitaryDataType. For example, use ansys::dpf::CustomTypeField f(ansys::dpf::UseType<float>()).

Parameters
[in]clientClient to create the custom property field on.
[in]reserved_number_of_entitiesNumber of entities to reserve in the scoping.
[in]reserved_num_unitary_dataReserved size of data=reserved_num_unitary_data*unitary_data_num_bytes.

◆ CustomTypeField() [2/4]

template<typename UnitaryDataType >
ansys::dpf::CustomTypeField::CustomTypeField ( UnitaryDataType *  ,
dp_int  reserved_number_of_entities = 0,
dp_int  reserved_num_unitary_data = 0 
)

Create a property with number of entities and data size. The unitary data type will be UnitaryDataType. For example, use ansys::dpf::CustomTypeField f(ansys::dpf::UseType<float>()).

Parameters
[in]reserved_number_of_entitiesNumber of entities to reserve in the scoping.
[in]reserved_num_unitary_dataReserved size of data=reserved_num_unitary_data*unitary_data_num_bytes.

◆ CustomTypeField() [3/4]

ansys::dpf::CustomTypeField::CustomTypeField ( Client const *const  client,
dp_int  unitary_data_num_bytes,
dp_int  reserved_number_of_entities = 0,
dp_int  reserved_num_unitary_data = 0 
)

Create an empty custom type field with a client. The unitary data type will be of size unitary_data_num_bytes.

Parameters
[in]clientClient to create the custom property field on.
[in]unitary_data_num_bytesNum bytes by unitary data.
[in]reserved_number_of_entitiesNumber of entities to reserve in the scoping.
[in]reserved_num_unitary_dataReserved size of data=reserved_num_unitary_data*unitary_data_num_bytes.

◆ CustomTypeField() [4/4]

ansys::dpf::CustomTypeField::CustomTypeField ( dp_int  unitary_data_num_bytes,
dp_int  reserved_number_of_entities = 0,
dp_int  reserved_num_unitary_data = 0 
)

Create a property with number of entities and data size. The unitary data type will be of size unitary_data_num_bytes.

Parameters
[in]unitary_data_num_bytesNum bytes by unitary data.
[in]reserved_number_of_entitiesNumber of entities to reserve in the scoping.
[in]reserved_num_unitary_dataReserved size of data=reserved_num_unitary_data*unitary_data_num_bytes.

Member Function Documentation

◆ data()

template<typename UnitaryDataType >
DpfVector< UnitaryDataType > ansys::dpf::CustomTypeField::data
Returns
DpfVector of data array. The unitary data type should be UnitaryDataType.

◆ dataPointer()

DpfVector< int > ansys::dpf::CustomTypeField::dataPointer ( ) const
Returns
DpfVector of data array.

◆ dataSize()

dp_int ansys::dpf::CustomTypeField::dataSize ( ) const
Returns
Size of the data container.

◆ entityData()

template<typename UnitaryDataType >
void ansys::dpf::CustomTypeField::entityData ( dp_index  entity_index,
DpfVector< UnitaryDataType > &  data 
) const
Returns
DpfVector of data array of an entity, by index. The unitary data type should be UnitaryDataType.
Parameters
[in]entity_indexIndex of entity for which to get data.
[out]dataPointer to the data.

◆ entityDataById()

template<typename UnitaryDataType >
void ansys::dpf::CustomTypeField::entityDataById ( dp_id  entity_id,
DpfVector< UnitaryDataType > &  data 
) const
Returns
DpfVector of data array of an entity, by id. The unitary data type should be UnitaryDataType.
Parameters
[in]entity_idId of entity for which to get data.
[out]dataPointer to the data.

◆ fieldDefinition()

FieldDefinition ansys::dpf::CustomTypeField::fieldDefinition ( ) const
Returns
FieldDefinition of the field.

◆ getData()

template<typename UnitaryDataType >
void ansys::dpf::CustomTypeField::getData ( std::vector< UnitaryDataType > &  values_to_fill) const

Get all data for property entities. The unitary data type should be UnitaryDataType.

Parameters
[out]values_to_fillProperty entity data.

◆ identicalPointers()

bool ansys::dpf::CustomTypeField::identicalPointers ( CustomTypeField const &  f) const

Compare field with input field f.

Parameters
[in]fField with which to compare.

◆ isOfUnitaryType()

template<typename UnitaryDataType >
bool ansys::dpf::CustomTypeField::isOfUnitaryType

tests the type of the Field.

◆ name()

std::string ansys::dpf::CustomTypeField::name ( ) const
Returns
Name of CustomTypeField.

◆ numberOfComponents()

dp_int ansys::dpf::CustomTypeField::numberOfComponents ( ) const
Returns
Number of components in the property data.

◆ numberOfElementaryData()

dp_int ansys::dpf::CustomTypeField::numberOfElementaryData ( ) const
Returns
Number of elementary data (size = number of components) contained in the CustomTypeField.

◆ numberOfEntities()

dp_int ansys::dpf::CustomTypeField::numberOfEntities ( ) const
Returns
Number of entities in the Field Only implemented for in process udage. For gRPC usage, use scoping().size().

◆ push_back() [1/2]

template<typename UnitaryDataType >
void ansys::dpf::CustomTypeField::push_back ( dp_id  entity_id,
const UnitaryDataType *  values,
dp_int  size 
)

Push back the entity data. The unitary data type should be UnitaryDataType.

Parameters
[in]entity_idIndex of entity for which to push data.
[in]valuesPtr on data for entity.
[in]sizeNumber of entities.

◆ push_back() [2/2]

template<typename UnitaryDataType >
void ansys::dpf::CustomTypeField::push_back ( dp_id  entity_id,
std::vector< UnitaryDataType > const &  values 
)

Push back the entity data. The unitary data type should be UnitaryDataType.

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

◆ reserve()

void ansys::dpf::CustomTypeField::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
[in]number_of_entitiesNumber of entities.
[in]overall_sizeTotal size of entity data.

◆ resize()

void ansys::dpf::CustomTypeField::resize ( dp_int  number_of_entities,
dp_int  overall_size 
)

Reserve the Field.

Parameters
[in]number_of_entitiesNumber of entities.
[in]overall_sizeTotal size of entity data.

◆ scoping()

Scoping ansys::dpf::CustomTypeField::scoping ( ) const
Returns
Scoping of the property.

◆ setData() [1/2]

template<typename UnitaryDataType >
void ansys::dpf::CustomTypeField::setData ( std::vector< UnitaryDataType > const &  data)

Set the data of the custom property field.

Push back the entity data. The unitary data type should be UnitaryDataType.

Parameters
[in]dataVector of data.

◆ setData() [2/2]

template<typename UnitaryDataType >
void ansys::dpf::CustomTypeField::setData ( UnitaryDataType const *const  data,
int  size 
)

Set the data of the custom property field. The unitary data type should be UnitaryDataType.

Parameters
[in]dataList of data.
[in]sizeSize of list.

◆ setDataPointer() [1/2]

void ansys::dpf::CustomTypeField::setDataPointer ( dp_int const *const  data,
int  size 
)

Set the data pointer of the custom type field.

Parameters
[in]dataList of data.
[in]sizeSize of list.

◆ setDataPointer() [2/2]

void ansys::dpf::CustomTypeField::setDataPointer ( std::vector< dp_int > const &  data)

Set the data pointer of the custom type field.

Parameters
[in]dataVector of data.

◆ setFieldDefinition()

void ansys::dpf::CustomTypeField::setFieldDefinition ( FieldDefinition const &  f)

Set the FieldDefinition.

◆ setName()

void ansys::dpf::CustomTypeField::setName ( const std::string &  name)

Set name of CustomTypeField.

Parameters
[in]nameNew name.

◆ setScoping()

void ansys::dpf::CustomTypeField::setScoping ( ansys::dpf::Scoping s)

Set the scoping of the custom property field.

◆ setSupport()

void ansys::dpf::CustomTypeField::setSupport ( ansys::dpf::Support s)

Set the support of the Field.

Parameters
[in]sField to support.

◆ support()

Support ansys::dpf::CustomTypeField::support ( ) const
Returns
Support of the field.