Sierra Toolkit Version of the Day
stk::mesh::BulkData Class Reference

Manager for an integrated collection of entities, entity relations, and buckets of field data. More...

#include <BulkData.hpp>

List of all members.

Public Types

enum  BulkDataSyncState {
  MODIFIABLE = 1,
  SYNCHRONIZED = 2
}

Public Member Functions

 BulkData (MetaData &mesh_meta_data, ParallelMachine parallel, unsigned bucket_max_size=1000)
 Construct mesh bulk data manager conformal to the given meta data manager and will distribute bulk data over the given parallel machine.
const MetaDatamesh_meta_data () const
 The meta data manager for this bulk data manager.
ParallelMachine parallel () const
 The parallel machine.
unsigned parallel_size () const
 Size of the parallel machine.
unsigned parallel_rank () const
 Rank of the parallel machine's local processor.
unsigned bucket_capacity () const
 Query the upper bound on the number of mesh entities that may be associated with a single bucket.
BulkDataSyncState synchronized_state () const
 Bulk data has two states: guaranteed to be parallel synchronized or modification in progress and may be parallel inconsistent.
size_t synchronized_count () const
 Count of the number of times that the bulk data has been parallel synchronized. This count gets updated with each call to 'modification_end'.
bool modification_begin ()
 Begin a modification phase during which the mesh bulk data could become parallel inconsistent. This is a parallel synchronous call. The first time this method is called the mesh meta data is verified to be committed and parallel consistent. An exception is thrown if this verification fails.
bool modification_end ()
 Parallel synchronization of modifications and transition to the guaranteed parallel consistent state.
void change_entity_owner (const std::vector< EntityProc > &arg_change)
 Give away ownership of entities to other parallel processes.
void update_field_data_states () const
 Rotate the field data of multistate fields.
void copy_entity_fields (const Entity &src, Entity &dest)
 Copy field data from src entity to Dest entity.
const std::vector< Bucket * > & buckets (EntityRank rank) const
 Query all buckets of a given entity rank.
AllBucketsRange get_bucket_range () const
AllBucketsRange get_bucket_range (EntityRank rank) const
Entityget_entity (EntityRank entity_rank, EntityId entity_id) const
 Get entity with a given key.
Entityget_entity (const EntityKey key) const
 Get entity with a given key.
Entitydeclare_entity (EntityRank ent_rank, EntityId ent_id, const PartVector &parts)
 Create or retrieve a locally owned entity of a given rank and id.
void change_entity_parts (Entity &entity, const PartVector &add_parts, const PartVector &remove_parts=PartVector())
 Change the parallel-locally-owned entity's part membership by adding and/or removing parts.
template<typename AddIterator , typename RemoveIterator >
void change_entity_parts (Entity &entity, AddIterator begin_add_parts, AddIterator end_add_parts, RemoveIterator begin_remove_parts, RemoveIterator end_remove_parts)
bool destroy_entity (Entity *&entity)
 Request the destruction an entity on the local process.
void generate_new_entities (const std::vector< size_t > &requests, std::vector< Entity * > &requested_entities)
 Generate a set of entites with globally unique id's.
void declare_relation (Entity &e_from, Entity &e_to, const RelationIdentifier local_id)
 Declare a relation and its converse between entities in the same mesh.
void declare_relation (Entity &entity, const std::vector< Relation > &rel)
 Declare a collection of relations by simply iterating the input and calling declare_relation on each entry.
bool destroy_relation (Entity &e_from, Entity &e_to, const RelationIdentifier local_id)
 Remove all relations between two entities.
const std::vector< Entity * > & entity_comm () const
 All entities with communication information.
Ghostingshared_aura () const
 Query the shared-entity aura. Is likely to be stale if ownership or sharing has changed and the 'modification_end' has not been called.
Ghostingcreate_ghosting (const std::string &name)
 Asymmetric parallel relations for owner-to-ghosted mesh entities.
void change_ghosting (Ghosting &ghosts, const std::vector< EntityProc > &add_send, const std::vector< Entity * > &remove_receive)
 Change the members of a ghosting list on the sending processor.
void destroy_all_ghosting ()
 Empty every single Ghosting. Same result, but more efficient than, calling change_ghosting to remove every single ghosted entity.
const std::vector< Ghosting * > & ghostings () const
 Query all ghostings.

Static Public Member Functions

static BulkDataget (const Bucket &bucket)
static BulkDataget (const Entity &entity)
static BulkDataget (const Ghosting &ghost)

Detailed Description

Manager for an integrated collection of entities, entity relations, and buckets of field data.

Bulk data should be distributed among all processors.

Definition at line 48 of file BulkData.hpp.


Constructor & Destructor Documentation

stk::mesh::BulkData::BulkData ( MetaData mesh_meta_data,
ParallelMachine  parallel,
unsigned  bucket_max_size = 1000 
)

Construct mesh bulk data manager conformal to the given meta data manager and will distribute bulk data over the given parallel machine.

  • The maximum number of entities per bucket may be supplied.
  • The bulk data is in the synchronized or "locked" state.

Definition at line 70 of file BulkData.cpp.


Member Function Documentation

bool stk::mesh::BulkData::modification_begin ( )

Begin a modification phase during which the mesh bulk data could become parallel inconsistent. This is a parallel synchronous call. The first time this method is called the mesh meta data is verified to be committed and parallel consistent. An exception is thrown if this verification fails.

Returns:
True if transitioned out of the guaranteed parallel consistent state to the "ok to modify" state. False if already in this state.

Definition at line 149 of file BulkData.cpp.

bool stk::mesh::BulkData::modification_end ( )

Parallel synchronization of modifications and transition to the guaranteed parallel consistent state.

Parallel synchronization of accumulated local modifications is probably an expensive operation. Operations include:

  • Determining ownership and sharing of created entities.
  • Synchronizing entity membership in parts for shared entities.
  • Refreshing the shared entities ghosting (e.g. aura).
  • Updating ghost entities that have change part membership.
  • Sorting buckets' entities for a well-defined ordering.
Returns:
True if transitioned from the "ok to modify" state. False if already already in this state.
Exceptions:
Ifmodification resolution errors occur then a parallel-consistent exception will be thrown.

Definition at line 727 of file BulkDataEndSync.cpp.

void stk::mesh::BulkData::change_entity_owner ( const std::vector< EntityProc > &  arg_change)

Give away ownership of entities to other parallel processes.

A parallel-synchronous operation while the mesh is in the ok-to-modify state.

Each owning process inputs a list of entities and the new owning process. Upon completion of the call the owning processes have the newly owned entities as well as the closure of those entities (without changing the ownership of the closure entities). If a previous owner no longer needs a changed-owner entity to support the closure of a still-owned entity then the changed-owner entity is deleted from that process. All ghosts of all entities effected by the changed ownerships deleted.

Definition at line 313 of file BulkDataOwner.cpp.

void stk::mesh::BulkData::update_field_data_states ( ) const [inline]

Rotate the field data of multistate fields.

  Rotation of states:
    StateN   <- StateNP1 (StateOld <- StateNew)
    StateNM1 <- StateN   (StateNM1 <- StateOld)
    StateNM2 <- StateNM1
    StateNM3 <- StateNM2
    StateNM3 <- StateNM2
  

Definition at line 162 of file BulkData.hpp.

void stk::mesh::BulkData::copy_entity_fields ( const Entity src,
Entity dest 
) [inline]

Copy field data from src entity to Dest entity.

  • Fields that exist on the src that don't exist on the dest will be ignored
  • Fields that exist on the dest that don't exist on the src will be zeroed

Definition at line 170 of file BulkData.hpp.

Entity & stk::mesh::BulkData::declare_entity ( EntityRank  ent_rank,
EntityId  ent_id,
const PartVector parts 
)

Create or retrieve a locally owned entity of a given rank and id.

A parallel-local operation.

The entity is created as locally owned and a member of the input mesh parts. The entity a member of the meta data's locally owned mesh part and the entity's owner_rank() == parallel_rank().

If two or more processes create an entity of the same rank and identifier then the sharing and ownership of these entities will be resolved by the call to 'modification_end'.

Definition at line 190 of file BulkData.cpp.

void stk::mesh::BulkData::change_entity_parts ( Entity entity,
const PartVector add_parts,
const PartVector remove_parts = PartVector() 
) [inline]

Change the parallel-locally-owned entity's part membership by adding and/or removing parts.

A parallel-local operation.

If the locally owned entity is shared or ghosted then the change will be propogated to the sharing or ghosting processes by modification_end.

Definition at line 235 of file BulkData.hpp.

bool stk::mesh::BulkData::destroy_entity ( Entity *&  entity)

Request the destruction an entity on the local process.

An entity cannot be the 'to' member of a relation. These relations must first be explicitly removed or the 'from' entity be explicitly destroyed.

Destrunction of entities in the 'locally_owned_part' schedules all ghost copies of that entity for destruction during modification_end. If the entity ia shared with another process and that process does not also destroy the entity then ownership of the entity will be transfered to a sharing process during modification_end.

Entities in the 'globally_shared_part' are deleted on the local process and removed from the sharing lists on other processes during modication_end.

Entities not in the 'locally_owned_part' and 'globally_shared_part' are ghosted. These entities are removed from all ghosting lists during 'modification_end'.

Returns:
True if the request for destruction is accepted; i.e., if the entity is not the 'to' member of a relation.

Definition at line 452 of file BulkData.cpp.

void stk::mesh::BulkData::generate_new_entities ( const std::vector< size_t > &  requests,
std::vector< Entity * > &  requested_entities 
)

Generate a set of entites with globally unique id's.

Each processor fills a request vector asking for a number of new entities of the given ranks.

ex. request = { 0, 4, 8} request 0 entites of rank 0, 4 entites of rank 1, and 8 entites of rank 2

Definition at line 527 of file BulkData.cpp.

void stk::mesh::BulkData::declare_relation ( Entity e_from,
Entity e_to,
const RelationIdentifier  local_id 
)

Declare a relation and its converse between entities in the same mesh.

A parallel-local mesh modificaton operation.

This mapping ( e_from , local_id ) -> e_to must be unique.

Relations between entities induces part membership as follows. 1) If 'e_from' is a member of 'part' and part.primary_entity_rank() == e_from.entity_rank() then 'e_to' has induced membership in 'part'. 2) If there exists a part relation 'part_rel' such that 'e_from' is a member of part_rel.m_root and the entity relation conforms to the part relation then 'e_to' has induced membership in part_rel.m_target.

Note that relation-declarations must be symmetric across all sharers of the involved entities within a modification cycle.

Definition at line 129 of file BulkDataRelation.cpp.

bool stk::mesh::BulkData::destroy_relation ( Entity e_from,
Entity e_to,
const RelationIdentifier  local_id 
)

Remove all relations between two entities.

If the relation induced a part membership for 'e_to' and 'e_to' is not shared with another processor then that part membership is removed if and only if there does not exist another relation inducing the same part membership. If 'e_to' is shared then the check for removing the induced relatinship does not occur for that entity until the call to 'modification_end'. The local_id arg is used to differentiate the case when there are multiple relationships between e_from and e_to.

Returns true if we were able to destroy the relation.

Definition at line 191 of file BulkDataRelation.cpp.

Ghosting & stk::mesh::BulkData::create_ghosting ( const std::string &  name)

Asymmetric parallel relations for owner-to-ghosted mesh entities.

  • A collective parallel operation that must have the same name on all processors of this distributed mesh.

Definition at line 38 of file BulkDataGhosting.cpp.

void stk::mesh::BulkData::change_ghosting ( Ghosting ghosts,
const std::vector< EntityProc > &  add_send,
const std::vector< Entity * > &  remove_receive 
)

Change the members of a ghosting list on the sending processor.

  • A collective parallel operation.
  • The ghosting must belong to this mesh.
  • Cannot change the 'shared_aura' in this manner.
  • Add locally owned entities to the input ghosting on the given destination processor. The closure of the input entities will be ghosted.
  • Request removal of ghosted entities on the ghosting processor. This request will only be honored if the ghosted entity is not in the closure of another ghosted entity which will remain in or be added to this ghosting.

To destroy all ghosted entities in a particular ghosting: mesh.change_ghosting( ghosts , std::vector<EntityProc>() , ghosts.receive() );

Definition at line 145 of file BulkDataGhosting.cpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends