This class is used to aid the declaration of entities in a mesh. Use it to build up a parallel synchonous list of nodes and elements that should be declared in the mesh. Once complete, use it to perform the declaration, sharing, and setting of field data automatically.
- Note
- We emphasize that all processes should own exact copies of the same EntityDeclaration. This choice means that EntityDeclaration is not optimally performant but the cost of duplicating entity information is cheap in comparison to the burden of determining parallel ownership and sharing.
-
The create_* methods within this class are not thread safe. To perform parallel construction of entities, use the create_nodes and create_elements methods to create a vector of entities to populate and then populate them in parallel.
Example usage declaring a pearl necklace (a chain of spheres connected by springs):
const int num_edges = 6;
builder.create_node().owning_proc(0).id(
i + 1);
}
for (
int i = 0;
i < num_edges; ++
i) {
auto& spring = builder.create_element();
spring.owning_proc(0).id(
i + 1).topology(stk::topology::BEAM_2).nodes({
i + 1,
i + 2});
}
auto& sphere = builder.create_element();
sphere.owning_proc(0).id(
i + 1 + num_edges).topology(stk::topology::PARTICLE).nodes({
i + 1});
}
Helper class for declaring entities.
Definition DeclareEntities.hpp:96
size_t num_nodes() const
Get the current number of nodes to be declared.
Definition DeclareEntities.hpp:587
EntityDeclaration & declare_entities(stk::mesh::BulkData &bulk_data)
Declare the entities in the mesh. This method will declare the entities in the mesh,...
Definition DeclareEntities.cpp:195
const stk::mesh::FastMeshIndex & i
Definition FieldViews.hpp:312