IOSS 2.0
Loading...
Searching...
No Matches
Ioss::GroupingEntity Class Referenceabstract

Base class for all 'grouping' entities. The following derived classes are typical: More...

#include <Ioss_GroupingEntity.h>

Inheritance diagram for Ioss::GroupingEntity:
[legend]
Collaboration diagram for Ioss::GroupingEntity:
[legend]

Public Member Functions

 GroupingEntity ()=default
 
 GroupingEntity (DatabaseIO *io_database, const std::string &my_name, int64_t entity_count)
 Base class constructor adds "name" and "entity_count" properties to the entity.
 
 GroupingEntity (const GroupingEntity &other)
 
GroupingEntityoperator= (const GroupingEntity &rhs)=delete
 
virtual ~GroupingEntity ()
 
IOSS_NODISCARD State get_state () const
 Get the current Ioss::State of the entity.
 
IOSS_NODISCARD DatabaseIOget_database () const
 
void set_database (DatabaseIO *io_database)
 
void reset_database (DatabaseIO *io_database)
 
virtual void delete_database ()
 
virtual IOSS_NODISCARD const GroupingEntitycontained_in () const
 
IOSS_NODISCARD const std::string & name () const
 Get name of entity.
 
void set_name (const std::string &new_name)
 Set the name of the entity.
 
IOSS_NODISCARD std::string generic_name () const
 Get a generated name based on the type of the entity and the id.
 
IOSS_NODISCARD bool is_alias (const std::string &my_name) const
 
virtual void block_membership (std::vector< std::string > &)
 Get list of blocks that the entities in this GroupingEntity "touch".
 
IOSS_NODISCARD std::string get_filename () const
 Get the file name associated with the database containing this entity.
 
virtual IOSS_NODISCARD std::string type_string () const =0
 Get the name of the particular type of entity.
 
virtual IOSS_NODISCARD std::string short_type_string () const =0
 Get a short name of the particular type of entity.
 
virtual IOSS_NODISCARD std::string contains_string () const =0
 What does this entity contain.
 
virtual IOSS_NODISCARD EntityType type () const =0
 Get the EntityType, which indicates the particular type of GroupingEntity this is.
 
void property_add (const Property &new_prop)
 Add a property to the entity's property manager.
 
void property_erase (const std::string &property_name)
 Remove a property from the entity's property manager.
 
IOSS_NODISCARD bool property_exists (const std::string &property_name) const
 Checks if a property exists in the entity's property manager.
 
IOSS_NODISCARD Property get_property (const std::string &property_name) const
 Get the Property from the property manager associated with the entity.
 
IOSS_NODISCARD int64_t get_optional_property (const std::string &property, int64_t optional_value) const
 
IOSS_NODISCARD std::string get_optional_property (const std::string &property_name, const std::string &optional_value) const
 
IOSS_NODISCARD NameList property_describe () const
 Get the names of all properties in the property manager for this entity.
 
int property_describe (NameList *names) const
 Get the names of all properties in the property manager for this entity.
 
IOSS_NODISCARD NameList property_describe (Ioss::Property::Origin origin) const
 
int property_describe (Ioss::Property::Origin origin, NameList *names) const
 
IOSS_NODISCARD size_t property_count () const
 Get the number of properties defined in the property manager for this entity.
 
void property_update (const std::string &property, int64_t value) const
 
void property_update (const std::string &property, const std::string &value) const
 
void field_add (Field new_field)
 Add a field to the entity's field manager.
 
void field_erase (const std::string &field_name)
 Remove a field from the entity's field manager.
 
void field_erase (Field::RoleType role)
 Remove all fields of type role from the entity's field manager.
 
IOSS_NODISCARD bool field_exists (const std::string &field_name) const
 Checks if a field with a given name exists in the entity's field manager.
 
IOSS_NODISCARD Field get_field (const std::string &field_name) const
 Get a field from the entity's field manager.
 
IOSS_NODISCARD const Fieldget_fieldref (const std::string &field_name) const
 Get a reference to a field from the entity's field manager.
 
int field_describe (NameList *names) const
 Get the names of all fields in the entity's field manager.
 
IOSS_NODISCARD NameList field_describe () const
 Get the names of all fields in the entity's field manager.
 
int field_describe (Field::RoleType role, NameList *names) const
 Get the names of all fields of a specified RoleType in the entity's field manager.
 
IOSS_NODISCARD NameList field_describe (Field::RoleType role) const
 Get the names of all fields of a specified RoleType in the entity's field manager.
 
IOSS_NODISCARD size_t field_count () const
 Get the number of fields in the entity's field manager.
 
IOSS_NODISCARD size_t field_count (Field::RoleType role) const
 Get the number of fields with the given role (MESH, ATTRIBUTE, TRANSIENT, REDUCTION, etc.) in the entity's field manager.
 
IOSS_NODISCARD bool check_for_duplicate (const Ioss::Field &new_field) const
 
int64_t get_field_data (const std::string &field_name, void *data, size_t data_size) const
 Read field data from the database file into memory using a pointer.
 
int64_t put_field_data (const std::string &field_name, void *data, size_t data_size) const
 Write field data from memory into the database file using a pointer.
 
int64_t get_field_data (const std::string &field_name, void **data, size_t *data_size) const
 
template<typename T >
int64_t get_field_data (const std::string &field_name, std::vector< T > &data) const
 Read type 'T' field data from the database file into memory using a std::vector.
 
template<typename T >
int64_t put_field_data (const std::string &field_name, const std::vector< T > &data) const
 Write type 'T' field data from memory into the database file using a std::vector.
 
template<typename T >
int64_t put_field_data (const std::string &field_name, std::vector< T > &data) const
 
IOSS_NODISCARD Ioss::Field::BasicType field_int_type () const
 
IOSS_NODISCARD unsigned int hash () const
 
IOSS_NODISCARD int64_t entity_count () const
 
IOSS_NODISCARD bool operator!= (const GroupingEntity &rhs) const
 
IOSS_NODISCARD bool operator== (const GroupingEntity &rhs) const
 
IOSS_NODISCARD bool equal (const GroupingEntity &rhs) const
 

Protected Member Functions

void count_attributes () const
 
bool set_state (State new_state)
 
void really_delete_database ()
 
virtual IOSS_NODISCARD Property get_implicit_property (const std::string &my_name) const =0
 Calculate and get an implicit property.
 
virtual int64_t internal_get_field_data (const Field &field, void *data, size_t data_size=0) const =0
 
virtual int64_t internal_put_field_data (const Field &field, void *data, size_t data_size=0) const =0
 
virtual int64_t internal_get_zc_field_data (const Field &field, void **data, size_t *data_size) const =0
 
IOSS_NODISCARD bool equal_ (const GroupingEntity &rhs, bool quiet) const
 

Protected Attributes

PropertyManager properties
 
FieldManager fields
 
int64_t entityCount = 0
 

Private Member Functions

void verify_field_exists (const std::string &field_name, const std::string &inout) const
 

Private Attributes

std::string entityName {}
 
DatabaseIOdatabase_ = nullptr
 
int64_t attributeCount = 0
 
State entityState = STATE_CLOSED
 
unsigned int hash_ = 0
 

Friends

class Property
 

Detailed Description

Base class for all 'grouping' entities. The following derived classes are typical:

NodeSet – grouping of nodes (0d topology)

EdgeSet – grouping of edges (1d topology)

FaceSet – grouping of faces (2d topology) [Surface]

Similarly, there is:

NodeBlock – grouping of 'similar' nodes (same degree of freedom, ...)

ElementBlock – grouping of 'similar' elements (same element topology, attributes, ...) 0d, 1d, 2d, 3d topology possible – e.g., sphere, bar, quad, hex

A Region is also a grouping entity, except that its list of subentites are other GroupingEntities. That is, it maintains a list of NodeBlocks, ElementBlocks, NodeLists, CommLists and Surfaces. [Similar to the "Composite Pattern" in Design Patterns] All interface to GroupingEntities is through the Region class; clients of the IO subsystem have no direct access to the underlying GroupingEntities (other than the Region).

Each GroupingEntity contains:

– name

– MeshEntities of the specified topological dimension

– Optional attributes, either global (applied to the groupingentity), or unique value(s) to be applied to each subentity.

– Data items

Constructor & Destructor Documentation

◆ GroupingEntity() [1/3]

Ioss::GroupingEntity::GroupingEntity ( )
default

◆ GroupingEntity() [2/3]

Ioss::GroupingEntity::GroupingEntity ( Ioss::DatabaseIO * io_database,
const std::string & my_name,
int64_t entity_cnt )

Base class constructor adds "name" and "entity_count" properties to the entity.

Parameters
[in]io_databaseThe database associated with the entity.
[in]my_nameThe entity name.
[in]entity_cntThe number of subentities in the entity.

◆ GroupingEntity() [3/3]

Ioss::GroupingEntity::GroupingEntity ( const GroupingEntity & other)

◆ ~GroupingEntity()

Ioss::GroupingEntity::~GroupingEntity ( )
virtual

Member Function Documentation

◆ block_membership()

virtual void Ioss::GroupingEntity::block_membership ( std::vector< std::string > & )
inlinevirtual

Get list of blocks that the entities in this GroupingEntity "touch".

For a SideSet, returns a list of the element blocks that the elements in the set belong to. For others, it returns an empty vector. Entries are pushed onto the "block_members" vector, so it will be appended to if it is not empty at entry to the function.

Reimplemented in Ioss::SideBlock, Ioss::SideSet, Ioss::EdgeSet, Ioss::ElementSet, and Ioss::FaceSet.

◆ check_for_duplicate()

bool Ioss::GroupingEntity::check_for_duplicate ( const Ioss::Field & new_field) const

◆ contained_in()

const Ioss::GroupingEntity * Ioss::GroupingEntity::contained_in ( ) const
virtual

Return the GroupingEntity pointer of the "object" that this entity is contained in. For example, a SideBlock would return the SideSet that "owns" the SideBlock. Most GroupingEntities would return the containing Region A region would return itself(?) A NodeBlock containing the subset of nodes in a StructuredBlock would return that StructuredBlock.

Reimplemented in Ioss::NodeBlock, and Ioss::SideBlock.

◆ contains_string()

virtual IOSS_NODISCARD std::string Ioss::GroupingEntity::contains_string ( ) const
pure virtual

◆ count_attributes()

void Ioss::GroupingEntity::count_attributes ( ) const
protected

◆ delete_database()

void Ioss::GroupingEntity::delete_database ( )
virtual

Reimplemented in Ioss::Region.

◆ entity_count()

IOSS_NODISCARD int64_t Ioss::GroupingEntity::entity_count ( ) const
inline

◆ equal()

bool Ioss::GroupingEntity::equal ( const GroupingEntity & rhs) const

◆ equal_()

bool Ioss::GroupingEntity::equal_ ( const GroupingEntity & rhs,
bool quiet ) const
protected

◆ field_add()

void Ioss::GroupingEntity::field_add ( Ioss::Field new_field)

Add a field to the entity's field manager.

Assumes that a field with the same name does not already exist.

Parameters
[in]new_fieldThe field to add

◆ field_count() [1/2]

size_t Ioss::GroupingEntity::field_count ( ) const
inline

Get the number of fields in the entity's field manager.

Returns
The number of fields in the entity's field manager.

◆ field_count() [2/2]

size_t Ioss::GroupingEntity::field_count ( Field::RoleType role) const

Get the number of fields with the given role (MESH, ATTRIBUTE, TRANSIENT, REDUCTION, etc.) in the entity's field manager.

Returns
The number of fields with the given role.

◆ field_describe() [1/4]

Ioss::NameList Ioss::GroupingEntity::field_describe ( ) const
inline

Get the names of all fields in the entity's field manager.

Returns
All field names in the entity's field manager.

◆ field_describe() [2/4]

Ioss::NameList Ioss::GroupingEntity::field_describe ( Field::RoleType role) const
inline

Get the names of all fields of a specified RoleType in the entity's field manager.

Parameters
[in]roleThe role type (MESH, ATTRIBUTE, TRANSIENT, REDUCTION, etc.)
Returns
All field names of the specified RoleType in the entity's field manager.

◆ field_describe() [3/4]

int Ioss::GroupingEntity::field_describe ( Field::RoleType role,
NameList * names ) const
inline

Get the names of all fields of a specified RoleType in the entity's field manager.

Parameters
[in]roleThe role type (MESH, ATTRIBUTE, TRANSIENT, REDUCTION, etc.)
[out]namesAll field names of the specified RoleType in the entity's field manager.
Returns
The number of fields extracted from the entity's field manager.

◆ field_describe() [4/4]

int Ioss::GroupingEntity::field_describe ( NameList * names) const
inline

Get the names of all fields in the entity's field manager.

Parameters
[out]namesAll field names in the entity's field manager.
Returns
The number of fields extracted from the entity's field manager.

◆ field_erase() [1/2]

void Ioss::GroupingEntity::field_erase ( const std::string & field_name)
inline

Remove a field from the entity's field manager.

Assumes that a field with the given name exists in the field manager.

Parameters
[in]field_nameThe name of the field to remove.

◆ field_erase() [2/2]

void Ioss::GroupingEntity::field_erase ( Field::RoleType role)
inline

Remove all fields of type role from the entity's field manager.

Parameters
[in]roleRemove all fields (if any) of type role

◆ field_exists()

bool Ioss::GroupingEntity::field_exists ( const std::string & field_name) const
inline

Checks if a field with a given name exists in the entity's field manager.

Parameters
[in]field_nameThe name of the field to check for.
Returns
True if the field exists in the entity's field manager.

◆ field_int_type()

IOSS_NODISCARD Ioss::Field::BasicType Ioss::GroupingEntity::field_int_type ( ) const
inline

Get the number of bytes used to store the INT data type

Returns
The number of bytes.

◆ generic_name()

std::string Ioss::GroupingEntity::generic_name ( ) const

Get a generated name based on the type of the entity and the id.

For example, element block 10 would return "block_10" This is the default name if no name is assigned in the mesh database.

Returns
The generic name.

◆ get_database()

Ioss::DatabaseIO * Ioss::GroupingEntity::get_database ( ) const

◆ get_field()

Ioss::Field Ioss::GroupingEntity::get_field ( const std::string & field_name) const
inline

Get a field from the entity's field manager.

Parameters
[in]field_nameThe name of the field to get.
Returns
The field object.

◆ get_field_data() [1/3]

template<typename T >
int64_t Ioss::GroupingEntity::get_field_data ( const std::string & field_name,
std::vector< T > & data ) const

Read type 'T' field data from the database file into memory using a std::vector.

Parameters
[in]field_nameThe name of the field to read.
[out]dataThe data.
Returns
The number of values read.

◆ get_field_data() [2/3]

int64_t Ioss::GroupingEntity::get_field_data ( const std::string & field_name,
void ** data,
size_t * data_size ) const

Zero-copy API. IF a field is zero-copyable, then this function will set the data pointer to point to a chunk of memory of size data_size bytes containing the field data for the specified field. If the field is not zero-copyable, then the data pointer will point to nullptr and data_size will be 0 and retval will be -2. TODO: Verify that returning -2 on error makes sense or helps at all...

◆ get_field_data() [3/3]

int64_t Ioss::GroupingEntity::get_field_data ( const std::string & field_name,
void * data,
size_t data_size ) const

Read field data from the database file into memory using a pointer.

Parameters
[in]field_nameThe name of the field to read.
[out]dataThe data.
[in]data_sizeThe number of bytes of data to be read.
Returns
The number of values read.

◆ get_fieldref()

const Ioss::Field & Ioss::GroupingEntity::get_fieldref ( const std::string & field_name) const
inline

Get a reference to a field from the entity's field manager.

Parameters
[in]field_nameThe name of the field to get.
Returns
A reference to the field object.

◆ get_filename()

std::string Ioss::GroupingEntity::get_filename ( ) const

Get the file name associated with the database containing this entity.

Returns
The file name.

◆ get_implicit_property()

Ioss::Property Ioss::GroupingEntity::get_implicit_property ( const std::string & my_name) const
protectedpure virtual

Calculate and get an implicit property.

These are calculated from data stored in the EntityBlock instead of having an explicit value assigned. An example would be 'element_block_count' for a region. Note that even though this is a pure virtual function, an implementation is provided to return properties that are common to all 'block'-type grouping entities. Derived classes should call 'GroupingEntity::get_implicit_property' if the requested property is not specific to their type.

Implemented in Ioss::Assembly, Ioss::Blob, Ioss::CommSet, Ioss::EdgeBlock, Ioss::EdgeSet, Ioss::ElementBlock, Ioss::ElementSet, Ioss::FaceBlock, Ioss::FaceSet, Ioss::NodeBlock, Ioss::NodeSet, Ioss::NullEntity, Ioss::Region, Ioss::SideBlock, Ioss::SideSet, Ioss::StructuredBlock, Ioss::EntityBlock, Ioss::EntitySet, Ioex::SuperElement, and Ioexnl::SuperElement.

◆ get_optional_property() [1/2]

int64_t Ioss::GroupingEntity::get_optional_property ( const std::string & property,
int64_t optional_value ) const
inline

◆ get_optional_property() [2/2]

std::string Ioss::GroupingEntity::get_optional_property ( const std::string & property_name,
const std::string & optional_value ) const
inline

◆ get_property()

Ioss::Property Ioss::GroupingEntity::get_property ( const std::string & property_name) const
inline

Get the Property from the property manager associated with the entity.

Parameters
[in]property_nameThe name of the property to get
Returns
The property

◆ get_state()

Ioss::State Ioss::GroupingEntity::get_state ( ) const

Get the current Ioss::State of the entity.

Returns
The current state.

◆ hash()

IOSS_NODISCARD unsigned int Ioss::GroupingEntity::hash ( ) const
inline

◆ internal_get_field_data()

virtual int64_t Ioss::GroupingEntity::internal_get_field_data ( const Field & field,
void * data,
size_t data_size = 0 ) const
protectedpure virtual

◆ internal_get_zc_field_data()

virtual int64_t Ioss::GroupingEntity::internal_get_zc_field_data ( const Field & field,
void ** data,
size_t * data_size ) const
protectedpure virtual

◆ internal_put_field_data()

virtual int64_t Ioss::GroupingEntity::internal_put_field_data ( const Field & field,
void * data,
size_t data_size = 0 ) const
protectedpure virtual

◆ is_alias()

bool Ioss::GroupingEntity::is_alias ( const std::string & my_name) const

Determine whether a name is an alias for this entity.

Parameters
[in]my_nameDetermine whether this name is an alias for this entity.
Returns
True if input name is an alias for this entity.

◆ name()

IOSS_NODISCARD const std::string & Ioss::GroupingEntity::name ( ) const
inline

Get name of entity.

This short-circuits the process of getting the name via the property.

Returns
The same information as: entity->get_property("name").get_string()

◆ operator!=()

bool Ioss::GroupingEntity::operator!= ( const GroupingEntity & rhs) const

◆ operator=()

GroupingEntity & Ioss::GroupingEntity::operator= ( const GroupingEntity & rhs)
delete

◆ operator==()

bool Ioss::GroupingEntity::operator== ( const GroupingEntity & rhs) const

◆ property_add()

void Ioss::GroupingEntity::property_add ( const Property & new_prop)
inline

Add a property to the entity's property manager.

Parameters
[in]new_propThe property to add.

◆ property_count()

size_t Ioss::GroupingEntity::property_count ( ) const
inline

Get the number of properties defined in the property manager for this entity.

Returns
The number of properties.

◆ property_describe() [1/4]

Ioss::NameList Ioss::GroupingEntity::property_describe ( ) const
inline

Get the names of all properties in the property manager for this entity.

Returns
The property names in the property manager.

◆ property_describe() [2/4]

Ioss::NameList Ioss::GroupingEntity::property_describe ( Ioss::Property::Origin origin) const
inline

◆ property_describe() [3/4]

int Ioss::GroupingEntity::property_describe ( Ioss::Property::Origin origin,
NameList * names ) const
inline

◆ property_describe() [4/4]

int Ioss::GroupingEntity::property_describe ( NameList * names) const
inline

Get the names of all properties in the property manager for this entity.

Parameters
[out]namesAll the property names in the property manager.
Returns
The number of properties extracted from the property manager.

◆ property_erase()

void Ioss::GroupingEntity::property_erase ( const std::string & property_name)
inline

Remove a property from the entity's property manager.

Assumes that the property with the given name already exists in the property manager.

Parameters
[in]property_nameThe name of the property to remove.

◆ property_exists()

bool Ioss::GroupingEntity::property_exists ( const std::string & property_name) const
inline

Checks if a property exists in the entity's property manager.

Parameters
[in]property_nameThe property to check
Returns
True if the property exists.

◆ property_update() [1/2]

void Ioss::GroupingEntity::property_update ( const std::string & property,
const std::string & value ) const

◆ property_update() [2/2]

void Ioss::GroupingEntity::property_update ( const std::string & property,
int64_t value ) const

Add a property, or change its value if it already exists with a different value

◆ put_field_data() [1/3]

template<typename T >
int64_t Ioss::GroupingEntity::put_field_data ( const std::string & field_name,
const std::vector< T > & data ) const

Write type 'T' field data from memory into the database file using a std::vector.

Parameters
[in]field_nameThe name of the field to write.
[in]dataThe data.
Returns
The number of values written.

◆ put_field_data() [2/3]

template<typename T >
int64_t Ioss::GroupingEntity::put_field_data ( const std::string & field_name,
std::vector< T > & data ) const

◆ put_field_data() [3/3]

int64_t Ioss::GroupingEntity::put_field_data ( const std::string & field_name,
void * data,
size_t data_size ) const

Write field data from memory into the database file using a pointer.

Parameters
[in]field_nameThe name of the field to write.
[in]dataThe data.
[in]data_sizeThe number of bytes of data to be written.
Returns
The number of values written.

◆ really_delete_database()

void Ioss::GroupingEntity::really_delete_database ( )
protected

◆ reset_database()

void Ioss::GroupingEntity::reset_database ( Ioss::DatabaseIO * io_database)

◆ set_database()

void Ioss::GroupingEntity::set_database ( Ioss::DatabaseIO * io_database)

◆ set_name()

void Ioss::GroupingEntity::set_name ( const std::string & new_name)
inline

Set the name of the entity.

Parameters
[in]new_nameThe new name of the entity.

◆ set_state()

bool Ioss::GroupingEntity::set_state ( State new_state)
inlineprotected

◆ short_type_string()

virtual IOSS_NODISCARD std::string Ioss::GroupingEntity::short_type_string ( ) const
pure virtual

◆ type()

virtual IOSS_NODISCARD EntityType Ioss::GroupingEntity::type ( ) const
pure virtual

◆ type_string()

virtual IOSS_NODISCARD std::string Ioss::GroupingEntity::type_string ( ) const
pure virtual

◆ verify_field_exists()

void Ioss::GroupingEntity::verify_field_exists ( const std::string & field_name,
const std::string & inout ) const
private

Friends And Related Symbol Documentation

◆ Property

friend class Property
friend

Member Data Documentation

◆ attributeCount

int64_t Ioss::GroupingEntity::attributeCount = 0
mutableprivate

◆ database_

DatabaseIO* Ioss::GroupingEntity::database_ = nullptr
private

◆ entityCount

int64_t Ioss::GroupingEntity::entityCount = 0
protected

◆ entityName

std::string Ioss::GroupingEntity::entityName {}
private

◆ entityState

State Ioss::GroupingEntity::entityState = STATE_CLOSED
private

◆ fields

FieldManager Ioss::GroupingEntity::fields
protected

◆ hash_

unsigned int Ioss::GroupingEntity::hash_ = 0
private

◆ properties

PropertyManager Ioss::GroupingEntity::properties
protected

The documentation for this class was generated from the following files: