Entity & declare_element_edge( BulkData & mesh , const stk_classic::mesh::EntityId global_edge_id , Entity & elem , const unsigned local_edge_id , Part * part ) { verify_declare_element_edge(mesh, elem, local_edge_id); const CellTopologyData * const elem_top = get_cell_topology( elem ).getCellTopologyData(); ThrowErrorMsgIf( elem_top == NULL, "Element[" << elem.identifier() << "] has no defined topology"); const CellTopologyData * const edge_top = elem_top->edge[ local_edge_id ].topology; ThrowErrorMsgIf( edge_top == NULL, "Element[" << elem.identifier() << "], local_edge_id = " << local_edge_id << ", edge has no defined topology" ); PartVector empty_parts ; Entity & edge = mesh.declare_entity( edge_top->dimension , global_edge_id, empty_parts ); return declare_element_edge( elem, edge, local_edge_id, part); }
Entity declare_element_edge( BulkData & mesh, const stk::mesh::EntityId global_edge_id, Entity elem, const unsigned local_edge_id, const stk::mesh::PartVector &parts) { verify_declare_element_edge(mesh, elem, local_edge_id); stk::topology elem_top = mesh.bucket(elem).topology(); stk::topology edge_top = elem_top.edge_topology(); PartVector empty_parts; Entity edge = mesh.get_entity(edge_top.rank(), global_edge_id); if(!mesh.is_valid(edge)) { edge = mesh.declare_entity(edge_top.rank(), global_edge_id, empty_parts); // It seem like declare_element_edge should be called even if the edge is valid to make sure it is attached to the element. declare_element_edge(mesh, elem, edge, local_edge_id, parts); } return edge; }