本文整理汇总了C++中stk::mesh::BulkData::modification_begin方法的典型用法代码示例。如果您正苦于以下问题:C++ BulkData::modification_begin方法的具体用法?C++ BulkData::modification_begin怎么用?C++ BulkData::modification_begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stk::mesh::BulkData
的用法示例。
在下文中一共展示了BulkData::modification_begin方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupKeyholeMesh2D_case2
inline
void setupKeyholeMesh2D_case2(stk::mesh::BulkData& bulk)
{
//
// proc 0 proc 1
// |
// | block_2 block_3
// |
// block_1 | 12---11
// | | 4 |
// 4----3 | 3----6 6----10
// | 1 | | | 2 |
// 1----2 | 2----5 5----9
// | | 3 |
// | 7----8
// |
//
//nodes 5 and 6 are ghosts (aura) on proc 0,
//and should be members of block_2 and block_3 on proc 0
//if edges are added, the edge between nodes 5 and 6 should
//be a member of block_2 not block_3.
//
stk::mesh::MetaData& meta = bulk.mesh_meta_data();
stk::mesh::Part& block_1 = meta.declare_part_with_topology("block_1", stk::topology::QUAD_4_2D);
stk::mesh::Part& block_2 = meta.declare_part_with_topology("block_2", stk::topology::QUAD_4_2D);
stk::mesh::Part& block_3 = meta.declare_part_with_topology("block_3", stk::topology::QUAD_4_2D);
meta.commit();
bulk.modification_begin();
stk::mesh::EntityIdVector elem1_nodes {1, 2, 3, 4};
stk::mesh::EntityIdVector elem2_nodes {2, 5, 6, 3};
stk::mesh::EntityIdVector elem3_nodes {7, 8, 9, 5};
stk::mesh::EntityIdVector elem4_nodes {6, 10, 11, 12};
stk::mesh::EntityId elemId = 1;
if (bulk.parallel_rank() == 0) {
stk::mesh::declare_element(bulk, block_1, elemId, elem1_nodes);
stk::mesh::Entity node2 = bulk.get_entity(stk::topology::NODE_RANK, 2);
stk::mesh::Entity node3 = bulk.get_entity(stk::topology::NODE_RANK, 3);
bulk.add_node_sharing(node2, 1);
bulk.add_node_sharing(node3, 1);
}
else if (bulk.parallel_rank() == 1) {
elemId = 2;
stk::mesh::declare_element(bulk, block_2, elemId, elem2_nodes);
elemId = 3;
stk::mesh::declare_element(bulk, block_3, elemId, elem3_nodes);
elemId = 4;
stk::mesh::declare_element(bulk, block_3, elemId, elem4_nodes);
stk::mesh::Entity node2 = bulk.get_entity(stk::topology::NODE_RANK, 2);
stk::mesh::Entity node3 = bulk.get_entity(stk::topology::NODE_RANK, 3);
bulk.add_node_sharing(node2, 0);
bulk.add_node_sharing(node3, 0);
}
bulk.modification_end();
}
示例2: heterogeneous_mesh_bulk_data
void heterogeneous_mesh_bulk_data(
stk::mesh::BulkData & bulk_data ,
const VectorFieldType & node_coord )
{
static const char method[] =
"stk_mesh::fixtures::heterogenous_mesh_bulk_data" ;
bulk_data.modification_begin();
const stk::mesh::MetaData & meta_data = stk::mesh::MetaData::get(bulk_data);
stk::mesh::Part & hex_block = * meta_data.get_part("hexes",method);
stk::mesh::Part & wedge_block = * meta_data.get_part("wedges",method);
stk::mesh::Part & tetra_block = * meta_data.get_part("tets",method);
stk::mesh::Part & pyramid_block = * meta_data.get_part("pyramids",method);
stk::mesh::Part & quad_shell_block = * meta_data.get_part("quad_shells",method);
stk::mesh::Part & tri_shell_block = * meta_data.get_part("tri_shells",method);
unsigned elem_id = 1 ;
for ( unsigned i = 0 ; i < number_hex ; ++i , ++elem_id ) {
stk::mesh::declare_element( bulk_data, hex_block, elem_id, hex_node_ids[i] );
}
for ( unsigned i = 0 ; i < number_wedge ; ++i , ++elem_id ) {
stk::mesh::declare_element( bulk_data, wedge_block, elem_id, wedge_node_ids[i] );
}
for ( unsigned i = 0 ; i < number_tetra ; ++i , ++elem_id ) {
stk::mesh::declare_element( bulk_data, tetra_block, elem_id, tetra_node_ids[i] );
}
for ( unsigned i = 0 ; i < number_pyramid ; ++i , ++elem_id ) {
stk::mesh::declare_element( bulk_data, pyramid_block, elem_id, pyramid_node_ids[i] );
}
for ( unsigned i = 0 ; i < number_shell_quad ; ++i , ++elem_id ) {
stk::mesh::declare_element( bulk_data, quad_shell_block, elem_id, shell_quad_node_ids[i]);
}
for ( unsigned i = 0 ; i < number_shell_tri ; ++i , ++elem_id ) {
stk::mesh::declare_element( bulk_data, tri_shell_block, elem_id, shell_tri_node_ids[i] );
}
for ( unsigned i = 0 ; i < node_count ; ++i ) {
stk::mesh::Entity const node = bulk_data.get_entity( stk::topology::NODE_RANK , i + 1 );
double * const coord = stk::mesh::field_data( node_coord , node );
coord[0] = node_coord_data[i][0] ;
coord[1] = node_coord_data[i][1] ;
coord[2] = node_coord_data[i][2] ;
}
bulk_data.modification_end();
}
示例3: deactivate_elements
inline void deactivate_elements(const stk::mesh::EntityVector &deactivated_elems, stk::mesh::BulkData &bulkData, stk::mesh::Part& active)
{
bulkData.modification_begin();
for(size_t i = 0; i < deactivated_elems.size(); ++i)
{
bulkData.change_entity_parts(deactivated_elems[i], stk::mesh::PartVector(), stk::mesh::PartVector(1, &active));
}
bulkData.modification_end();
}
示例4: setupKeyholeMesh3D_case2
inline
void setupKeyholeMesh3D_case2(stk::mesh::BulkData& bulk)
{
ThrowRequire(bulk.parallel_size() == 3);
stk::io::fill_mesh("generated:3x1x3", bulk);
stk::mesh::EntityProcVec elementProcChanges;
if (bulk.parallel_rank() == 1) {
elementProcChanges.push_back(stk::mesh::EntityProc(bulk.get_entity(stk::topology::ELEM_RANK,4),2));
elementProcChanges.push_back(stk::mesh::EntityProc(bulk.get_entity(stk::topology::ELEM_RANK,6),2));
}
bulk.change_entity_owner(elementProcChanges);
bulk.modification_begin();
if (bulk.parallel_rank() == 1) {
stk::mesh::Entity local_element5 = bulk.get_entity(stk::topology::ELEM_RANK,5);
const bool delete_success = bulk.destroy_entity(local_element5);
ThrowRequire(delete_success);
}
bulk.modification_end();
}
示例5: use_case_5_generate_mesh
void use_case_5_generate_mesh(
const std::string& mesh_options ,
stk::mesh::BulkData & mesh ,
const VectorFieldType & node_coord ,
stk::mesh::Part & hex_block ,
stk::mesh::Part & quad_shell_block )
{
mesh.modification_begin();
const unsigned parallel_size = mesh.parallel_size();
const unsigned parallel_rank = mesh.parallel_rank();
double t = 0 ;
size_t num_hex = 0 ;
size_t num_shell = 0 ;
size_t num_nodes = 0 ;
size_t num_block = 0 ;
int error_flag = 0 ;
try {
Iogn::GeneratedMesh gmesh( mesh_options, parallel_size, parallel_rank );
num_nodes = gmesh.node_count_proc();
num_block = gmesh.block_count();
t = stk::wall_time();
std::vector<int> node_map( num_nodes , 0 );
gmesh.node_map( node_map );
{
for ( size_t i = 1 ; i <= num_block ; ++i ) {
const size_t num_elem = gmesh.element_count_proc(i);
const std::pair<std::string,int> top_info = gmesh.topology_type(i);
std::vector<int> elem_map( num_elem , 0 );
std::vector<int> elem_conn( num_elem * top_info.second );
gmesh.element_map( i, elem_map );
gmesh.connectivity( i , elem_conn );
if ( top_info.second == 8 ) {
for ( size_t j = 0 ; j < num_elem ; ++j ) {
const int * const local_node_id = & elem_conn[ j * 8 ] ;
const stk::mesh::EntityId node_id[8] = {
local_node_id[0] ,
local_node_id[1] ,
local_node_id[2] ,
local_node_id[3] ,
local_node_id[4] ,
local_node_id[5] ,
local_node_id[6] ,
local_node_id[7]
};
const stk::mesh::EntityId elem_id = elem_map[ j ];
stk::mesh::fem::declare_element( mesh , hex_block , elem_id , node_id );
++num_hex ;
}
}
else if ( top_info.second == 4 ) {
for ( size_t j = 0 ; j < num_elem ; ++j ) {
const int * const local_node_id = & elem_conn[ j * 4 ] ;
const stk::mesh::EntityId node_id[4] = {
local_node_id[0] ,
local_node_id[1] ,
local_node_id[2] ,
local_node_id[3]
};
const stk::mesh::EntityId elem_id = elem_map[ j ];
stk::mesh::fem::declare_element( mesh , quad_shell_block , elem_id , node_id );
++num_shell ;
}
}
}
}
std::vector<double> node_coordinates( 3 * node_map.size() );
gmesh.coordinates( node_coordinates );
if ( 3 * node_map.size() != node_coordinates.size() ) {
std::ostringstream msg ;
msg << " P" << mesh.parallel_rank()
<< ": ERROR, node_map.size() = "
<< node_map.size()
//.........这里部分代码省略.........
示例6: mesh
void Gear::mesh( stk::mesh::BulkData & M )
{
stk::mesh::EntityRank element_rank = stk::topology::ELEMENT_RANK;
stk::mesh::EntityRank side_rank = m_mesh_meta_data.side_rank();
M.modification_begin();
m_mesh = & M ;
const unsigned p_size = M.parallel_size();
const unsigned p_rank = M.parallel_rank();
std::vector<size_t> counts ;
stk::mesh::comm_mesh_counts(M, counts);
// max_id is no longer available from comm_mesh_stats.
// If we assume uniform numbering from 1.., then max_id
// should be equal to counts...
const stk::mesh::EntityId node_id_base = counts[ stk::topology::NODE_RANK ] + 1 ;
const stk::mesh::EntityId elem_id_base = counts[ element_rank ] + 1 ;
const unsigned long elem_id_gear_max =
m_angle_num * ( m_rad_num - 1 ) * ( m_z_num - 1 );
std::vector<stk::mesh::Part*> elem_parts ;
std::vector<stk::mesh::Part*> face_parts ;
std::vector<stk::mesh::Part*> node_parts ;
{
stk::mesh::Part * const p_gear = & m_gear ;
stk::mesh::Part * const p_surf = & m_surf ;
elem_parts.push_back( p_gear );
face_parts.push_back( p_surf );
}
for ( unsigned ia = 0 ; ia < m_angle_num ; ++ia ) {
for ( unsigned ir = 0 ; ir < m_rad_num - 1 ; ++ir ) {
for ( unsigned iz = 0 ; iz < m_z_num - 1 ; ++iz ) {
stk::mesh::EntityId elem_id_gear = identifier( m_z_num-1 , m_rad_num-1 , iz , ir , ia );
if ( ( ( elem_id_gear * p_size ) / elem_id_gear_max ) == p_rank ) {
stk::mesh::EntityId elem_id = elem_id_base + elem_id_gear ;
// Create the node and set the model_coordinates
const size_t ia_1 = ( ia + 1 ) % m_angle_num ;
const size_t ir_1 = ir + 1 ;
const size_t iz_1 = iz + 1 ;
stk::mesh::Entity node[8] ;
node[0] = create_node( node_parts, node_id_base, iz , ir , ia_1 );
node[1] = create_node( node_parts, node_id_base, iz_1, ir , ia_1 );
node[2] = create_node( node_parts, node_id_base, iz_1, ir , ia );
node[3] = create_node( node_parts, node_id_base, iz , ir , ia );
node[4] = create_node( node_parts, node_id_base, iz , ir_1, ia_1 );
node[5] = create_node( node_parts, node_id_base, iz_1, ir_1, ia_1 );
node[6] = create_node( node_parts, node_id_base, iz_1, ir_1, ia );
node[7] = create_node( node_parts, node_id_base, iz , ir_1, ia );
#if 0 /* VERIFY_CENTROID */
// Centroid of the element for verification
const double TWO_PI = 2.0 * acos( -1.0 );
const double angle = m_ang_inc * (0.5 + ia);
const double z = m_center[2] + m_z_min + m_z_inc * (0.5 + iz);
double c[3] = { 0 , 0 , 0 };
for ( size_t j = 0 ; j < 8 ; ++j ) {
double * const coord_data = field_data( m_model_coord , *node[j] );
c[0] += coord_data[0] ;
c[1] += coord_data[1] ;
c[2] += coord_data[2] ;
}
c[0] /= 8 ; c[1] /= 8 ; c[2] /= 8 ;
c[0] -= m_center[0] ;
c[1] -= m_center[1] ;
double val_a = atan2( c[1] , c[0] );
if ( val_a < 0 ) { val_a += TWO_PI ; }
const double err_a = angle - val_a ;
const double err_z = z - c[2] ;
const double eps = 100 * std::numeric_limits<double>::epsilon();
if ( err_z < - eps || eps < err_z ||
err_a < - eps || eps < err_a ) {
std::string msg ;
msg.append("problem setup element centroid error" );
throw std::logic_error( msg );
}
#endif
stk::mesh::Entity elem =
M.declare_entity( element_rank, elem_id, elem_parts );
//.........这里部分代码省略.........
示例7: verify_unbuildable_element
void verify_unbuildable_element(stk::mesh::BulkData &bulk,
const stk::topology topo,
const stk::mesh::EntityIdVector & elem_node_ids,
const stk::mesh::EntityIdVector & side_ids,
const std::vector < std::vector < unsigned > > &gold_side_node_ids,
bool *sides_connectibility_check,
const stk::mesh::EntityIdVector & edge_ids,
const std::vector < std::vector < unsigned > > &gold_edge_node_ids,
bool *edges_connectibility_check)
{
stk::mesh::EntityId element_id[1] = {1};
stk::mesh::MetaData &meta = bulk.mesh_meta_data();
stk::mesh::Part &elem_part = meta.declare_part_with_topology("elem_part", topo);
meta.commit();
bulk.modification_begin();
stk::mesh::Entity elem = stk::mesh::declare_element(bulk, elem_part, element_id[0], elem_node_ids);
stk::mesh::EntityVector side_nodes;
uint num_sides = topo.num_sides();
stk::topology::rank_t sub_topo_rank = topo.side_rank();
for(uint i = 0; i < num_sides; ++i)
{
stk::topology sub_topo = topo.side_topology(i);
side_nodes.clear();
stk::mesh::Entity side = bulk.declare_entity(sub_topo_rank, side_ids[i], meta.get_topology_root_part(sub_topo));
for (uint j = 0; j < sub_topo.num_nodes(); ++j)
{
stk::mesh::Entity side_node = bulk.get_entity(stk::topology::NODE_RANK, gold_side_node_ids[i][j]);
side_nodes.push_back(side_node);
bulk.declare_relation(side, side_node, j);
}
std::pair<stk::mesh::ConnectivityOrdinal, stk::mesh::Permutation> ordinalAndPermutation
= stk::mesh::get_ordinal_and_permutation(bulk, elem, sub_topo_rank, side_nodes);
if (sides_connectibility_check[i])
{
EXPECT_NE(ordinalAndPermutation.first, stk::mesh::ConnectivityOrdinal::INVALID_CONNECTIVITY_ORDINAL);
EXPECT_NE(ordinalAndPermutation.second, stk::mesh::Permutation::INVALID_PERMUTATION);
}
else
{
EXPECT_EQ(ordinalAndPermutation.first, stk::mesh::ConnectivityOrdinal::INVALID_CONNECTIVITY_ORDINAL);
EXPECT_EQ(ordinalAndPermutation.second, stk::mesh::Permutation::INVALID_PERMUTATION);
}
}
if (edge_ids.empty()) {
bulk.modification_end();
return;
}
stk::mesh::EntityVector edge_nodes;
uint num_edges = topo.num_edges();
for(uint i = 0; i < num_edges; ++i)
{
edge_nodes.clear();
stk::mesh::Entity edge = bulk.declare_entity(stk::topology::EDGE_RANK, edge_ids[i],
meta.get_topology_root_part(topo.edge_topology()));
for (uint j = 0; j < topo.edge_topology().num_nodes(); ++j)
{
stk::mesh::Entity edge_node = bulk.get_entity(stk::topology::NODE_RANK, gold_edge_node_ids[i][j]);
edge_nodes.push_back(edge_node);
bulk.declare_relation(edge, edge_node, j);
}
std::pair<stk::mesh::ConnectivityOrdinal, stk::mesh::Permutation> ordinalAndPermutation
= stk::mesh::get_ordinal_and_permutation(bulk, elem, stk::topology::EDGE_RANK, edge_nodes);
if (edges_connectibility_check[i])
{
EXPECT_NE(ordinalAndPermutation.first, stk::mesh::ConnectivityOrdinal::INVALID_CONNECTIVITY_ORDINAL);
EXPECT_NE(ordinalAndPermutation.second, stk::mesh::Permutation::INVALID_PERMUTATION);
}
else
{
EXPECT_EQ(ordinalAndPermutation.first, stk::mesh::ConnectivityOrdinal::INVALID_CONNECTIVITY_ORDINAL);
EXPECT_EQ(ordinalAndPermutation.second, stk::mesh::Permutation::INVALID_PERMUTATION);
}
}
bulk.modification_end();
}
示例8: build_element_from_topology_verify_ordinals_and_permutations
void build_element_from_topology_verify_ordinals_and_permutations(stk::mesh::BulkData &bulk,
const stk::topology topo,
const stk::mesh::EntityIdVector & elem_node_ids,
const stk::mesh::EntityIdVector & edge_ids,
const std::vector < std::vector < unsigned > > &gold_side_node_ids,
const unsigned * gold_side_permutations,
const std::vector < std::vector < unsigned > > &gold_edge_node_ids,
const unsigned * gold_edge_permutations)
{
stk::mesh::EntityId element_id[1] = {1};
stk::mesh::MetaData &meta = bulk.mesh_meta_data();
stk::mesh::Part &elem_part = meta.declare_part_with_topology("elem_part", topo);
meta.commit();
bulk.modification_begin();
stk::mesh::Entity elem = stk::mesh::declare_element(bulk, elem_part, element_id[0], elem_node_ids);
stk::mesh::EntityVector side_nodes;
uint num_sides = topo.num_sides();
stk::topology::rank_t sub_topo_rank = topo.side_rank();
for(uint i = 0; i < num_sides; ++i)
{
stk::topology sub_topo = topo.side_topology(i);
bulk.declare_element_side(elem, i, {&meta.get_topology_root_part(sub_topo)});
side_nodes.clear();
for (uint j = 0; j < sub_topo.num_nodes(); ++j)
{
stk::mesh::Entity side_node = bulk.get_entity(stk::topology::NODE_RANK, gold_side_node_ids[i][j]);
side_nodes.push_back(side_node);
}
stk::mesh::OrdinalAndPermutation ordinalAndPermutation = stk::mesh::get_ordinal_and_permutation(bulk, elem, sub_topo_rank, side_nodes);
EXPECT_EQ(ordinalAndPermutation.second, gold_side_permutations[i]) << topo;
EXPECT_EQ(ordinalAndPermutation.first, i) << topo;
}
if (edge_ids.empty()) {
bulk.modification_end();
return;
}
stk::mesh::EntityVector edge_nodes;
uint num_edges = topo.num_edges();
for(uint i = 0; i < num_edges; ++i)
{
edge_nodes.clear();
stk::mesh::Entity edge = bulk.declare_entity(stk::topology::EDGE_RANK, edge_ids[i],
meta.get_topology_root_part(topo.edge_topology()));
for (uint j = 0; j < topo.edge_topology().num_nodes(); ++j)
{
stk::mesh::Entity edge_node = bulk.get_entity(stk::topology::NODE_RANK, gold_edge_node_ids[i][j]);
edge_nodes.push_back(edge_node);
bulk.declare_relation(edge, edge_node, j);
}
std::pair<stk::mesh::ConnectivityOrdinal, stk::mesh::Permutation> ordinalAndPermutation
= stk::mesh::get_ordinal_and_permutation(bulk, elem, stk::topology::EDGE_RANK, edge_nodes);
EXPECT_EQ(ordinalAndPermutation.second, gold_edge_permutations[i]) << topo;
EXPECT_EQ(ordinalAndPermutation.first, i) << topo;
}
bulk.modification_end();
}
示例9: setup2Block2HexMesh
inline
void setup2Block2HexMesh(stk::mesh::BulkData& bulk)
{
//
// proc 0 proc 1
// |
// block_1 | block_2
// |
// 8----7 | 7----12
// / /| | / / |
// 5----6 3 | 6----11 10
// | 1 |/ | | 2 | /
// 1----2 | 2----9
// |
// |
// |
//
//shared nodes 2, 3, 6, 7
//
if (bulk.parallel_size() > 2) {
return;
}
stk::mesh::MetaData& meta = bulk.mesh_meta_data();
stk::topology hex = stk::topology::HEX_8;
stk::mesh::Part& block_1 = meta.declare_part_with_topology("block_1", hex);
stk::mesh::Part& block_2 = meta.declare_part_with_topology("block_2", hex);
meta.commit();
bulk.modification_begin();
stk::mesh::EntityIdVector elem1_nodes {1, 2, 3, 4, 5, 6, 7, 8};
stk::mesh::EntityIdVector elem2_nodes {2, 9, 10, 3, 6, 11, 12, 7};
stk::mesh::EntityId elemId = 1;
if (bulk.parallel_rank() == 0) {
stk::mesh::declare_element(bulk, block_1, elemId, elem1_nodes);
}
if (bulk.parallel_rank() == 1 || bulk.parallel_size() == 1) {
elemId = 2;
stk::mesh::declare_element(bulk, block_2, elemId, elem2_nodes);
}
if(bulk.parallel_rank() == 0 && bulk.parallel_size() == 2)
{
bulk.add_node_sharing(bulk.get_entity(stk::topology::NODE_RANK , 2), 1);
bulk.add_node_sharing(bulk.get_entity(stk::topology::NODE_RANK , 3), 1);
bulk.add_node_sharing(bulk.get_entity(stk::topology::NODE_RANK , 6), 1);
bulk.add_node_sharing(bulk.get_entity(stk::topology::NODE_RANK , 7), 1);
}
if(bulk.parallel_rank() == 1 && bulk.parallel_size() == 2)
{
bulk.add_node_sharing(bulk.get_entity(stk::topology::NODE_RANK , 2), 0);
bulk.add_node_sharing(bulk.get_entity(stk::topology::NODE_RANK , 3), 0);
bulk.add_node_sharing(bulk.get_entity(stk::topology::NODE_RANK , 6), 0);
bulk.add_node_sharing(bulk.get_entity(stk::topology::NODE_RANK , 7), 0);
}
bulk.modification_end();
}
示例10: make_small_hybrid_mesh
void make_small_hybrid_mesh(stk::mesh::MetaData &meta, stk::mesh::BulkData &mesh,
bool user_attempt_no_induce = false, bool user_parts_force_no_induce = true)
{
stk::ParallelMachine pm = MPI_COMM_WORLD;
int p_size = stk::parallel_machine_size(pm);
if(p_size > 2)
{
return;
}
const unsigned p_rank = mesh.parallel_rank();
stk::mesh::Part * hexPart = &meta.get_topology_root_part(stk::topology::HEX_8);
stk::mesh::Part * pyrPart = &meta.get_topology_root_part(stk::topology::PYRAMID_5);
stk::mesh::Part * tetPart = &meta.get_topology_root_part(stk::topology::TET_4);
if (user_attempt_no_induce)
{
hexPart = &meta.declare_part_with_topology("my_hex_part",stk::topology::HEX_8, user_parts_force_no_induce);
pyrPart = &meta.declare_part_with_topology("my_pyr_part",stk::topology::PYRAMID_5, user_parts_force_no_induce);
tetPart = &meta.declare_part_with_topology("my_tet_part",stk::topology::TET_4, user_parts_force_no_induce);
EXPECT_EQ(user_parts_force_no_induce, hexPart->force_no_induce());
EXPECT_EQ(user_parts_force_no_induce, pyrPart->force_no_induce());
EXPECT_EQ(user_parts_force_no_induce, tetPart->force_no_induce());
}
meta.commit();
const size_t numHex = 1;
stk::mesh::EntityIdVector hexNodeIDs[] {
{ 1, 2, 3, 4, 5, 6, 7, 8 }
};
stk::mesh::EntityId hexElemIDs[] = { 1 };
const size_t numPyr = 1;
stk::mesh::EntityIdVector pyrNodeIDs[] {
{ 5, 6, 7, 8, 9 }
};
stk::mesh::EntityId pyrElemIDs[] = { 2 };
const size_t numTet = 4;
stk::mesh::EntityIdVector tetNodeIDs[] {
{ 7, 8, 9, 12 },
{ 6, 9, 10, 7 },
{ 7, 9, 10, 12 },
{ 7, 12, 10, 11 }
};
stk::mesh::EntityId tetElemIDs[] = { 3, 4, 5, 6 };
// list of triplets: (owner-proc, shared-nodeID, sharing-proc)
std::vector< std::vector<unsigned> > shared_nodeIDs_and_procs
{
{ 0, 5, 1 }, // proc 0
{ 0, 6, 1 },
{ 0, 7, 1 },
{ 0, 8, 1 },
{ 1, 5, 0 }, // proc 1
{ 1, 6, 0 },
{ 1, 7, 0 },
{ 1, 8, 0 }
};
mesh.modification_begin();
if (0 == p_rank) {
for (size_t i = 0; i < numHex; ++i) {
stk::mesh::declare_element(mesh, *hexPart, hexElemIDs[i], hexNodeIDs[i]);
}
}
if ( (1 == p_rank) || (1 == p_size) ) { // setup the pyramids/tets for either np 2 or serial
for (size_t i = 0; i < numPyr; ++i) {
stk::mesh::declare_element(mesh, *pyrPart, pyrElemIDs[i], pyrNodeIDs[i]);
}
for (size_t i = 0; i < numTet; ++i) {
stk::mesh::declare_element(mesh, *tetPart, tetElemIDs[i], tetNodeIDs[i]);
}
}
if (p_size > 1)
{
for (size_t nodeIdx = 0, end = shared_nodeIDs_and_procs.size(); nodeIdx < end; ++nodeIdx) {
if (p_rank == shared_nodeIDs_and_procs[nodeIdx][0]) {
stk::mesh::EntityId nodeID = shared_nodeIDs_and_procs[nodeIdx][1];
int sharingProc = shared_nodeIDs_and_procs[nodeIdx][2];
stk::mesh::Entity node = mesh.get_entity(stk::topology::NODE_RANK, nodeID);
mesh.add_node_sharing(node, sharingProc);
}
}
}
mesh.modification_end();
}