inline Entity declare_element( BulkData & mesh , Part & part , const EntityId elem_id , const EntityId node_id[] ) { PartVector vec(1, &part); return declare_element(mesh, vec, elem_id, node_id); }
inline Entity declare_element( BulkData & mesh , Part & partWithTopology , const EntityId elem_id , const EntityIdVector & node_ids ) { PartVector vec(1, &partWithTopology); return declare_element(mesh, vec, elem_id, node_ids); }
stk::mesh::Entity MeshBuilder::generate_element(stk::mesh::EntityId elemId, const stk::mesh::EntityIdVector& nodeIds) { stk::mesh::Entity elem = stk::mesh::Entity(); if (elem_id_not_used(elemId)) { elem = declare_element(m_bulkData, *m_elemPart, elemId, nodeIds); share_nodes(nodeIds); } return elem; }
void UseCase_3_Mesh::populate() { // Populate mesh with all node types m_bulkData.modification_begin(); EntityId curr_elem_id = 1; // For each element topology declare elements for ( unsigned i = 0 ; i < number_hex ; ++i , ++curr_elem_id ) { declare_element( m_bulkData, m_block_hex, curr_elem_id, hex_node_ids[i] ); } for ( unsigned i = 0 ; i < number_wedge ; ++i , ++curr_elem_id ) { declare_element( m_bulkData, m_block_wedge, curr_elem_id, wedge_node_ids[i] ); } for ( unsigned i = 0 ; i < number_tetra ; ++i , ++curr_elem_id ) { declare_element( m_bulkData, m_block_tet, curr_elem_id, tetra_node_ids[i] ); } for ( unsigned i = 0 ; i < number_pyramid ; ++i , ++curr_elem_id ) { declare_element( m_bulkData, m_block_pyramid, curr_elem_id, pyramid_node_ids[i] ); } for ( unsigned i = 0 ; i < number_shell_quad ; ++i , ++curr_elem_id ) { declare_element( m_bulkData, m_block_quad_shell, curr_elem_id, shell_quad_node_ids[i]); } for ( unsigned i = 0 ; i < number_shell_tri ; ++i , ++curr_elem_id ) { declare_element( m_bulkData, m_block_tri_shell, curr_elem_id, shell_tri_node_ids[i] ); } // For all nodes assign nodal coordinates for ( unsigned i = 0 ; i < node_count ; ++i ) { Entity const node = m_bulkData.get_entity( m_node_rank , i + 1 ); double * const coord = stk::mesh::field_data( m_coordinates_field , node ); coord[0] = node_coord_data[i][0] ; coord[1] = node_coord_data[i][1] ; coord[2] = node_coord_data[i][2] ; } m_bulkData.modification_end(); // No parallel stuff for now }
void GameofLifeMesh::declare_entities() { for (unsigned index = 0; index < m_elemsOnProc; index++) declare_element(m_bulkData, *m_elemPart, m_elemIds[index], m_elemNodeIds[index]); stk::mesh::get_entities(m_bulkData, stk::topology::NODE_RANK, m_nodes); }