| 1 |
#include "gtest/gtest.h" |
| 2 |
#include "mpi.h" |
| 3 |
#include <stk_mesh/base/BulkData.hpp> |
| 4 |
#include <stk_mesh/base/GetEntities.hpp> |
| 5 |
#include <stk_mesh/baseImpl/elementGraph/ElemElemGraph.hpp> |
| 6 |
#include <stk_mesh/baseImpl/elementGraph/ElemElemGraphImpl.hpp> |
| 7 |
#include <stk_unit_test_utils/MeshFixture.hpp> |
| 8 |
#include "stk_unit_test_utils/TextMesh.hpp" |
| 9 |
#include <stk_mesh/baseImpl/elementGraph/GraphEdgeData.hpp> |
| 10 |
#include <stk_util/parallel/CommSparse.hpp> |
| 11 |
#include <stk_mesh/baseImpl/EquivalentEntityBlocks.hpp> |
| 12 |
#include <stk_mesh/baseImpl/elementGraph/ParallelInfoForGraph.hpp> |
| 13 |
#include <stk_io/IossBridge.hpp> |
| 14 |
|
| 15 |
class ElemElemGraphTester : public stk::mesh::ElemElemGraph |
| 16 |
{ |
| 17 |
public: |
| 18 |
ElemElemGraphTester(stk::mesh::BulkData& bulkData) : |
| 19 |
stk::mesh::ElemElemGraph(bulkData) { } |
| 20 |
|
| 21 |
stk::mesh::impl::ParallelGraphInfo& get_parallel_info() { return m_parallelInfoForGraphEdges.get_parallel_graph_info(); } |
| 22 |
}; |
| 23 |
|
| 24 |
class ParallelGraphUpdate : public stk::unit_test_util::MeshFixture |
| 25 |
{ |
| 26 |
public: |
| 27 |
ParallelGraphUpdate() : stk::unit_test_util::MeshFixture() |
| 28 |
{ |
| 29 |
setup_empty_mesh(stk::mesh::BulkData::NO_AUTO_AURA); |
| 30 |
airPart = &get_meta().declare_part_with_topology("air", stk::topology::HEXAHEDRON_8); |
| 31 |
air = *airPart; |
| 32 |
|
| 33 |
skinPart = &get_meta().declare_part_with_topology("things to skin", stk::topology::HEXAHEDRON_8); |
| 34 |
skinSelector = *skinPart; |
| 35 |
|
| 36 |
make_part_an_element_block_by_setting_id(); |
| 37 |
} |
| 38 |
|
| 39 |
void put_some_elements_into_some_parts() |
| 40 |
{ |
| 41 |
stk::mesh::EntityVector elements = get_half_of_elements(); |
| 42 |
add_part_to_elements(elements,airPart); |
| 43 |
add_part_to_elements(elements,skinPart); |
| 44 |
} |
| 45 |
|
| 46 |
void add_part_to_elements(const stk::mesh::EntityVector &elements, stk::mesh::Part* part) |
| 47 |
{ |
| 48 |
get_bulk().modification_begin(); |
| 49 |
for(stk::mesh::Entity element : elements ) |
| 50 |
get_bulk().change_entity_parts(element, stk::mesh::ConstPartVector{part}); |
| 51 |
get_bulk().modification_end(); |
| 52 |
} |
| 53 |
|
| 54 |
void remove_part_from_elements(const stk::mesh::EntityVector &elements, stk::mesh::Part* part) |
| 55 |
{ |
| 56 |
get_bulk().modification_begin(); |
| 57 |
for(stk::mesh::Entity element : elements ) |
| 58 |
get_bulk().change_entity_parts(element, stk::mesh::ConstPartVector{}, stk::mesh::ConstPartVector{part}); |
| 59 |
get_bulk().modification_end(); |
| 60 |
} |
| 61 |
|
| 62 |
stk::mesh::Selector get_air_selector() const |
| 63 |
{ |
| 64 |
return air; |
| 65 |
} |
| 66 |
|
| 67 |
stk::mesh::Selector get_skin_selector() const |
| 68 |
{ |
| 69 |
return skinSelector; |
| 70 |
} |
| 71 |
|
| 72 |
void move_elements_out_of_parts() |
| 73 |
{ |
| 74 |
remove_part_from_elements(get_half_of_elements(), airPart); |
| 75 |
remove_part_from_elements(get_half_of_elements(), skinPart); |
| 76 |
} |
| 77 |
|
| 78 |
void move_elements_into_parts_and_verify() |
| 79 |
{ |
| 80 |
expect_no_elements_selected(get_air_selector()); |
| 81 |
expect_no_elements_selected(get_skin_selector()); |
| 82 |
put_some_elements_into_some_parts(); |
| 83 |
expect_some_elements_selected(get_air_selector()); |
| 84 |
expect_some_elements_selected(get_skin_selector()); |
| 85 |
} |
| 86 |
|
| 87 |
void verify_selectors_not_in_parallel_graph(const stk::mesh::impl::ParallelGraphInfo& parallel_info) |
| 88 |
{ |
| 89 |
for(const auto& item : parallel_info) |
| 90 |
{ |
| 91 |
stk::mesh::impl::LocalId elemOnOtherProc = item.first.elem2(); |
| 92 |
EXPECT_FALSE(remoteAirSelector[elemOnOtherProc]); |
| 93 |
EXPECT_FALSE(remoteSkinSelector[elemOnOtherProc]); |
| 94 |
} |
| 95 |
} |
| 96 |
|
| 97 |
void verify_part_ordinals_not_in_parallel_graph(const stk::mesh::impl::ParallelPartInfo ¶llelPartInfo) const |
| 98 |
{ |
| 99 |
for(const auto& item : parallelPartInfo) |
| 100 |
{ |
| 101 |
const stk::mesh::impl::PartOrdinals &partOrdinals = item.second.elementPartOrdinals; |
| 102 |
EXPECT_TRUE(!std::binary_search(partOrdinals.begin(), partOrdinals.end(), airPart->mesh_meta_data_ordinal())); |
| 103 |
EXPECT_TRUE(!std::binary_search(partOrdinals.begin(), partOrdinals.end(), skinPart->mesh_meta_data_ordinal())); |
| 104 |
} |
| 105 |
} |
| 106 |
|
| 107 |
void verify_selectors_in_parallel_graph(const stk::mesh::impl::ParallelGraphInfo& parallel_info) |
| 108 |
{ |
| 109 |
for(const auto& item : parallel_info) |
| 110 |
{ |
| 111 |
stk::mesh::impl::LocalId elemOnOtherProc = item.first.elem2(); |
| 112 |
if(elemOnOtherProc %2 == 0) |
| 113 |
{ |
| 114 |
EXPECT_TRUE(remoteAirSelector[elemOnOtherProc]) << " for element " << -elemOnOtherProc; |
| 115 |
EXPECT_TRUE(remoteSkinSelector[elemOnOtherProc]) << " for element " << -elemOnOtherProc; |
| 116 |
} |
| 117 |
else |
| 118 |
{ |
| 119 |
EXPECT_FALSE(remoteAirSelector[elemOnOtherProc]) << " for element " << -elemOnOtherProc; |
| 120 |
EXPECT_FALSE(remoteSkinSelector[elemOnOtherProc]) << " for element " << -elemOnOtherProc; |
| 121 |
} |
| 122 |
} |
| 123 |
} |
| 124 |
|
| 125 |
void verify_part_ordinals_are_in_parallel_graph(const stk::mesh::impl::ParallelPartInfo ¶llelPartInfo) const |
| 126 |
{ |
| 127 |
for(const auto& item : parallelPartInfo) |
| 128 |
{ |
| 129 |
const stk::mesh::impl::LocalId elemOnOtherProc = item.first; |
| 130 |
const stk::mesh::impl::PartOrdinals &partOrdinals = item.second.elementPartOrdinals; |
| 131 |
|
| 132 |
if(elemOnOtherProc%2 == 0) |
| 133 |
{ |
| 134 |
EXPECT_TRUE(std::binary_search(partOrdinals.begin(), partOrdinals.end(), airPart->mesh_meta_data_ordinal())); |
| 135 |
EXPECT_TRUE(std::binary_search(partOrdinals.begin(), partOrdinals.end(), skinPart->mesh_meta_data_ordinal())); |
| 136 |
} |
| 137 |
else |
| 138 |
{ |
| 139 |
EXPECT_TRUE(!std::binary_search(partOrdinals.begin(), partOrdinals.end(), airPart->mesh_meta_data_ordinal())); |
| 140 |
EXPECT_TRUE(!std::binary_search(partOrdinals.begin(), partOrdinals.end(), skinPart->mesh_meta_data_ordinal())); |
| 141 |
} |
| 142 |
} |
| 143 |
} |
| 144 |
|
| 145 |
|
| 146 |
void make_part_an_element_block_by_setting_id() |
| 147 |
{ |
| 148 |
get_meta().set_part_id(*airPart, 100); |
| 149 |
get_meta().set_part_id(*skinPart, 101); |
| 150 |
} |
| 151 |
|
| 152 |
stk::mesh::EntityVector get_half_of_elements() |
| 153 |
{ |
| 154 |
stk::mesh::EntityVector elements; |
| 155 |
stk::mesh::get_selected_entities(get_meta().locally_owned_part(), get_bulk().buckets(stk::topology::ELEM_RANK), elements); |
| 156 |
return get_elements_that_have_even_identifiers(elements); |
| 157 |
} |
| 158 |
|
| 159 |
stk::mesh::EntityVector get_elements_that_have_even_identifiers(const stk::mesh::EntityVector& elements) |
| 160 |
{ |
| 161 |
stk::mesh::EntityVector someElements; |
| 162 |
for(stk::mesh::Entity element : elements) |
| 163 |
if(get_bulk().identifier(element)%2 == 0) |
| 164 |
someElements.push_back(element); |
| 165 |
return someElements; |
| 166 |
} |
| 167 |
|
| 168 |
void expect_no_elements_selected(stk::mesh::Selector selector) |
| 169 |
{ |
| 170 |
size_t num_elements = stk::mesh::count_selected_entities(selector, get_bulk().buckets(stk::topology::ELEM_RANK)); |
| 171 |
EXPECT_EQ(0u, num_elements); |
| 172 |
} |
| 173 |
|
| 174 |
void expect_some_elements_selected(stk::mesh::Selector selector) |
| 175 |
{ |
| 176 |
size_t num_elements= stk::mesh::count_selected_entities(selector, get_bulk().buckets(stk::topology::ELEM_RANK)); |
| 177 |
EXPECT_TRUE(num_elements != 0u); |
| 178 |
} |
| 179 |
|
| 180 |
stk::mesh::Part* airPart = nullptr; |
| 181 |
stk::mesh::Part* skinPart = nullptr; |
| 182 |
stk::mesh::Selector air; |
| 183 |
stk::mesh::Selector skinSelector; |
| 184 |
stk::mesh::impl::ParallelSelectedInfo remoteSkinSelector; |
| 185 |
stk::mesh::impl::ParallelSelectedInfo remoteAirSelector; |
| 186 |
}; |
| 187 |
|
| 188 |
// Need updater for part ordinals |
| 189 |
|
| 190 |
TEST_F(ParallelGraphUpdate, updateAirSelector) |
| 191 |
{ |
| 192 |
if(stk::parallel_machine_size(MPI_COMM_WORLD)==4) |
| 193 |
{ |
| 194 |
stk::io::fill_mesh("generated:4x4x4", get_bulk()); |
| 195 |
ElemElemGraphTester graph(get_bulk()); |
| 196 |
|
| 197 |
stk::mesh::impl::ParallelPartInfo parallelPartInfo; |
| 198 |
stk::mesh::impl::populate_part_ordinals_for_remote_edges(get_bulk(), graph, parallelPartInfo); |
| 199 |
stk::mesh::impl::populate_selected_value_for_remote_elements(get_bulk(), graph, get_skin_selector(), remoteSkinSelector); |
| 200 |
|
| 201 |
verify_selectors_not_in_parallel_graph(graph.get_parallel_info()); |
| 202 |
verify_part_ordinals_not_in_parallel_graph(parallelPartInfo); |
| 203 |
|
| 204 |
move_elements_into_parts_and_verify(); |
| 205 |
stk::mesh::impl::populate_selected_value_for_remote_elements(get_bulk(), graph, get_air_selector(), remoteAirSelector); |
| 206 |
stk::mesh::impl::populate_selected_value_for_remote_elements(get_bulk(), graph, get_skin_selector(), remoteSkinSelector); |
| 207 |
stk::mesh::impl::populate_part_ordinals_for_remote_edges(get_bulk(), graph, parallelPartInfo); |
| 208 |
verify_selectors_in_parallel_graph(graph.get_parallel_info()); |
| 209 |
verify_part_ordinals_are_in_parallel_graph(parallelPartInfo); |
| 210 |
|
| 211 |
move_elements_out_of_parts(); |
| 212 |
stk::mesh::impl::populate_selected_value_for_remote_elements(get_bulk(), graph, get_air_selector(), remoteAirSelector); |
| 213 |
stk::mesh::impl::populate_selected_value_for_remote_elements(get_bulk(), graph, get_skin_selector(), remoteSkinSelector); |
| 214 |
stk::mesh::impl::populate_part_ordinals_for_remote_edges(get_bulk(), graph, parallelPartInfo); |
| 215 |
verify_selectors_not_in_parallel_graph(graph.get_parallel_info()); |
| 216 |
verify_part_ordinals_not_in_parallel_graph(parallelPartInfo); |
| 217 |
} |
| 218 |
} |
| 219 |
|
| 220 |
TEST_F(ParallelGraphUpdate, deleteBothSolidElementsOnParallelEdge) |
| 221 |
{ |
| 222 |
if(stk::parallel_machine_size(MPI_COMM_WORLD)==2) |
| 223 |
{ |
| 224 |
stk::io::fill_mesh("generated:1x1x4", get_bulk()); |
| 225 |
get_bulk().initialize_face_adjacent_element_graph(); |
| 226 |
|
| 227 |
stk::mesh::Entity elem1 = get_bulk().get_entity(stk::topology::ELEM_RANK, 1u); |
| 228 |
stk::mesh::Entity elem2 = get_bulk().get_entity(stk::topology::ELEM_RANK, 2u); |
| 229 |
stk::mesh::Entity elem3 = get_bulk().get_entity(stk::topology::ELEM_RANK, 3u); |
| 230 |
stk::mesh::Entity elem4 = get_bulk().get_entity(stk::topology::ELEM_RANK, 4u); |
| 231 |
|
| 232 |
if(get_bulk().parallel_rank() == 0) { |
| 233 |
ASSERT_TRUE(get_bulk().is_valid(elem1)); |
| 234 |
ASSERT_TRUE(get_bulk().is_valid(elem2)); |
| 235 |
ASSERT_FALSE(get_bulk().is_valid(elem3)); |
| 236 |
ASSERT_FALSE(get_bulk().is_valid(elem4)); |
| 237 |
} |
| 238 |
|
| 239 |
if(get_bulk().parallel_rank() == 1) { |
| 240 |
ASSERT_FALSE(get_bulk().is_valid(elem1)); |
| 241 |
ASSERT_FALSE(get_bulk().is_valid(elem2)); |
| 242 |
ASSERT_TRUE(get_bulk().is_valid(elem3)); |
| 243 |
ASSERT_TRUE(get_bulk().is_valid(elem4)); |
| 244 |
} |
| 245 |
|
| 246 |
const stk::mesh::ElemElemGraph &graph = get_bulk().get_face_adjacent_element_graph(); |
| 247 |
const stk::mesh::impl::ParallelGraphInfo& parallelGraphInfo = graph.get_parallel_info_for_graph_edges().get_parallel_graph_info(); |
| 248 |
|
| 249 |
EXPECT_EQ(1u, parallelGraphInfo.size()); |
| 250 |
const stk::mesh::GraphEdge& graphEdge = parallelGraphInfo.begin()->first; |
| 251 |
|
| 252 |
if(get_bulk().parallel_rank() == 0) { |
| 253 |
stk::mesh::impl::LocalId localId = graphEdge.elem1(); |
| 254 |
stk::mesh::Entity localElem = graph.get_entity(localId); |
| 255 |
EXPECT_EQ(2u, get_bulk().identifier(localElem)); |
| 256 |
EXPECT_EQ(5, graphEdge.side1()); |
| 257 |
EXPECT_EQ(-3, graphEdge.elem2()); |
| 258 |
EXPECT_EQ(4, graphEdge.side2()); |
| 259 |
} |
| 260 |
if(get_bulk().parallel_rank() == 1) { |
| 261 |
stk::mesh::impl::LocalId localId = graphEdge.elem1(); |
| 262 |
stk::mesh::Entity localElem = graph.get_entity(localId); |
| 263 |
EXPECT_EQ(3u, get_bulk().identifier(localElem)); |
| 264 |
EXPECT_EQ(4, graphEdge.side1()); |
| 265 |
EXPECT_EQ(-2, graphEdge.elem2()); |
| 266 |
EXPECT_EQ(5, graphEdge.side2()); |
| 267 |
} |
| 268 |
|
| 269 |
get_bulk().modification_begin(); |
| 270 |
get_bulk().destroy_entity(elem2); |
| 271 |
get_bulk().destroy_entity(elem3); |
| 272 |
get_bulk().modification_end(); |
| 273 |
|
| 274 |
EXPECT_EQ(0u, parallelGraphInfo.size()); |
| 275 |
|
| 276 |
stk::mesh::impl::ParallelPartInfo parallelPartInfo; |
| 277 |
EXPECT_NO_THROW(stk::mesh::impl::populate_part_ordinals_for_remote_edges(get_bulk(), graph, parallelPartInfo)); |
| 278 |
} |
| 279 |
} |
| 280 |
|
| 281 |
TEST_F(ParallelGraphUpdate, deleteBothShellElementsOnParallelEdge) |
| 282 |
{ |
| 283 |
if(stk::parallel_machine_size(MPI_COMM_WORLD)==2) |
| 284 |
{ |
| 285 |
std::string meshDesc = "0,1,HEX_8,1,2,3,4,5,6,7,8,block_1\n" |
| 286 |
"0,2,SHELL_QUAD_4,5,6,7,8,block_2\n" |
| 287 |
"1,3,SHELL_QUAD_4,5,6,7,8,block_3\n" |
| 288 |
"1,4,HEX_8,5,6,7,8,9,10,11,12,block_1"; |
| 289 |
|
| 290 |
std::vector<double> coordinates = { |
| 291 |
0,0,0, 1,0,0, 1,1,0, 0,1,0, |
| 292 |
0,0,1, 1,0,1, 1,1,1, 0,1,1, |
| 293 |
0,0,2, 1,0,2, 1,1,2, 0,1,2 |
| 294 |
}; |
| 295 |
|
| 296 |
stk::unit_test_util::setup_text_mesh( |
| 297 |
get_bulk(), stk::unit_test_util::get_full_text_mesh_desc(meshDesc, coordinates)); |
| 298 |
get_bulk().initialize_face_adjacent_element_graph(); |
| 299 |
|
| 300 |
stk::mesh::Entity elem1 = get_bulk().get_entity(stk::topology::ELEM_RANK, 1u); |
| 301 |
stk::mesh::Entity elem2 = get_bulk().get_entity(stk::topology::ELEM_RANK, 2u); |
| 302 |
stk::mesh::Entity elem3 = get_bulk().get_entity(stk::topology::ELEM_RANK, 3u); |
| 303 |
stk::mesh::Entity elem4 = get_bulk().get_entity(stk::topology::ELEM_RANK, 4u); |
| 304 |
|
| 305 |
if(get_bulk().parallel_rank() == 0) { |
| 306 |
ASSERT_TRUE(get_bulk().is_valid(elem1)); |
| 307 |
ASSERT_TRUE(get_bulk().is_valid(elem2)); |
| 308 |
ASSERT_FALSE(get_bulk().is_valid(elem3)); |
| 309 |
ASSERT_FALSE(get_bulk().is_valid(elem4)); |
| 310 |
} |
| 311 |
|
| 312 |
if(get_bulk().parallel_rank() == 1) { |
| 313 |
ASSERT_FALSE(get_bulk().is_valid(elem1)); |
| 314 |
ASSERT_FALSE(get_bulk().is_valid(elem2)); |
| 315 |
ASSERT_TRUE(get_bulk().is_valid(elem3)); |
| 316 |
ASSERT_TRUE(get_bulk().is_valid(elem4)); |
| 317 |
} |
| 318 |
|
| 319 |
const stk::mesh::ElemElemGraph &graph = get_bulk().get_face_adjacent_element_graph(); |
| 320 |
const stk::mesh::impl::ParallelGraphInfo& parallelGraphInfo = graph.get_parallel_info_for_graph_edges().get_parallel_graph_info(); |
| 321 |
|
| 322 |
EXPECT_EQ(8u, parallelGraphInfo.size()); |
| 323 |
|
| 324 |
get_bulk().modification_begin(); |
| 325 |
get_bulk().destroy_entity(elem2); |
| 326 |
get_bulk().destroy_entity(elem3); |
| 327 |
get_bulk().modification_end(); |
| 328 |
|
| 329 |
EXPECT_EQ(1u, parallelGraphInfo.size()); |
| 330 |
|
| 331 |
stk::mesh::impl::ParallelPartInfo parallelPartInfo; |
| 332 |
EXPECT_NO_THROW(stk::mesh::impl::populate_part_ordinals_for_remote_edges(get_bulk(), graph, parallelPartInfo)); |
| 333 |
} |
| 334 |
} |
| 335 |
|
| 336 |
TEST_F(ParallelGraphUpdate, createAefA_FromScratch) |
| 337 |
{ |
| 338 |
if(stk::parallel_machine_size(MPI_COMM_WORLD)==2) |
| 339 |
{ |
| 340 |
std::string meshDesc = "0,1,HEX_8,1,2,3,4,5,6,7,8,block_1\n" |
| 341 |
"0,2,SHELL_QUAD_4,5,6,7,8,block_2\n" |
| 342 |
"1,3,SHELL_QUAD_4,5,6,7,8,block_3\n" |
| 343 |
"1,4,HEX_8,5,6,7,8,9,10,11,12,block_1"; |
| 344 |
|
| 345 |
std::vector<double> coordinates = { |
| 346 |
0,0,0, 1,0,0, 1,1,0, 0,1,0, |
| 347 |
0,0,1, 1,0,1, 1,1,1, 0,1,1, |
| 348 |
0,0,2, 1,0,2, 1,1,2, 0,1,2 |
| 349 |
}; |
| 350 |
|
| 351 |
stk::unit_test_util::setup_text_mesh( |
| 352 |
get_bulk(), stk::unit_test_util::get_full_text_mesh_desc(meshDesc, coordinates)); |
| 353 |
get_bulk().initialize_face_adjacent_element_graph(); |
| 354 |
|
| 355 |
const stk::mesh::ElemElemGraph &graph = get_bulk().get_face_adjacent_element_graph(); |
| 356 |
const stk::mesh::impl::ParallelGraphInfo& parallelGraphInfo = graph.get_parallel_info_for_graph_edges().get_parallel_graph_info(); |
| 357 |
|
| 358 |
EXPECT_EQ(8u, parallelGraphInfo.size()); |
| 359 |
|
| 360 |
stk::mesh::impl::ParallelPartInfo parallelPartInfo; |
| 361 |
EXPECT_NO_THROW(stk::mesh::impl::populate_part_ordinals_for_remote_edges(get_bulk(), graph, parallelPartInfo)); |
| 362 |
} |
| 363 |
} |
| 364 |
|
| 365 |
TEST_F(ParallelGraphUpdate, createAefA_FromAA) |
| 366 |
{ |
| 367 |
if(stk::parallel_machine_size(MPI_COMM_WORLD)==2) |
| 368 |
{ |
| 369 |
stk::mesh::Part& block_2 = get_meta().declare_part_with_topology("block_2", stk::topology::SHELL_QUAD_4); |
| 370 |
stk::mesh::Part& block_3 = get_meta().declare_part_with_topology("block_3", stk::topology::SHELL_QUAD_4); |
| 371 |
|
| 372 |
stk::mesh::PartVector shellParts{&block_2, &block_3}; |
| 373 |
|
| 374 |
stk::io::put_io_part_attribute(block_2); |
| 375 |
stk::io::put_io_part_attribute(block_3); |
| 376 |
|
| 377 |
get_meta().set_part_id(block_2, 2u); |
| 378 |
get_meta().set_part_id(block_3, 3u); |
| 379 |
|
| 380 |
std::string meshDesc = "0,1,HEX_8,1,2,3,4,5,6,7,8,block_1\n" |
| 381 |
"1,4,HEX_8,5,6,7,8,9,10,11,12,block_1"; |
| 382 |
|
| 383 |
std::vector<double> coordinates = { |
| 384 |
0,0,0, 1,0,0, 1,1,0, 0,1,0, |
| 385 |
0,0,1, 1,0,1, 1,1,1, 0,1,1, |
| 386 |
0,0,2, 1,0,2, 1,1,2, 0,1,2 |
| 387 |
}; |
| 388 |
|
| 389 |
stk::unit_test_util::setup_text_mesh( |
| 390 |
get_bulk(), stk::unit_test_util::get_full_text_mesh_desc(meshDesc, coordinates)); |
| 391 |
get_bulk().initialize_face_adjacent_element_graph(); |
| 392 |
|
| 393 |
const stk::mesh::ElemElemGraph &graph = get_bulk().get_face_adjacent_element_graph(); |
| 394 |
const stk::mesh::impl::ParallelGraphInfo& parallelGraphInfo = graph.get_parallel_info_for_graph_edges().get_parallel_graph_info(); |
| 395 |
|
| 396 |
EXPECT_EQ(1u, parallelGraphInfo.size()); |
| 397 |
|
| 398 |
stk::mesh::EntityIdVector shellNodeIds; |
| 399 |
for(unsigned i=5; i<=8; i++) { |
| 400 |
stk::mesh::Entity node = get_bulk().get_entity(stk::topology::NODE_RANK, i); |
| 401 |
ASSERT_TRUE(get_bulk().is_valid(node)); |
| 402 |
shellNodeIds.push_back(i); |
| 403 |
} |
| 404 |
|
| 405 |
get_bulk().modification_begin(); |
| 406 |
stk::mesh::EntityId shellId = get_bulk().parallel_rank() + 2; |
| 407 |
stk::mesh::Part* shellPart = shellParts[get_bulk().parallel_rank()]; |
| 408 |
stk::mesh::Entity elem = stk::mesh::declare_element(get_bulk(), *shellPart, shellId, shellNodeIds); |
| 409 |
get_bulk().modification_end(); |
| 410 |
|
| 411 |
EXPECT_EQ(8u, parallelGraphInfo.size()); |
| 412 |
|
| 413 |
get_bulk().modification_begin(); |
| 414 |
get_bulk().destroy_entity(elem); |
| 415 |
get_bulk().modification_end(); |
| 416 |
|
| 417 |
EXPECT_EQ(1u, parallelGraphInfo.size()); |
| 418 |
|
| 419 |
stk::mesh::impl::ParallelPartInfo parallelPartInfo; |
| 420 |
EXPECT_NO_THROW(stk::mesh::impl::populate_part_ordinals_for_remote_edges(get_bulk(), graph, parallelPartInfo)); |
| 421 |
} |
| 422 |
} |