Debian Codegraph @

packages/stk/stk_unit_tests/stk_mesh/UnitTestChangeParts.cpp

raw
1 // Copyright 2002 - 2008, 2010, 2011 National Technology Engineering
2 // Solutions of Sandia, LLC (NTESS). Under the terms of Contract
3 // DE-NA0003525 with NTESS, the U.S. Government retains certain rights
4 // in this software.
5 //
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are
8 // met:
9 //
10 // * Redistributions of source code must retain the above copyright
11 // notice, this list of conditions and the following disclaimer.
12 //
13 // * Redistributions in binary form must reproduce the above
14 // copyright notice, this list of conditions and the following
15 // disclaimer in the documentation and/or other materials provided
16 // with the distribution.
17 //
18 // * Neither the name of NTESS nor the names of its contributors
19 // may be used to endorse or promote products derived from this
20 // software without specific prior written permission.
21 //
22 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 //
34
35 #include <gtest/gtest.h> // for AssertHelper, EXPECT_THROW, etc
36 #include <stdexcept> // for runtime_error
37 #include <stk_unit_test_utils/ioUtils.hpp> // for fill_mesh_using_stk_io
38 #include <stk_unit_test_utils/TextMesh.hpp>
39 #include <stk_unit_test_utils/MeshFixture.hpp>
40 #include <string> // for string
41 #include <cstdlib> // for unsetenv, setenv
42
43 #include "mpi.h" // for MPI_COMM_WORLD, MPI_Comm, etc
44 #include "stk_mesh/base/BulkData.hpp" // for BulkData
45 #include "stk_mesh/base/Entity.hpp" // for Entity
46 #include "stk_mesh/base/GetEntities.hpp"
47 #include "stk_mesh/base/MetaData.hpp" // for MetaData
48 #include "stk_mesh/base/Selector.hpp"
49 #include "stk_mesh/base/Types.hpp" // for PartVector
50 #include "stk_mesh/baseImpl/Partition.hpp"
51 #include "stk_topology/topology.hpp" // for topology, etc
52
53 namespace
54 {
55
56 std::shared_ptr<stk::mesh::BulkData> build_mesh(unsigned spatialDim,
57 stk::ParallelMachine comm,
58 stk::mesh::BulkData::AutomaticAuraOption auraOption = stk::mesh::BulkData::AUTO_AURA)
59 {
60 stk::mesh::MeshBuilder builder(comm);
61 builder.set_spatial_dimension(spatialDim);
62 builder.set_aura_option(auraOption);
63 std::shared_ptr<stk::mesh::BulkData> bulk = builder.create();
64 return bulk;
65 }
66
67 TEST(UnitTestChangeParts, test_throw_on_internal_part_change)
68 {
69 MPI_Comm communicator = MPI_COMM_WORLD;
70 const int spatialDim = 3;
71 std::shared_ptr<stk::mesh::BulkData> bulkPtr = build_mesh(spatialDim, communicator);
72 stk::mesh::MetaData& metaData = bulkPtr->mesh_meta_data();
73 stk::mesh::BulkData& bulkData = *bulkPtr;
74
75 std::string generatedMeshSpec = "generated:1x1x4";
76 stk::io::fill_mesh(generatedMeshSpec, bulkData);
77
78 stk::mesh::Entity node = bulkData.get_entity(stk::topology::NODE_RANK, 1);
79
80 stk::mesh::PartVector addParts;
81 stk::mesh::PartVector removeParts;
82
83 addParts.push_back(&metaData.locally_owned_part());
84 EXPECT_THROW(bulkData.change_entity_parts(node, addParts, removeParts), std::runtime_error);
85
86 addParts.clear();
87 addParts.push_back(&metaData.globally_shared_part());
88 EXPECT_THROW(bulkData.change_entity_parts(node, addParts, removeParts), std::runtime_error);
89
90 addParts.clear();
91 removeParts.push_back(&metaData.locally_owned_part());
92 EXPECT_THROW(bulkData.change_entity_parts(node, addParts, removeParts), std::runtime_error);
93
94 removeParts.clear();
95 removeParts.push_back(&metaData.globally_shared_part());
96 EXPECT_THROW(bulkData.change_entity_parts(node, addParts, removeParts), std::runtime_error);
97 }
98
99 void do_simple_batch_part_change_test(stk::mesh::BulkData& bulkData)
100 {
101 stk::mesh::MetaData& metaData = bulkData.mesh_meta_data();
102 stk::mesh::Part& bluePart = metaData.declare_part("blue_part");
103 stk::mesh::Part& redPart = metaData.declare_part("red_part");
104
105 stk::mesh::Entity elem1 = bulkData.get_entity(stk::topology::ELEM_RANK, 1u);
106 EXPECT_TRUE(bulkData.is_valid(elem1));
107
108 stk::mesh::EntityVector nodes(bulkData.begin_nodes(elem1), bulkData.begin_nodes(elem1)+bulkData.num_nodes(elem1));
109 EXPECT_EQ(8u, nodes.size());
110
111 for(stk::mesh::Entity node : nodes) {
112 EXPECT_FALSE(bulkData.bucket(node).member(bluePart));
113 EXPECT_FALSE(bulkData.bucket(node).member(redPart));
114 }
115
116 stk::mesh::PartVector blue_parts(1, &bluePart);
117 stk::mesh::PartVector red_parts(1, &redPart);
118 bulkData.batch_change_entity_parts(nodes, blue_parts, {});
119 nodes.resize(4);
120 bulkData.batch_change_entity_parts(nodes, red_parts, blue_parts);
121
122 for(stk::mesh::Entity node : nodes) {
123 EXPECT_TRUE(bulkData.bucket(node).member(redPart));
124 EXPECT_FALSE(bulkData.bucket(node).member(bluePart));
125 }
126
127 nodes.resize(1);
128 bulkData.batch_change_entity_parts(nodes, blue_parts, red_parts);
129
130 EXPECT_TRUE(bulkData.bucket(nodes[0]).member(bluePart));
131 EXPECT_FALSE(bulkData.bucket(nodes[0]).member(redPart));
132 }
133
134 TEST(UnitTestChangeParts, genmesh_test_batch_part_change_1_node)
135 {
136 stk::ParallelMachine pm = MPI_COMM_WORLD;
137 const int p_size = stk::parallel_machine_size( pm );
138
139 if (p_size != 1) { GTEST_SKIP(); }
140
141 const int spatialDim = 3;
142 std::shared_ptr<stk::mesh::BulkData> bulkPtr = build_mesh(spatialDim, pm, stk::mesh::BulkData::NO_AUTO_AURA);
143
144 stk::io::fill_mesh("generated:1x1x1", *bulkPtr);
145
146 do_simple_batch_part_change_test(*bulkPtr);
147 }
148
149 TEST(UnitTestChangeParts, test_batch_part_change_1_node)
150 {
151 stk::ParallelMachine pm = MPI_COMM_WORLD;
152 const int p_size = stk::parallel_machine_size( pm );
153
154 if (p_size != 1) { GTEST_SKIP(); }
155
156 const int spatialDim = 3;
157 std::shared_ptr<stk::mesh::BulkData> bulkPtr = build_mesh(spatialDim, pm, stk::mesh::BulkData::NO_AUTO_AURA);
158
159 std::string meshDesc = "0,1,HEX_8,1,2,3,4,5,6,7,8,block_1";
160 stk::unit_test_util::setup_text_mesh(*bulkPtr, meshDesc);
161
162 do_simple_batch_part_change_test(*bulkPtr);
163 }
164
165 TEST(UnitTestChangeParts, test_batch_part_change)
166 {
167 stk::ParallelMachine pm = MPI_COMM_WORLD;
168 const int p_size = stk::parallel_machine_size( pm );
169
170 if (p_size != 1) { GTEST_SKIP(); }
171
172 const int spatialDim = 3;
173 std::shared_ptr<stk::mesh::BulkData> bulkPtr = build_mesh(spatialDim, pm, stk::mesh::BulkData::NO_AUTO_AURA);
174 stk::mesh::MetaData& metaData = bulkPtr->mesh_meta_data();
175 stk::mesh::BulkData& bulkData = *bulkPtr;
176
177 std::string meshDesc = "0,1,HEX_8,1,2,3,4,5,6,7,8";
178 stk::mesh::Part& part = metaData.declare_part_with_topology("new_part", stk::topology::NODE);
179 stk::unit_test_util::setup_text_mesh(bulkData, meshDesc);
180
181 stk::mesh::Entity elem1 = bulkData.get_entity(stk::topology::ELEM_RANK, 1u);
182 EXPECT_TRUE(bulkData.is_valid(elem1));
183
184 stk::mesh::EntityVector nodes(bulkData.begin_nodes(elem1), bulkData.begin_nodes(elem1)+bulkData.num_nodes(elem1));
185 EXPECT_EQ(8u, nodes.size());
186
187 for(stk::mesh::Entity node : nodes) {
188 EXPECT_FALSE(bulkData.bucket(node).member(part));
189 }
190
191 stk::mesh::PartVector add_parts(1, &part);
192 bulkData.batch_change_entity_parts(nodes, add_parts, {});
193
194 for(stk::mesh::Entity node : nodes) {
195 EXPECT_TRUE(bulkData.bucket(node).member(part));
196 }
197
198 stk::mesh::PartVector remove_parts(1, &part);
199 bulkData.batch_change_entity_parts(nodes, {}, remove_parts);
200
201 for(stk::mesh::Entity node : nodes) {
202 EXPECT_FALSE(bulkData.bucket(node).member(part));
203 }
204 }
205
206 TEST(UnitTestChangeParts, test_superset_and_subset_part_change)
207 {
208 stk::ParallelMachine pm = MPI_COMM_WORLD;
209 const int p_size = stk::parallel_machine_size( pm );
210
211 if (p_size != 1) {
212 return;
213 }
214
215 const int spatialDim = 3;
216 std::shared_ptr<stk::mesh::BulkData> bulkPtr = build_mesh(spatialDim, pm, stk::mesh::BulkData::NO_AUTO_AURA);
217 stk::mesh::MetaData& metaData = bulkPtr->mesh_meta_data();
218 stk::mesh::BulkData& bulkData = *bulkPtr;
219
220 stk::mesh::Part& supersetPart = metaData.declare_part_with_topology("parent", stk::topology::NODE);
221 stk::mesh::Part& subsetPart1 = metaData.declare_part_with_topology("child 1", stk::topology::NODE);
222 stk::mesh::Part& subsetPart2 = metaData.declare_part_with_topology("child 2", stk::topology::NODE);
223
224 metaData.declare_part_subset(supersetPart, subsetPart1);
225 metaData.declare_part_subset(supersetPart, subsetPart2);
226
227 stk::mesh::FieldBase &field = metaData.declare_field<double>(stk::topology::NODE_RANK, "sam");
228 stk::mesh::put_field_on_mesh(field, supersetPart, nullptr);
229
230 std::string meshDesc = "0,1,HEX_8,1,2,3,4,5,6,7,8";
231 stk::unit_test_util::setup_text_mesh(bulkData, meshDesc);
232
233 stk::mesh::Entity node1 = bulkData.get_entity(stk::topology::NODE_RANK, 1u);
234 EXPECT_TRUE(bulkData.is_valid(node1));
235
236 stk::mesh::Entity node2 = bulkData.get_entity(stk::topology::NODE_RANK, 2u);
237 EXPECT_TRUE(bulkData.is_valid(node2));
238
239 EXPECT_FALSE(bulkData.bucket(node1).member(supersetPart));
240 EXPECT_FALSE(bulkData.bucket(node1).member(subsetPart1));
241 EXPECT_FALSE(bulkData.bucket(node1).member(subsetPart2));
242
243 EXPECT_FALSE(bulkData.bucket(node2).member(supersetPart));
244 EXPECT_FALSE(bulkData.bucket(node2).member(subsetPart1));
245 EXPECT_FALSE(bulkData.bucket(node2).member(subsetPart2));
246
247 bulkData.modification_begin();
248 stk::mesh::PartVector add_parts(1, &subsetPart1);
249 bulkData.change_entity_parts(node1, add_parts, {});
250 bulkData.modification_end();
251
252 EXPECT_TRUE(bulkData.bucket(node1).member(supersetPart));
253 EXPECT_TRUE(bulkData.bucket(node1).member(subsetPart1));
254 EXPECT_FALSE(bulkData.bucket(node1).member(subsetPart2));
255
256 bulkData.modification_begin();
257 add_parts[0] = &supersetPart;
258 bulkData.change_entity_parts(node2, add_parts, {});
259 bulkData.modification_end();
260
261 EXPECT_TRUE(bulkData.bucket(node2).member(supersetPart));
262 EXPECT_FALSE(bulkData.bucket(node2).member(subsetPart1));
263 EXPECT_FALSE(bulkData.bucket(node2).member(subsetPart2));
264
265 stk::mesh::PartVector partVector{&subsetPart1, &subsetPart2};
266 stk::mesh::Selector selector = supersetPart & !stk::mesh::selectUnion(partVector);
267 stk::mesh::EntityVector nodes;
268 stk::mesh::get_selected_entities(selector, bulkData.buckets(stk::topology::NODE_RANK), nodes);
269
270 EXPECT_EQ(1u, nodes.size());
271 EXPECT_EQ(2u, bulkData.identifier(nodes[0]));
272
273 bulkData.modification_begin();
274 add_parts[0] = &subsetPart2;
275 bulkData.change_entity_parts(node2, add_parts, {});
276 bulkData.modification_end();
277
278 EXPECT_TRUE(bulkData.bucket(node2).member(supersetPart));
279 EXPECT_FALSE(bulkData.bucket(node2).member(subsetPart1));
280 EXPECT_TRUE(bulkData.bucket(node2).member(subsetPart2));
281
282 double* node1Data = (double*) stk::mesh::field_data(field, node1);
283 double* node2Data = (double*) stk::mesh::field_data(field, node1);
284
285 EXPECT_TRUE(node1Data != nullptr);
286 EXPECT_TRUE(node2Data != nullptr);
287
288
289 for(unsigned i=3; i<8u; ++i) {
290 stk::mesh::Entity node = bulkData.get_entity(stk::topology::NODE_RANK, i);
291 EXPECT_TRUE(bulkData.is_valid(node));
292 double* nodeData = (double*) stk::mesh::field_data(field, node);
293 EXPECT_TRUE(nodeData == nullptr);
294 }
295 }
296
297 TEST(ChangeElemParts, DontMarkSharedNodesModifiedUnnecessarily)
298 {
299 stk::ParallelMachine communicator = MPI_COMM_WORLD;
300 int numProcs = stk::parallel_machine_size(communicator);
301 if(numProcs > 2) { GTEST_SKIP(); }
302
303 const int spatialDim = 3;
304 std::shared_ptr<stk::mesh::BulkData> bulkPtr = build_mesh(spatialDim, communicator, stk::mesh::BulkData::NO_AUTO_AURA);
305 stk::mesh::MetaData& meta = bulkPtr->mesh_meta_data();
306 stk::mesh::Part& myPart = meta.declare_part("myPart");
307 stk::mesh::BulkData& bulk = *bulkPtr;
308 stk::io::fill_mesh("generated:1x1x2", bulk);
309
310 bulk.modification_begin();
311 stk::mesh::Part& block1 = *meta.get_part("block_1");
312 stk::mesh::PartVector parts = {&block1, &myPart};
313 stk::mesh::EntityId elemId = bulk.parallel_rank() + 1;
314 stk::mesh::Entity elem = bulk.get_entity(stk::topology::ELEM_RANK, elemId);
315 bulk.change_entity_parts(elem, parts);
316 bulk.modification_end();
317
318 //elem should be "modified" because it was not already in myPart
319 EXPECT_EQ(stk::mesh::Modified, bulk.state(elem));
320 //node 5 should not be "modified" because it was already in block_1 and
321 //shouldn't be induced into myPart
322 stk::mesh::Entity node5 = bulk.get_entity(stk::topology::NODE_RANK, 5);
323 EXPECT_FALSE(bulk.bucket(node5).member(myPart));
324 EXPECT_EQ(stk::mesh::Unchanged, bulk.state(node5));
325 }
326
327 TEST(ChangeElemParts, addThenRemoveElemPart_checkSharedNode)
328 {
329 stk::ParallelMachine communicator = MPI_COMM_WORLD;
330 int numProcs = stk::parallel_machine_size(communicator);
331 if(numProcs > 2) { GTEST_SKIP(); }
332
333 const int spatialDim = 3;
334 std::shared_ptr<stk::mesh::BulkData> bulkPtr = build_mesh(spatialDim, communicator, stk::mesh::BulkData::NO_AUTO_AURA);
335 stk::mesh::MetaData& meta = bulkPtr->mesh_meta_data();
336 stk::mesh::Part& myPart = meta.declare_part_with_topology("myPart", stk::topology::HEX_8);
337 stk::mesh::BulkData& bulk = *bulkPtr;
338 stk::io::fill_mesh("generated:1x1x2", bulk);
339
340 stk::mesh::Part& block1 = *meta.get_part("block_1");
341 stk::mesh::PartVector parts = {&block1, &myPart}, empty;
342 stk::mesh::EntityId elemId = bulk.parallel_rank() + 1;
343 stk::mesh::Entity elem = bulk.get_entity(stk::topology::ELEM_RANK, elemId);
344
345 bulk.modification_begin();
346 bulk.change_entity_parts(elem, parts, empty);
347 bulk.modification_end();
348
349 //elem should be "modified" because it was not already in myPart
350 EXPECT_EQ(stk::mesh::Modified, bulk.state(elem));
351 EXPECT_TRUE(bulk.bucket(elem).member(myPart));
352 //node 5 should be "modified" because it was also added to myPart
353 stk::mesh::Entity node5 = bulk.get_entity(stk::topology::NODE_RANK, 5);
354 EXPECT_TRUE(bulk.bucket(node5).member(myPart));
355 EXPECT_EQ(stk::mesh::Modified, bulk.state(node5));
356
357 bulk.modification_begin();
358 bulk.change_entity_parts(elem, empty, parts);
359 bulk.modification_end();
360
361 //elem should be "modified" because it is no longer in myPart
362 EXPECT_EQ(stk::mesh::Modified, bulk.state(elem));
363 EXPECT_FALSE(bulk.bucket(elem).member(myPart));
364 //node 5 should be "modified" because it is no longer in myPart
365 EXPECT_FALSE(bulk.bucket(node5).member(myPart));
366 EXPECT_EQ(stk::mesh::Modified, bulk.state(node5));
367 }
368
369 class TestChangePartsWithSelector : public stk::unit_test_util::MeshFixture
370 {
371 public:
372 TestChangePartsWithSelector()
373 : stk::unit_test_util::MeshFixture(3)
374 {
375 setenv("STK_MESH_RUN_CONSISTENCY_CHECK", "ON", 1);
376 setup_empty_mesh(stk::mesh::BulkData::NO_AUTO_AURA);
377 }
378
379 void setup_n_unranked_parts_n_elements(unsigned numBlockParts, unsigned numElem, stk::mesh::PartVector& parts)
380 {
381 std::string meshSpec = "generated:1x1x" + std::to_string(numElem);
382
383 for(unsigned i = 1; i < numBlockParts; i++) {
384 std::string partName = "block_" + std::to_string(i+1);
385 parts.push_back(&get_meta().declare_part(partName));
386 }
387 stk::io::fill_mesh(meshSpec, get_bulk());
388 parts.insert(parts.begin(), get_meta().get_part("block_1"));
389 }
390
391 void setup_n_ranked_parts_n_elements(unsigned numBlockParts, unsigned numElem, stk::mesh::PartVector& parts, std::string opt = "")
392 {
393 std::string meshSpec = "generated:1x1x" + std::to_string(numElem) + opt;
394
395 for(unsigned i = 1; i < numBlockParts; i++) {
396 std::string partName = "block_" + std::to_string(i+1);
397 parts.push_back(&get_meta().declare_part(partName, stk::topology::ELEM_RANK));
398 }
399 stk::io::fill_mesh(meshSpec, get_bulk());
400 parts.insert(parts.begin(), get_meta().get_part("block_1"));
401 }
402
403 void setup_n_ranked_parts_n_elements_with_faces(unsigned numBlockParts, unsigned numElem, stk::mesh::PartVector& parts)
404 {
405 setup_n_ranked_parts_n_elements(numBlockParts, numElem, parts, "|sideset:XxYyZz");
406 }
407
408 void insert_into_add_part(stk::mesh::Part* part)
409 {
410 addParts.push_back(part);
411 }
412
413 void insert_into_remove_part(stk::mesh::Part* part)
414 {
415 removeParts.push_back(part);
416 }
417
418 void clear_mod_part_vectors()
419 {
420 addParts.clear();
421 removeParts.clear();
422 }
423
424 void change_entity_parts(stk::mesh::Entity entity)
425 {
426 get_bulk().modification_begin();
427 EXPECT_NO_THROW(get_bulk().change_entity_parts(entity, addParts, removeParts));
428 get_bulk().modification_end();
429
430 clear_mod_part_vectors();
431 }
432
433 void batch_change_entity_parts(stk::mesh::Entity entity)
434 {
435 get_bulk().modification_begin();
436 EXPECT_NO_THROW(get_bulk().change_entity_parts(entity, addParts, removeParts));
437 get_bulk().modification_end();
438
439 clear_mod_part_vectors();
440 }
441
442 void batch_change_entity_parts_with_selector(stk::mesh::Selector selector, stk::mesh::EntityRank rank)
443 {
444 EXPECT_NO_THROW(get_bulk().batch_change_entity_parts(selector, rank, addParts, removeParts));
445 clear_mod_part_vectors();
446 }
447
448 void change_entity_parts_with_selector(stk::mesh::Selector selector, stk::mesh::EntityRank rank)
449 {
450 EXPECT_NO_THROW(get_bulk().modification_begin());
451 EXPECT_NO_THROW(get_bulk().change_entity_parts(selector, rank, addParts, removeParts));
452 EXPECT_NO_THROW(get_bulk().modification_end());
453 clear_mod_part_vectors();
454 }
455
456 void test_entity_counts_in_parts(stk::mesh::Part* part, stk::mesh::EntityRank rank, unsigned expectedCountInPart)
457 {
458 unsigned entityCount = stk::mesh::count_entities(get_bulk(), rank, stk::mesh::Selector(*part));
459 EXPECT_EQ(expectedCountInPart, entityCount) << " unexpected entity count in " << part->name() << " " << rank << std::endl;
460 }
461
462 void test_bucket_count(stk::mesh::EntityRank, unsigned expectedBucketCount)
463 {
464 unsigned bucketCount = get_bulk().get_buckets(stk::topology::ELEM_RANK, get_meta().universal_part()).size();
465 EXPECT_EQ(expectedBucketCount, bucketCount);
466 }
467
468 void test_partitions_equality(stk::mesh::EntityRank /*rank*/, stk::mesh::Bucket const* bucket1, stk::mesh::Bucket const* bucket2)
469 {
470 stk::mesh::impl::Partition* partition1 = bucket1->getPartition();
471 stk::mesh::impl::Partition* partition2 = bucket2->getPartition();
472
473 EXPECT_EQ(partition1->size(), partition2->size());
474 EXPECT_EQ(partition1->num_buckets(), partition2->num_buckets());
475
476 const unsigned* key1 = partition1->key();
477 const unsigned* key2 = partition2->key();
478
479 EXPECT_EQ(key1[0], key2[0]);
480
481 if(key1[0] == key2[0]) {
482 for(unsigned i = 0; i < key1[0]; i++) {
483 EXPECT_EQ(key1[i], key2[i]);
484 }
485 }
486
487 for(auto it1 = partition1->begin(), it2 = partition2->begin();
488 it1 != partition1->end(); ++it1, ++it2) {
489
490 EXPECT_EQ((*it1)->bucket_id(), (*it2)->bucket_id());
491 }
492 }
493
494 stk::mesh::PartVector addParts, removeParts;
495 };
496
497 TEST_F(TestChangePartsWithSelector, element_in_ranked_part_remove_initial_part)
498 {
499 if(get_bulk().parallel_size() > 1) { return; }
500
501 unsigned numBlockParts = 1;
502 unsigned numElem = 1;
503 stk::mesh::PartVector parts;
504 setup_n_unranked_parts_n_elements(numBlockParts, numElem, parts);
505
506 stk::mesh::Part* block1Part = parts[0];
507
508 insert_into_remove_part(block1Part);
509 batch_change_entity_parts_with_selector(stk::mesh::Selector(*block1Part), stk::topology::ELEM_RANK);
510
511 test_entity_counts_in_parts(block1Part, stk::topology::ELEM_RANK, 0);
512 test_entity_counts_in_parts(block1Part, stk::topology::NODE_RANK, 0);
513 }
514
515 TEST_F(TestChangePartsWithSelector, element_in_ranked_part_to_new_unranked_part)
516 {
517 if(get_bulk().parallel_size() > 1) { return; }
518
519 unsigned numBlockParts = 2;
520 unsigned numElem = 1;
521 stk::mesh::PartVector parts;
522 setup_n_unranked_parts_n_elements(numBlockParts, numElem, parts);
523
524 stk::mesh::Part* block1Part = parts[0];
525 stk::mesh::Part* block2Part = parts[1];
526
527 insert_into_add_part(block2Part);
528 insert_into_remove_part(block1Part);
529 batch_change_entity_parts_with_selector(stk::mesh::Selector(*block1Part), stk::topology::ELEM_RANK);
530
531 test_entity_counts_in_parts(block1Part, stk::topology::ELEM_RANK, 0);
532 test_entity_counts_in_parts(block1Part, stk::topology::NODE_RANK, 0);
533
534 test_entity_counts_in_parts(block2Part, stk::topology::ELEM_RANK, 1);
535 test_entity_counts_in_parts(block2Part, stk::topology::NODE_RANK, 0);
536 }
537
538 TEST_F(TestChangePartsWithSelector, element_in_ranked_part_to_new_unranked_part_in_two_procs)
539 {
540 if(get_bulk().parallel_size() != 2) { return; }
541
542 unsigned numBlockParts = 2;
543 unsigned numElem = 2;
544 stk::mesh::PartVector parts;
545 setup_n_unranked_parts_n_elements(numBlockParts, numElem, parts);
546
547 stk::mesh::Part* block1Part = parts[0];
548 stk::mesh::Part* block2Part = parts[1];
549
550 insert_into_add_part(block2Part);
551 insert_into_remove_part(block1Part);
552 batch_change_entity_parts_with_selector(stk::mesh::Selector(*block1Part), stk::topology::ELEM_RANK);
553
554 test_entity_counts_in_parts(block1Part, stk::topology::ELEM_RANK, 0);
555 test_entity_counts_in_parts(block1Part, stk::topology::NODE_RANK, 0);
556
557 test_entity_counts_in_parts(block2Part, stk::topology::ELEM_RANK, 1);
558 test_entity_counts_in_parts(block2Part, stk::topology::NODE_RANK, 0);
559 }
560
561 TEST_F(TestChangePartsWithSelector, element_in_ranked_part_to_new_unranked_part_in_two_procs_non_batch)
562 {
563 if(get_bulk().parallel_size() != 2) { return; }
564
565 unsigned numBlockParts = 2;
566 unsigned numElem = 2;
567 stk::mesh::PartVector parts;
568 setup_n_unranked_parts_n_elements(numBlockParts, numElem, parts);
569
570 stk::mesh::Part* block1Part = parts[0];
571 stk::mesh::Part* block2Part = parts[1];
572
573 insert_into_add_part(block2Part);
574 insert_into_remove_part(block1Part);
575 change_entity_parts_with_selector(stk::mesh::Selector(*block1Part), stk::topology::ELEM_RANK);
576
577 test_entity_counts_in_parts(block1Part, stk::topology::ELEM_RANK, 0);
578 test_entity_counts_in_parts(block1Part, stk::topology::NODE_RANK, 0);
579
580 test_entity_counts_in_parts(block2Part, stk::topology::ELEM_RANK, 1);
581 test_entity_counts_in_parts(block2Part, stk::topology::NODE_RANK, 0);
582 }
583
584 TEST_F(TestChangePartsWithSelector, element_in_ranked_part_to_new_ranked_part_in_two_procs)
585 {
586 if(get_bulk().parallel_size() != 2) { return; }
587
588 unsigned numBlockParts = 2;
589 unsigned numElem = 2;
590 stk::mesh::PartVector parts;
591 setup_n_ranked_parts_n_elements(numBlockParts, numElem, parts);
592
593 stk::mesh::Part* block1Part = parts[0];
594 stk::mesh::Part* block2Part = parts[1];
595
596 insert_into_add_part(block2Part);
597 insert_into_remove_part(block1Part);
598 batch_change_entity_parts_with_selector(stk::mesh::Selector(*block1Part), stk::topology::ELEM_RANK);
599
600 test_entity_counts_in_parts(block1Part, stk::topology::ELEM_RANK, 0);
601 test_entity_counts_in_parts(block1Part, stk::topology::NODE_RANK, 0);
602
603 test_entity_counts_in_parts(block2Part, stk::topology::ELEM_RANK, 1);
604 test_entity_counts_in_parts(block2Part, stk::topology::NODE_RANK, 8);
605 }
606
607 TEST_F(TestChangePartsWithSelector, two_elements_3_blocks_move_each_to_different_block_in_serial)
608 {
609 if(get_bulk().parallel_size() != 1) { GTEST_SKIP(); }
610
611 unsigned numBlockParts = 3;
612 unsigned numElem = 2;
613 stk::mesh::PartVector parts;
614 setup_n_ranked_parts_n_elements(numBlockParts, numElem, parts);
615
616 stk::mesh::Part* block1Part = parts[0];
617 stk::mesh::Part* block2Part = parts[1];
618 stk::mesh::Part* block3Part = parts[2];
619
620 insert_into_add_part(block2Part);
621 insert_into_remove_part(block1Part);
622 stk::mesh::Entity elem1 = get_bulk().get_entity(stk::topology::ELEM_RANK, 1);
623 batch_change_entity_parts(elem1);
624
625 insert_into_add_part(block3Part);
626 insert_into_remove_part(block1Part);
627 batch_change_entity_parts_with_selector(stk::mesh::Selector(*block1Part), stk::topology::ELEM_RANK);
628
629 test_entity_counts_in_parts(block1Part, stk::topology::ELEM_RANK, 0);
630 test_entity_counts_in_parts(block1Part, stk::topology::NODE_RANK, 0);
631
632 test_entity_counts_in_parts(block2Part, stk::topology::ELEM_RANK, 1);
633 test_entity_counts_in_parts(block2Part, stk::topology::NODE_RANK, 8);
634 test_entity_counts_in_parts(block3Part, stk::topology::ELEM_RANK, 1);
635 test_entity_counts_in_parts(block3Part, stk::topology::NODE_RANK, 8);
636 }
637
638 TEST_F(TestChangePartsWithSelector, element_in_ranked_part_to_new_ranked_part_in_two_procs_non_batch)
639 {
640 if(get_bulk().parallel_size() != 2) { return; }
641
642 unsigned numBlockParts = 2;
643 unsigned numElem = 2;
644 stk::mesh::PartVector parts;
645 setup_n_ranked_parts_n_elements(numBlockParts, numElem, parts);
646
647 stk::mesh::Part* block1Part = parts[0];
648 stk::mesh::Part* block2Part = parts[1];
649
650 insert_into_add_part(block2Part);
651 insert_into_remove_part(block1Part);
652 change_entity_parts_with_selector(stk::mesh::Selector(*block1Part), stk::topology::ELEM_RANK);
653
654 test_entity_counts_in_parts(block1Part, stk::topology::ELEM_RANK, 0);
655 test_entity_counts_in_parts(block1Part, stk::topology::NODE_RANK, 0);
656
657 test_entity_counts_in_parts(block2Part, stk::topology::ELEM_RANK, 1);
658 test_entity_counts_in_parts(block2Part, stk::topology::NODE_RANK, 8);
659 }
660
661 TEST_F(TestChangePartsWithSelector, element_in_ranked_part_add_new_unranked_part)
662 {
663 if(get_bulk().parallel_size() > 1) { return; }
664
665 unsigned numBlockParts = 2;
666 unsigned numElem = 1;
667 stk::mesh::PartVector parts;
668 setup_n_unranked_parts_n_elements(numBlockParts, numElem, parts);
669
670 stk::mesh::Part* block1Part = parts[0];
671 stk::mesh::Part* block2Part = parts[1];
672
673 insert_into_add_part(block2Part);
674 batch_change_entity_parts_with_selector(stk::mesh::Selector(*block1Part), stk::topology::ELEM_RANK);
675
676 test_entity_counts_in_parts(block1Part, stk::topology::ELEM_RANK, 1);
677 test_entity_counts_in_parts(block1Part, stk::topology::NODE_RANK, 8);
678
679 test_entity_counts_in_parts(block2Part, stk::topology::ELEM_RANK, 1);
680 test_entity_counts_in_parts(block2Part, stk::topology::NODE_RANK, 0);
681 }
682
683 TEST_F(TestChangePartsWithSelector, element_in_ranked_part_remove_unranked_part)
684 {
685 if(get_bulk().parallel_size() > 1) { return; }
686
687 unsigned numBlockParts = 2;
688 unsigned numElem = 1;
689 stk::mesh::PartVector parts;
690 setup_n_unranked_parts_n_elements(numBlockParts, numElem, parts);
691
692 stk::mesh::Part* block1Part = parts[0];
693 stk::mesh::Part* block2Part = parts[1];
694
695 {
696 insert_into_add_part(block2Part);
697
698 stk::mesh::EntityVector elements;
699 stk::mesh::get_entities(get_bulk(), stk::topology::ELEM_RANK, elements);
700 change_entity_parts(elements[0]);
701
702 test_entity_counts_in_parts(block1Part, stk::topology::ELEM_RANK, 1);
703 test_entity_counts_in_parts(block1Part, stk::topology::NODE_RANK, 8);
704
705 test_entity_counts_in_parts(block2Part, stk::topology::ELEM_RANK, 1);
706 test_entity_counts_in_parts(block2Part, stk::topology::NODE_RANK, 0);
707 }
708
709 insert_into_remove_part(block2Part);
710 batch_change_entity_parts_with_selector(stk::mesh::selectUnion(stk::mesh::PartVector{block1Part, block2Part}), stk::topology::ELEM_RANK);
711
712 test_entity_counts_in_parts(block1Part, stk::topology::ELEM_RANK, 1);
713 test_entity_counts_in_parts(block1Part, stk::topology::NODE_RANK, 8);
714
715 test_entity_counts_in_parts(block2Part, stk::topology::ELEM_RANK, 0);
716 test_entity_counts_in_parts(block2Part, stk::topology::NODE_RANK, 0);
717 }
718
719 TEST_F(TestChangePartsWithSelector, element_in_ranked_part_add_new_ranked_part)
720 {
721 if(get_bulk().parallel_size() > 1) { return; }
722
723 unsigned numBlockParts = 2;
724 unsigned numElem = 1;
725 stk::mesh::PartVector parts;
726 setup_n_ranked_parts_n_elements(numBlockParts, numElem, parts);
727
728 stk::mesh::Part* block1Part = parts[0];
729 stk::mesh::Part* block2Part = parts[1];
730
731 insert_into_add_part(block2Part);
732
733 batch_change_entity_parts_with_selector(stk::mesh::Selector(*block1Part), stk::topology::ELEM_RANK);
734
735 test_entity_counts_in_parts(block1Part, stk::topology::ELEM_RANK, 1);
736 test_entity_counts_in_parts(block1Part, stk::topology::NODE_RANK, 8);
737
738 test_entity_counts_in_parts(block2Part, stk::topology::ELEM_RANK, 1);
739 test_entity_counts_in_parts(block2Part, stk::topology::NODE_RANK, 8);
740 }
741
742 TEST_F(TestChangePartsWithSelector, element_in_ranked_part_add_new_ranked_part_non_batch)
743 {
744 if(get_bulk().parallel_size() > 1) { return; }
745
746 unsigned numBlockParts = 2;
747 unsigned numElem = 1;
748 stk::mesh::PartVector parts;
749 setup_n_ranked_parts_n_elements(numBlockParts, numElem, parts);
750
751 stk::mesh::Part* block1Part = parts[0];
752 stk::mesh::Part* block2Part = parts[1];
753
754 insert_into_add_part(block2Part);
755
756 change_entity_parts_with_selector(stk::mesh::Selector(*block1Part), stk::topology::ELEM_RANK);
757
758 test_entity_counts_in_parts(block1Part, stk::topology::ELEM_RANK, 1);
759 test_entity_counts_in_parts(block1Part, stk::topology::NODE_RANK, 8);
760
761 test_entity_counts_in_parts(block2Part, stk::topology::ELEM_RANK, 1);
762 test_entity_counts_in_parts(block2Part, stk::topology::NODE_RANK, 8);
763 }
764
765 TEST_F(TestChangePartsWithSelector, element_in_with_faces_ranked_part_add_new_ranked_part_remove_ranked_part)
766 {
767 if(get_bulk().parallel_size() > 1) { return; }
768
769 unsigned numBlockParts = 2;
770 unsigned numElem = 2;
771 stk::mesh::PartVector parts;
772 setup_n_ranked_parts_n_elements_with_faces(numBlockParts, numElem, parts);
773
774 stk::mesh::Part* block1Part = parts[0];
775 stk::mesh::Part* block2Part = parts[1];
776
777 insert_into_add_part(block2Part);
778 insert_into_remove_part(block1Part);
779
780 batch_change_entity_parts_with_selector(stk::mesh::Selector(*block1Part), stk::topology::ELEM_RANK);
781
782 test_entity_counts_in_parts(block1Part, stk::topology::ELEM_RANK, 0);
783 test_entity_counts_in_parts(block1Part, stk::topology::FACE_RANK, 0);
784 test_entity_counts_in_parts(block1Part, stk::topology::NODE_RANK, 0);
785
786 test_entity_counts_in_parts(block2Part, stk::topology::ELEM_RANK, 2);
787 test_entity_counts_in_parts(block2Part, stk::topology::FACE_RANK, 10);
788 test_entity_counts_in_parts(block2Part, stk::topology::NODE_RANK, 12);
789 }
790
791 TEST_F(TestChangePartsWithSelector, element_in_ranked_part_remove_ranked_part)
792 {
793 if(get_bulk().parallel_size() > 1) { return; }
794
795 unsigned numBlockParts = 2;
796 unsigned numElem = 1;
797 stk::mesh::PartVector parts;
798 setup_n_ranked_parts_n_elements(numBlockParts, numElem, parts);
799
800 stk::mesh::Part* block1Part = parts[0];
801 stk::mesh::Part* block2Part = parts[1];
802
803 {
804 insert_into_add_part(block2Part);
805
806 stk::mesh::EntityVector elements;
807 stk::mesh::get_entities(get_bulk(), stk::topology::ELEM_RANK, elements);
808 change_entity_parts(elements[0]);
809
810 test_entity_counts_in_parts(block1Part, stk::topology::ELEM_RANK, 1);
811 test_entity_counts_in_parts(block1Part, stk::topology::NODE_RANK, 8);
812
813 test_entity_counts_in_parts(block2Part, stk::topology::ELEM_RANK, 1);
814 test_entity_counts_in_parts(block2Part, stk::topology::NODE_RANK, 8);
815 }
816
817 insert_into_remove_part(block1Part);
818 batch_change_entity_parts_with_selector(stk::mesh::selectUnion(stk::mesh::PartVector{block1Part, block2Part}), stk::topology::ELEM_RANK);
819
820 test_entity_counts_in_parts(block1Part, stk::topology::ELEM_RANK, 0);
821 test_entity_counts_in_parts(block1Part, stk::topology::NODE_RANK, 0);
822
823 test_entity_counts_in_parts(block2Part, stk::topology::ELEM_RANK, 1);
824 test_entity_counts_in_parts(block2Part, stk::topology::NODE_RANK, 8);
825 }
826
827 TEST_F(TestChangePartsWithSelector, elements_in_different_ranked_parts_but_shared_nodes)
828 {
829 if(get_bulk().parallel_size() > 1) { return; }
830
831 unsigned numBlockParts = 2;
832 unsigned numElem = 2;
833 stk::mesh::PartVector parts;
834 setup_n_ranked_parts_n_elements(numBlockParts, numElem, parts);
835
836 stk::mesh::Part* block1Part = parts[0];
837 stk::mesh::Part* block2Part = parts[1];
838
839 {
840 stk::mesh::Entity elemToMove = get_bulk().get_entity(stk::topology::ELEM_RANK, 2u);
841 EXPECT_TRUE(get_bulk().is_valid(elemToMove));
842 insert_into_add_part(block2Part);
843 insert_into_remove_part(block1Part);
844 change_entity_parts(elemToMove);
845
846 test_entity_counts_in_parts(block1Part, stk::topology::ELEM_RANK, 1);
847 test_entity_counts_in_parts(block1Part, stk::topology::NODE_RANK, 8);
848
849 test_entity_counts_in_parts(block2Part, stk::topology::ELEM_RANK, 1);
850 test_entity_counts_in_parts(block2Part, stk::topology::NODE_RANK, 8);
851
852 const stk::mesh::BucketVector& nodeBucketsUnion = get_bulk().get_buckets(stk::topology::NODE_RANK, stk::mesh::selectUnion(parts));
853 EXPECT_EQ(3u, nodeBucketsUnion.size());
854
855 const stk::mesh::BucketVector& nodeBucketsIntersection = get_bulk().get_buckets(stk::topology::NODE_RANK, stk::mesh::selectIntersection(parts));
856 EXPECT_EQ(1u, nodeBucketsIntersection.size());
857 }
858
859 insert_into_add_part(block2Part);
860 insert_into_remove_part(block1Part);
861 batch_change_entity_parts_with_selector(stk::mesh::Selector(*block1Part), stk::topology::ELEM_RANK);
862
863 test_entity_counts_in_parts(block1Part, stk::topology::ELEM_RANK, 0);
864 test_entity_counts_in_parts(block1Part, stk::topology::NODE_RANK, 0);
865
866 test_entity_counts_in_parts(block2Part, stk::topology::ELEM_RANK, 2);
867 test_entity_counts_in_parts(block2Part, stk::topology::NODE_RANK, 12);
868 }
869
870 TEST_F(TestChangePartsWithSelector, element_in_ranked_part_add_new_to_ranked_part_no_conflicting_partitions)
871 {
872 if(get_bulk().parallel_size() > 1) { return; }
873
874 unsigned numBlockParts = 2;
875 unsigned numElem = 2;
876 stk::mesh::PartVector parts;
877 setup_n_ranked_parts_n_elements(numBlockParts, numElem, parts);
878
879 stk::mesh::Part* block1Part = parts[0];
880 stk::mesh::Part* block2Part = parts[1];
881
882 {
883 insert_into_add_part(block2Part);
884 insert_into_remove_part(block1Part);
885
886 stk::mesh::EntityVector elements;
887 stk::mesh::get_entities(get_bulk(), stk::topology::ELEM_RANK, elements);
888 change_entity_parts(elements[1]);
889
890 test_entity_counts_in_parts(block1Part, stk::topology::ELEM_RANK, 1);
891 test_entity_counts_in_parts(block1Part, stk::topology::NODE_RANK, 8);
892
893 test_entity_counts_in_parts(block2Part, stk::topology::ELEM_RANK, 1);
894 test_entity_counts_in_parts(block2Part, stk::topology::NODE_RANK, 8);
895
896 test_bucket_count(stk::topology::ELEM_RANK, 2u);
897 }
898
899 insert_into_add_part(block2Part);
900 batch_change_entity_parts_with_selector(stk::mesh::Selector(*block1Part), stk::topology::ELEM_RANK);
901
902 test_bucket_count(stk::topology::ELEM_RANK, 2u);
903
904 test_entity_counts_in_parts(block1Part, stk::topology::ELEM_RANK, 1);
905 test_entity_counts_in_parts(block1Part, stk::topology::NODE_RANK, 8);
906
907 test_entity_counts_in_parts(block2Part, stk::topology::ELEM_RANK, 2);
908 test_entity_counts_in_parts(block2Part, stk::topology::NODE_RANK, 12);
909 }
910
911 TEST_F(TestChangePartsWithSelector, element_in_ranked_part_move_to_unranked_part_conflicting_partitions)
912 {
913 if(get_bulk().parallel_size() > 1) { GTEST_SKIP(); }
914
915 unsigned numBlockParts = 2;
916 unsigned numElem = 2;
917 stk::mesh::PartVector parts;
918 setup_n_unranked_parts_n_elements(numBlockParts, numElem, parts);
919
920 stk::mesh::Part* block1Part = parts[0];
921 stk::mesh::Part* block2Part = parts[1];
922
923 {
924 insert_into_add_part(block2Part);
925 insert_into_remove_part(block1Part);
926
927 stk::mesh::EntityVector elements;
928 stk::mesh::get_entities(get_bulk(), stk::topology::ELEM_RANK, elements);
929 change_entity_parts(elements[1]);
930
931 test_entity_counts_in_parts(block1Part, stk::topology::ELEM_RANK, 1);
932 test_entity_counts_in_parts(block1Part, stk::topology::NODE_RANK, 8);
933
934 test_entity_counts_in_parts(block2Part, stk::topology::ELEM_RANK, 1);
935 test_entity_counts_in_parts(block2Part, stk::topology::NODE_RANK, 0);
936
937 test_bucket_count(stk::topology::ELEM_RANK, 2u);
938 }
939
940 insert_into_add_part(block2Part);
941 insert_into_remove_part(block1Part);
942 batch_change_entity_parts_with_selector(stk::mesh::Selector(*block1Part), stk::topology::ELEM_RANK);
943
944 test_entity_counts_in_parts(block1Part, stk::topology::ELEM_RANK, 0);
945 test_entity_counts_in_parts(block1Part, stk::topology::NODE_RANK, 0);
946
947 test_entity_counts_in_parts(block2Part, stk::topology::ELEM_RANK, 2);
948 test_entity_counts_in_parts(block2Part, stk::topology::NODE_RANK, 0);
949
950 test_bucket_count(stk::topology::ELEM_RANK, 2u);
951
952 const stk::mesh::BucketVector& buckets = get_bulk().buckets(stk::topology::ELEM_RANK);
953 test_partitions_equality(stk::topology::ELEM_RANK, buckets[0], buckets[1]);
954 }
955
956 TEST_F(TestChangePartsWithSelector, two_procs_with_different_selectors)
957 {
958 if(get_bulk().parallel_size() != 2) { return; }
959
960 unsigned numBlockParts = 2;
961 unsigned numElem = 2;
962 stk::mesh::PartVector parts;
963 setup_n_ranked_parts_n_elements(numBlockParts, numElem, parts);
964
965 stk::mesh::Part* block1Part = parts[0];
966 stk::mesh::Part* block2Part = parts[1];
967
968 insert_into_add_part(block2Part);
969 insert_into_remove_part(block1Part);
970
971 stk::mesh::EntityRank rank = stk::topology::ELEM_RANK;
972
973 if(get_bulk().parallel_rank() == 0) {
974 EXPECT_ANY_THROW(get_bulk().batch_change_entity_parts(stk::mesh::Selector(*block1Part), rank, addParts, removeParts));
975 } else {
976 EXPECT_ANY_THROW(get_bulk().batch_change_entity_parts(stk::mesh::Selector(*block2Part), rank, addParts, removeParts));
977 }
978 }
979
980 TEST_F(TestChangePartsWithSelector, two_procs_with_different_parts)
981 {
982 if(get_bulk().parallel_size() != 2) { return; }
983
984 unsigned numBlockParts = 3;
985 unsigned numElem = 2;
986 stk::mesh::PartVector parts;
987 setup_n_ranked_parts_n_elements(numBlockParts, numElem, parts);
988
989 stk::mesh::Part* block1Part = parts[0];
990 stk::mesh::Part* block2Part = parts[1];
991 stk::mesh::Part* block3Part = parts[2];
992
993 insert_into_remove_part(block1Part);
994 if(get_bulk().parallel_rank() == 0) {
995 insert_into_add_part(block2Part);
996 } else {
997 insert_into_add_part(block3Part);
998 }
999
1000 stk::mesh::EntityRank rank = stk::topology::ELEM_RANK;
1001 EXPECT_ANY_THROW(get_bulk().batch_change_entity_parts(stk::mesh::Selector(*block1Part), rank, addParts, removeParts));
1002 }
1003
1004 }