9 #ifndef stk_mesh_FEMHelpers_hpp 10 #define stk_mesh_FEMHelpers_hpp 12 #include <stk_mesh/base/Types.hpp> 14 #include <stk_mesh/fem/FEMMetaData.hpp> 15 #include <stk_mesh/fem/CellTopology.hpp> 17 #include <stk_mesh/fem/TopologyDimensions.hpp> 37 const EntityId elem_id ,
38 const EntityId node_id[] );
46 const stk_classic::mesh::EntityId global_side_id ,
48 const unsigned local_side_id ,
56 const stk_classic::mesh::EntityId global_side_id ,
58 const unsigned local_side_id ,
65 const Entity & side ,
int local_side_id = -1 );
73 const unsigned local_side_id ,
84 const unsigned local_edge_id ,
94 return meta_data.
declare_part(name, shards::getCellTopologyData<Top>());
110 EntityRank subcell_rank ,
111 unsigned subcell_identifier ,
112 EntityVector & subcell_nodes
120 const EntityRank subcell_rank,
121 const CellTopologyData * side_topology,
122 const EntityVector & side_nodes );
126 std::vector<size_t> & counts ,
133 template<
class NodeField >
138 NodeField & node_field )
143 fmd.template declare_field< ElementNodePointerField >( s, num_states );
145 for (
unsigned i = 0 ; i < num_states ; ++i ) {
156 template<
class Traits >
159 bool skip_topology_root_parts=
false)
167 stk_classic::mesh::PartVector::const_iterator
168 iter = all_parts.begin(),
169 iter_end = all_parts.end();
171 const CellTopologyData* topology = shards::getCellTopologyData<Traits>();
173 for(; iter!=iter_end; ++iter) {
176 if (skip_topology_root_parts && stk_classic::mesh::fem::is_cell_topology_root_part(*part)) {
179 parts.push_back(part);
185 unsigned get_spatial_dimension(
const Entity& entity)
188 return entity.bucket().mesh().mesh_meta_data().get_spatial_dimension();
197 #ifdef SIERRA_MIGRATION 200 unsigned convert_fmwk_rank_to_stk(
unsigned fmwk_rank,
unsigned spatial_dim)
202 ThrowAssert(spatial_dim > 0);
203 ThrowAssert(spatial_dim < 4);
204 ThrowAssert(fmwk_rank <= 4);
205 static int map2Stk[4][5] = { {-1,-1,-1,-1, 4},
209 int stk_rank = map2Stk[spatial_dim][fmwk_rank];
211 return static_cast<unsigned>(stk_rank);
215 unsigned convert_stk_rank_to_fmwk(
unsigned stk_rank,
unsigned spatial_dim)
217 ThrowAssert(spatial_dim > 0);
218 ThrowAssert(spatial_dim < 4);
219 ThrowAssert(stk_rank <= 4);
220 static int map2Fmwk[4][5]={ {-1,-1,-1,-1, 4},
224 int fmwk_rank=map2Fmwk[spatial_dim][stk_rank];
226 return static_cast<unsigned>(fmwk_rank);
230 unsigned get_derived_type(
const Entity& entity)
232 return convert_stk_rank_to_fmwk(entity.entity_rank(), get_spatial_dimension(entity));
unsigned number_of_states() const
Number of states of this field.
bool comm_mesh_counts(BulkData &M, std::vector< size_t > &counts, bool local_flag)
Global counts for a mesh's entities.
int get_entity_subcell_id(const Entity &entity, const EntityRank subcell_rank, const CellTopologyData *side_topology, const EntityVector &side_nodes)
Given an entity and collection of nodes, return the local id of the subcell that contains those nodes...
Entity & declare_element(BulkData &mesh, Part &part, const EntityId elem_id, const EntityId node_id[])
Declare an element member of a Part with a CellTopology and nodes conformal to that topology...
Field with defined data type and multi-dimensions (if any)
An application-defined subset of a problem domain.
const CellTopologyData * get_subcell_nodes(const Entity &entity, EntityRank subcell_rank, unsigned subcell_identifier, EntityVector &subcell_nodes)
Entity & declare_element_edge(Entity &elem, Entity &edge, const unsigned local_edge_id, Part *part)
Create (or find) an element edge.
Manager for an integrated collection of entities, entity relations, and buckets of field data...
A fundamental unit within the discretization of a problem domain, including but not limited to nodes...
Part & declare_part(FEMMetaData &meta_data, const std::string &name)
Declare a part with a given cell topology. This is just a convenient function that wraps FEMMetaData'...
Field & field_of_state(FieldState input_state) const
Query this field for a given field state.
ElementNodePointerField & declare_element_node_pointer_field(FEMMetaData &fmd, const std::string &s, NodeField &node_field)
Declare an element-to-node-data pointer field.
std::vector< Part *> PartVector
Collections of parts are frequently maintained as a vector of Part pointers.
bool element_side_polarity(const Entity &elem, const Entity &side, int local_side_id)
Determine the polarity of the local side, more efficient if the local_side_id is known.
Entity & declare_element_side(Entity &elem, Entity &side, const unsigned local_side_id, Part *part)
Create (or find) an element side.
FieldState
Enumeration of states for multi-state fields.