Debian Codegraph @

packages/stk/stk_unit_tests/stk_mesh/UnitTestTopology.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 <stddef.h> // for NULL
36 #include <stdexcept> // for runtime_error
37 #include <stk_mesh/base/BulkData.hpp> // for BulkData
38 #include <stk_mesh/base/FindPermutation.hpp>
39 #include <stk_mesh/base/Entity.hpp> // for Entity
40 #include <stk_mesh/base/FEMHelpers.hpp> // for declare_element, etc
41 #include <stk_mesh/base/MetaData.hpp> // for get_cell_topology, MetaData
42 #include <stk_util/parallel/Parallel.hpp> // for ParallelMachine
43 #include <gtest/gtest.h>
44 #include "stk_mesh/base/Types.hpp" // for EntityId, PartVector, etc
45 #include "stk_topology/topology.hpp" // for topology, etc
46 #include <stk_mesh/base/CreateFaces.hpp> // for create_faces
47 #include <stk_io/StkMeshIoBroker.hpp> // for StkMeshIoBroker
48 #include <stk_mesh/base/Comm.hpp>
49 #include <stk_mesh/baseImpl/MeshImplUtils.hpp>
50 #include <stk_mesh/baseImpl/MeshCommVerify.hpp>
51 #include <stk_unit_test_utils/ioUtils.hpp>
52 #include <stk_unit_test_utils/MeshFixture.hpp>
53 #include <stk_unit_test_utils/BuildMesh.hpp>
54
55 #include "stk_unit_test_utils/stk_mesh_fixtures/HexFixture.hpp" // for HexFixture
56 #include <stk_unit_test_utils/BulkDataTester.hpp>
57
58 namespace stk { namespace mesh { class Part; } }
59 namespace stk { namespace mesh { struct EntitySideComponent; } }
60
61 using stk::ParallelMachine;
62 using stk::mesh::MetaData;
63 using stk::mesh::BulkData;
64 using stk::mesh::Part;
65 using stk::mesh::PartVector;
66 using stk::mesh::EntityRank;
67 using stk::mesh::EntityId;
68 using stk::mesh::EntitySideComponent;
69 using stk::mesh::PairIterRelation;
70 using stk::mesh::Entity;
71 using stk::mesh::EntityRank;
72 using stk::unit_test_util::build_mesh;
73
74 class TopologyHelpersTestingFixture
75 {
76 public:
77 TopologyHelpersTestingFixture(ParallelMachine pm);
78 ~TopologyHelpersTestingFixture() {}
79
80 const int spatial_dimension;
81 std::shared_ptr<BulkData> bulkPtr;
82 BulkData& bulk;
83 MetaData& meta;
84 const EntityRank element_rank;
85 const EntityRank side_rank;
86 Part & generic_element_part;
87 Part & element_tet_part;
88 Part & element_wedge_part;
89 Part & element_hex_part;
90 Part & generic_face_part;
91 Part & another_generic_face_part;
92 Part & face_tri_part;
93 Part & face_quad_part;
94 Part & another_generic_element_part;
95
96 EntityId nextEntityId()
97 { return psize*(++entity_id)+prank; }
98
99 Entity create_entity( EntityRank rank, Part& part_membership)
100 {
101 PartVector part_intersection;
102 part_intersection.push_back ( &part_membership );
103 if (rank != meta.side_rank()) {
104 return bulk.declare_entity(rank, nextEntityId(), part_intersection);
105 }
106 return Entity();
107 }
108
109 private:
110 EntityId entity_id;
111 const int psize;
112 const int prank;
113 };
114
115 TopologyHelpersTestingFixture::TopologyHelpersTestingFixture(ParallelMachine pm)
116 : spatial_dimension( 3 ),
117 bulkPtr( build_mesh(3, pm, stk::mesh::BulkData::AUTO_AURA) ),
118 bulk( *bulkPtr ),
119 meta( bulkPtr->mesh_meta_data() ),
120 element_rank( stk::topology::ELEMENT_RANK ),
121 side_rank( meta.side_rank()),
122 generic_element_part( meta.declare_part("another part", element_rank ) ),
123 element_tet_part( meta.declare_part_with_topology( "block_left_1", stk::topology::TET_4 ) ),
124 element_wedge_part( meta.declare_part_with_topology( "block_left_2", stk::topology::WEDGE_15 ) ),
125 element_hex_part( meta.declare_part_with_topology( "block_left_3", stk::topology::HEX_8 ) ),
126 generic_face_part( meta.declare_part_with_topology( "A_1", stk::topology::QUAD_4 ) ),
127 another_generic_face_part( meta.declare_part("A_2", side_rank ) ),
128 face_tri_part( meta.declare_part_with_topology("A_3_0", stk::topology::TRI_3)),
129 face_quad_part( meta.declare_part("A_3", side_rank ) ),
130 another_generic_element_part( meta.declare_part("B_3", element_rank ) ),
131 entity_id(0u),
132 psize(bulk.parallel_size()),
133 prank(bulk.parallel_rank())
134 {
135 meta.commit();
136 }
137
138 namespace {
139
140 TEST( testTopologyHelpers, get_cell_topology_based_on_part)
141 {
142 TopologyHelpersTestingFixture fix(MPI_COMM_WORLD);
143 if (fix.bulk.parallel_size() != 1) {
144 return;
145 }
146
147 fix.bulk.modification_begin();
148 Entity elem1 = fix.create_entity( fix.element_rank, fix.element_hex_part );
149 std::vector<Entity> elem_node(8);
150 for (int i = 0; i < 8; ++i) {
151 elem_node[i] = fix.bulk.declare_node(100 + i);
152 fix.bulk.declare_relation(elem1, elem_node[i], i);
153 }
154
155 Entity side1 = fix.bulk.declare_element_side(elem1, 0, stk::mesh::ConstPartVector{&fix.generic_face_part});
156
157 PartVector tmp(1);
158 tmp[0] = & fix.face_quad_part;
159 fix.bulk.change_entity_parts ( side1 , tmp );
160 ASSERT_EQ( fix.bulk.bucket(side1).topology(), stk::topology::QUAD_4 );
161 fix.bulk.change_entity_parts ( side1 , tmp );
162 ASSERT_EQ( fix.bulk.bucket(side1).topology(), stk::topology::QUAD_4 );
163 tmp[0] = & fix.another_generic_face_part;
164 fix.bulk.change_entity_parts ( side1 , tmp );
165 ASSERT_EQ( fix.bulk.bucket(side1).topology(), stk::topology::QUAD_4 );
166 ASSERT_NE( fix.bulk.bucket(side1).topology(), stk::topology::WEDGE_15 );
167
168 fix.bulk.modification_end();
169 }
170
171 TEST( testTopologyHelpers, declare_element_side_no_topology )
172 {
173 // Coverage for declare_element_side - TopologyHelpers.cpp - "Cannot discern element topology"
174 TopologyHelpersTestingFixture fix(MPI_COMM_WORLD);
175
176 fix.bulk.modification_begin();
177 //fix.bulk.modification_end();
178
179
180 {
181 stk::mesh::EntityIdVector elem_node {1, 2, 3, 4};
182 //fix.bulk.modification_begin();
183 // Cannot declare an element without a topology defined
184 ASSERT_THROW(
185 stk::mesh::declare_element(fix.bulk, fix.generic_element_part, fix.nextEntityId(), elem_node),
186 std::runtime_error
187 );
188 }
189 }
190
191 TEST( testTopologyHelpers, declare_element_side_wrong_bulk_data)
192 {
193 // Coverage for verify_declare_element_side - in TopologyHelpers.cpp - "BulkData for 'elem' and 'side' are different"
194 TopologyHelpersTestingFixture fix1(MPI_COMM_WORLD);
195
196 fix1.bulk.modification_begin();
197
198 TopologyHelpersTestingFixture fix2(MPI_COMM_WORLD);
199 fix2.bulk.modification_begin();
200 fix2.bulk.modification_end();
201 }
202
203
204 TEST( testTopologyHelpers, declare_element_side_full )
205 {
206 // Go all way the through declare_element_side - use new element
207 TopologyHelpersTestingFixture fix(MPI_COMM_WORLD);
208
209 fix.bulk.modification_begin();
210
211 stk::mesh::EntityIdVector elem_node {1, 2, 3, 4};
212
213 Entity element = stk::mesh::declare_element(fix.bulk, fix.element_tet_part, fix.nextEntityId(), elem_node );
214
215 const EntityId zero_side_count = 0;
216 Entity face2 = fix.bulk.declare_element_side(element, zero_side_count, stk::mesh::PartVector{&fix.face_tri_part});
217 fix.bulk.modification_end();
218
219 const stk::mesh::ConnectedEntities rel2_nodes = fix.bulk.get_connected_entities(face2, stk::topology::NODE_RANK);
220 ASSERT_TRUE(rel2_nodes.size() != 0u);
221
222 ASSERT_TRUE( true ); // This test is to check compilation.
223 }
224
225 TEST( testTopologyHelpers, element_side_polarity_valid )
226 {
227 // Coverage of element_side_polarity in TopologyHelpers.cpp 168-181 and 200-215
228 TopologyHelpersTestingFixture fix(MPI_COMM_WORLD);
229 stk::mesh::EntityIdVector elem_node {1, 2, 3, 4};
230
231 fix.bulk.modification_begin();
232 Entity element = stk::mesh::declare_element(fix.bulk, fix.element_tet_part, fix.nextEntityId(), elem_node );
233 const EntityId zero_side_count = 0;
234 Entity face2 = fix.bulk.declare_element_side(element, zero_side_count, stk::mesh::PartVector{&fix.face_tri_part});
235 fix.bulk.modification_end();
236
237 const int local_side_id = 0;
238 ASSERT_TRUE( stk::mesh::element_side_polarity(fix.bulk, element, face2, local_side_id) );
239
240 }
241
242 TEST( testTopologyHelpers, element_side_polarity_invalid_1 )
243 {
244 TopologyHelpersTestingFixture fix(MPI_COMM_WORLD);
245 stk::mesh::EntityIdVector elem_node {1, 2, 3, 4};
246
247 // Coverage of element_side_polarity in TopologyHelpers.cpp
248 {
249 fix.bulk.modification_begin();
250 Entity element = stk::mesh::declare_element(fix.bulk, fix.element_tet_part, fix.nextEntityId(), elem_node );
251 const EntityId zero_side_count = 0;
252 Entity face = fix.bulk.declare_element_side(element, zero_side_count, stk::mesh::PartVector{&fix.face_tri_part});
253 fix.bulk.modification_end();
254
255 const unsigned invalid_local_side_id = static_cast<unsigned>(-1);
256 // Hits "Unsuported local_side_id" error condition:
257 ASSERT_THROW(
258 stk::mesh::element_side_polarity(fix.bulk, element, face, invalid_local_side_id),
259 std::runtime_error
260 );
261 }
262 }
263
264 TEST( testTopologyHelpers, element_side_polarity_invalid_2 )
265 {
266 TopologyHelpersTestingFixture fix(MPI_COMM_WORLD);
267 stk::mesh::EntityIdVector elem_node { 1, 2, 3, 4 };
268
269 // Coverage of element_side_polarity in TopologyHelpers.cpp
270 fix.bulk.modification_begin();
271
272 stk::mesh::ConstPartVector part_intersection;
273 part_intersection.push_back ( &fix.generic_element_part);
274 Entity element = fix.bulk.declare_element(fix.nextEntityId(), part_intersection);
275 ASSERT_TRUE( fix.bulk.bucket(element).topology() == stk::topology::INVALID_TOPOLOGY );
276
277 Entity element_with_top = stk::mesh::declare_element(fix.bulk, fix.element_tet_part, fix.nextEntityId(), elem_node );
278 ASSERT_TRUE( fix.bulk.bucket(element_with_top).topology() != stk::topology::INVALID_TOPOLOGY );
279
280 const EntityId zero_side_count = 0;
281 Entity face_with_top = fix.bulk.declare_element_side(element_with_top, zero_side_count, stk::mesh::PartVector{&fix.face_tri_part});
282 const int valid_local_side_id = 0;
283 ASSERT_THROW(
284 element_side_polarity(fix.bulk, element, face_with_top, valid_local_side_id),
285 std::runtime_error
286 );
287
288 //modification_end is not called due to difference in expected behavior for release and debug builds - debug should throw, release should not
289 //difference occurs within check_for_connected_nodes method
290 //ASSERT_THROW(fix.bulk.modification_end(), std::logic_error);
291
292 }
293
294 TEST(stk_topology_permutations, lexicographical_smallest_permutation_preserve_polarity)
295 {
296 {
297 stk::topology triangular_shell = stk::topology::SHELL_TRIANGLE_3;
298 unsigned shell_node_ids[3] = {10, 8, 12};
299 {
300 unsigned triangle_node_ids[3] = {12, 10, 8};
301
302 unsigned permutation_index = triangular_shell.lexicographical_smallest_permutation_preserve_polarity((unsigned*)triangle_node_ids, (unsigned*)shell_node_ids);
303 unsigned gold_lexicographical_smallest_permutation_index = 2;
304 // driven by vertices, NOT mid-edge nodes
305 EXPECT_EQ(gold_lexicographical_smallest_permutation_index, permutation_index);
306 }
307 {
308 unsigned triangle_node_ids[3] = {10, 8, 12};
309
310 unsigned permutation_index = triangular_shell.lexicographical_smallest_permutation_preserve_polarity((unsigned*)triangle_node_ids, (unsigned*)shell_node_ids);
311 unsigned gold_lexicographical_smallest_permutation_index = 2;
312 // driven by vertices, NOT mid-edge nodes
313 EXPECT_EQ(gold_lexicographical_smallest_permutation_index, permutation_index);
314 }
315 {
316 unsigned triangle_node_ids[3] = {8, 12, 10};
317
318 unsigned permutation_index = triangular_shell.lexicographical_smallest_permutation_preserve_polarity((unsigned*)triangle_node_ids, (unsigned*)shell_node_ids);
319 unsigned gold_lexicographical_smallest_permutation_index = 2;
320 // driven by vertices, NOT mid-edge nodes
321 EXPECT_EQ(gold_lexicographical_smallest_permutation_index, permutation_index);
322 }
323 {
324 unsigned triangle_node_ids[3] = {12, 8, 10};
325
326 unsigned permutation_index = triangular_shell.lexicographical_smallest_permutation_preserve_polarity((unsigned*)triangle_node_ids, (unsigned*)shell_node_ids);
327 unsigned gold_lexicographical_smallest_permutation_index = 5;
328 // driven by vertices, NOT mid-edge nodes
329 EXPECT_EQ(gold_lexicographical_smallest_permutation_index, permutation_index);
330 }
331 {
332 unsigned triangle_node_ids[3] = {10, 12, 8};
333
334 unsigned permutation_index = triangular_shell.lexicographical_smallest_permutation_preserve_polarity((unsigned*)triangle_node_ids, (unsigned*)shell_node_ids);
335 unsigned gold_lexicographical_smallest_permutation_index = 5;
336 // driven by vertices, NOT mid-edge nodes
337 EXPECT_EQ(gold_lexicographical_smallest_permutation_index, permutation_index);
338 }
339 {
340 unsigned triangle_node_ids[3] = {8, 10, 12};
341
342 unsigned permutation_index = triangular_shell.lexicographical_smallest_permutation_preserve_polarity((unsigned*)triangle_node_ids, (unsigned*)shell_node_ids);
343 unsigned gold_lexicographical_smallest_permutation_index = 5;
344 // driven by vertices, NOT mid-edge nodes
345 EXPECT_EQ(gold_lexicographical_smallest_permutation_index, permutation_index);
346 }
347 }
348 }
349
350 TEST(stk_topology_permutations, quad_lexicographical_smallest_permutation_preserve_polarity)
351 {
352 {
353 stk::topology quad_shell = stk::topology::SHELL_QUAD_4;
354 unsigned shell_node_ids[4] = {1, 2, 3, 4};
355 {
356 unsigned quad_node_ids[4] = {1, 2, 3, 4};
357
358 unsigned permutation_index = quad_shell.lexicographical_smallest_permutation_preserve_polarity((unsigned*)quad_node_ids, (unsigned*)shell_node_ids);
359 unsigned gold_lexicographical_smallest_permutation_index = 0;
360 // driven by vertices, NOT mid-edge nodes
361 EXPECT_EQ(gold_lexicographical_smallest_permutation_index, permutation_index);
362 }
363 {
364 unsigned quad_node_ids[4] = {4, 1, 2, 3};
365
366 unsigned permutation_index = quad_shell.lexicographical_smallest_permutation_preserve_polarity((unsigned*)quad_node_ids, (unsigned*)shell_node_ids);
367 unsigned gold_lexicographical_smallest_permutation_index = 0;
368 // driven by vertices, NOT mid-edge nodes
369 EXPECT_EQ(gold_lexicographical_smallest_permutation_index, permutation_index);
370 }
371 {
372 unsigned quad_node_ids[4] = {3, 4, 1, 2};
373
374 unsigned permutation_index = quad_shell.lexicographical_smallest_permutation_preserve_polarity((unsigned*)quad_node_ids, (unsigned*)shell_node_ids);
375 unsigned gold_lexicographical_smallest_permutation_index = 0;
376 // driven by vertices, NOT mid-edge nodes
377 EXPECT_EQ(gold_lexicographical_smallest_permutation_index, permutation_index);
378 }
379 {
380 unsigned quad_node_ids[4] = {2, 3, 4, 1};
381
382 unsigned permutation_index = quad_shell.lexicographical_smallest_permutation_preserve_polarity((unsigned*)quad_node_ids, (unsigned*)shell_node_ids);
383 unsigned gold_lexicographical_smallest_permutation_index = 0;
384 // driven by vertices, NOT mid-edge nodes
385 EXPECT_EQ(gold_lexicographical_smallest_permutation_index, permutation_index);
386 }
387 {
388 unsigned quad_node_ids[4] = {1, 4, 3, 2};
389
390 unsigned permutation_index = quad_shell.lexicographical_smallest_permutation_preserve_polarity((unsigned*)quad_node_ids, (unsigned*)shell_node_ids);
391 unsigned gold_lexicographical_smallest_permutation_index = 4;
392 // driven by vertices, NOT mid-edge nodes
393 EXPECT_EQ(gold_lexicographical_smallest_permutation_index, permutation_index);
394 }
395 {
396 unsigned quad_node_ids[4] = {2, 1, 4, 3};
397
398 unsigned permutation_index = quad_shell.lexicographical_smallest_permutation_preserve_polarity((unsigned*)quad_node_ids, (unsigned*)shell_node_ids);
399 unsigned gold_lexicographical_smallest_permutation_index = 4;
400 // driven by vertices, NOT mid-edge nodes
401 EXPECT_EQ(gold_lexicographical_smallest_permutation_index, permutation_index);
402 }
403 {
404 unsigned quad_node_ids[4] = {3, 2, 1, 4};
405
406 unsigned permutation_index = quad_shell.lexicographical_smallest_permutation_preserve_polarity((unsigned*)quad_node_ids, (unsigned*)shell_node_ids);
407 unsigned gold_lexicographical_smallest_permutation_index = 4;
408 // driven by vertices, NOT mid-edge nodes
409 EXPECT_EQ(gold_lexicographical_smallest_permutation_index, permutation_index);
410 }
411 {
412 unsigned quad_node_ids[4] = {4, 3, 2, 1};
413
414 unsigned permutation_index = quad_shell.lexicographical_smallest_permutation_preserve_polarity((unsigned*)quad_node_ids, (unsigned*)shell_node_ids);
415 unsigned gold_lexicographical_smallest_permutation_index = 4;
416 // driven by vertices, NOT mid-edge nodes
417 EXPECT_EQ(gold_lexicographical_smallest_permutation_index, permutation_index);
418 }
419 {
420 unsigned quad_node_ids[4] = {4, 2, 3, 1};
421
422 unsigned permutation_index = quad_shell.lexicographical_smallest_permutation_preserve_polarity((unsigned*)quad_node_ids, (unsigned*)shell_node_ids);
423 unsigned gold_lexicographical_smallest_permutation_index = 8;
424 // driven by vertices, NOT mid-edge nodes
425 EXPECT_EQ(gold_lexicographical_smallest_permutation_index, permutation_index);
426 }
427 }
428 }
429
430 int check_permutation_given(stk::mesh::BulkData& mesh, stk::mesh::Entity elem, unsigned face_ord, stk::mesh::Permutation claimed_permutation, stk::mesh::Entity elem_face)
431 {
432 stk::mesh::Entity face_nodes_buff[100], mapped_face_nodes_buff[100];
433
434 stk::topology elem_topo = mesh.bucket(elem).topology();
435 const stk::mesh::Entity* elem_nodes = mesh.begin_nodes(elem);
436
437 elem_topo.face_nodes(elem_nodes, face_ord, face_nodes_buff);
438 stk::topology face_topo = elem_topo.face_topology(face_ord);
439
440 stk::mesh::ConnectivityOrdinal const *face_ordinals_for_elem = mesh.begin_face_ordinals(elem);
441
442 const unsigned num_faces = mesh.num_faces(elem);
443 EXPECT_GT(num_faces, 0u);
444 unsigned face_idx;
445 for (face_idx = 0; face_idx < num_faces; ++face_idx)
446 {
447 if (face_ord == face_ordinals_for_elem[face_idx])
448 break;
449 }
450 EXPECT_LT(face_idx, num_faces);
451
452 stk::mesh::Permutation const *face_perms_for_elem = mesh.begin_face_permutations(elem);
453 stk::mesh::Permutation face_perm = face_perms_for_elem[face_idx];
454 face_topo.permutation_nodes(face_nodes_buff, face_perm, mapped_face_nodes_buff);
455
456 // Another way to get to face's nodes.
457 const stk::mesh::ConnectedEntities face_nodes = mesh.get_connected_entities(elem_face, stk::topology::NODE_RANK);
458 STK_ThrowAssert(face_nodes.size() == face_topo.num_nodes());
459
460 int innermost_hits = 0;
461 for (unsigned ni = 0; ni < face_topo.num_nodes(); ++ni)
462 {
463 ++innermost_hits;
464 EXPECT_EQ(face_nodes[ni], mapped_face_nodes_buff[ni]);
465 }
466
467 // Indeed, find_permutation computes what was stored!
468 stk::mesh::Permutation perm = stk::mesh::find_permutation(mesh, elem_topo, elem_nodes, face_topo, face_nodes.data(), face_ord);
469 EXPECT_EQ(perm, claimed_permutation);
470 return innermost_hits;
471 }
472
473 TEST (stkTopologyFunctions, use_permutations_Hex_2x1x1)
474 {
475 if (stk::parallel_machine_size(MPI_COMM_WORLD) == 1)
476 {
477 const size_t NX = 2;
478 const size_t NY = 1;
479 const size_t NZ = 1;
480
481 stk::mesh::fixtures::HexFixture fixture( MPI_COMM_WORLD, NX, NY, NZ);
482
483 fixture.m_meta.commit();
484 fixture.generate_mesh();
485
486 stk::mesh::BulkData &mesh = fixture.m_bulk_data;
487 stk::mesh::create_faces(mesh);
488
489 const std::vector<stk::mesh::Bucket *> &elem_buckets =
490 mesh.get_buckets(stk::topology::ELEMENT_RANK, fixture.m_meta.universal_part());
491
492 int innermost_hits = 0;
493 int num_elems = 0;
494
495 for (unsigned bkt_idx = 0; bkt_idx < elem_buckets.size(); ++bkt_idx)
496 {
497 const stk::mesh::Bucket &elem_bkt = *elem_buckets[bkt_idx];
498 stk::topology elem_topo = elem_bkt.topology();
499
500 unsigned num_faces = elem_topo.num_faces();
501
502 for (unsigned elem_idx = 0; elem_idx < elem_bkt.size(); ++elem_idx)
503 {
504 ++num_elems;
505
506 stk::mesh::Permutation const *elem_face_perms = elem_bkt.begin_face_permutations(elem_idx);
507 stk::mesh::Entity const *elem_faces = elem_bkt.begin_faces(elem_idx);
508
509 for (unsigned face_ord = 0; face_ord < num_faces; ++face_ord)
510 {
511 innermost_hits += check_permutation_given(mesh, elem_bkt[elem_idx], face_ord, elem_face_perms[face_ord], elem_faces[face_ord]);
512 }
513 }
514 }
515 std::ostringstream msg_buff;
516 msg_buff << "P" << mesh.parallel_rank() << ": knows " << num_elems << " elements" << std::endl;
517 std::cout << msg_buff.str();
518 EXPECT_EQ(innermost_hits, num_elems * 24);
519
520 if (num_elems > 0)
521 {
522 EXPECT_EQ(num_elems, 2);
523 }
524 }
525 }
526
527 void test_side_creation(unsigned *gold_side_ids,unsigned local_side_id)
528 {
529 stk::io::StkMeshIoBroker stkMeshIoBroker(MPI_COMM_WORLD);
530 std::string name = "generated:1x1x1";
531 stkMeshIoBroker.add_mesh_database(name, stk::io::READ_MESH);
532 stkMeshIoBroker.create_input_mesh();
533 stkMeshIoBroker.populate_bulk_data();
534
535 stk::mesh::BulkData &mesh = stkMeshIoBroker.bulk_data();
536
537 stk::mesh::Entity elem = mesh.get_entity(stk::topology::ELEM_RANK, 1);
538
539 mesh.modification_begin();
540 stk::mesh::Part &quad4_part = mesh.mesh_meta_data().get_topology_root_part(stk::topology::QUAD_4);
541 stk::mesh::Entity side = mesh.declare_element_side(elem, local_side_id, stk::mesh::PartVector{&quad4_part});
542 mesh.modification_end();
543
544 stk::mesh::Permutation identity_permutation = static_cast<stk::mesh::Permutation>(0);
545 check_permutation_given(mesh, elem, local_side_id, identity_permutation, side);
546
547 // std::string out_filename = "testStk.exo";
548 // size_t resultFileIndex = stkMeshIoBroker.create_output_mesh(out_filename, stk::io::WRITE_RESULTS);
549 // stkMeshIoBroker.write_output_mesh(resultFileIndex);
550
551 const stk::mesh::Entity *side_nodes = mesh.begin_nodes(side);
552 unsigned num_nodes = mesh.num_nodes(side);
553 ASSERT_EQ(4u, num_nodes);
554
555 for(unsigned i = 0; i < num_nodes; ++i)
556 {
557 EXPECT_EQ(gold_side_ids[i], mesh.identifier(side_nodes[i]));
558 }
559 }
560
561 void test_side_creation_with_permutation(unsigned *gold_side_ids,unsigned local_side_id, stk::mesh::Permutation perm)
562 {
563 stk::io::StkMeshIoBroker stkMeshIoBroker(MPI_COMM_WORLD);
564 std::string name = "generated:1x1x1";
565 stkMeshIoBroker.add_mesh_database(name, stk::io::READ_MESH);
566 stkMeshIoBroker.create_input_mesh();
567 stkMeshIoBroker.populate_bulk_data();
568
569 stk::mesh::BulkData &mesh = stkMeshIoBroker.bulk_data();
570
571 stk::mesh::Entity elem = mesh.get_entity(stk::topology::ELEM_RANK, 1);
572
573 stk::mesh::PartVector parts;
574 parts.push_back(&mesh.mesh_meta_data().get_topology_root_part(stk::topology::QUAD_4));
575 unsigned gold_num_nodes = 4;
576 stk::mesh::EntityVector nodes(gold_num_nodes);
577 for(unsigned i = 0; i < gold_num_nodes; ++i) {
578 stk::mesh::Entity node = mesh.get_entity(stk::topology::NODE_RANK, gold_side_ids[i]);
579 nodes[i] = node;
580 }
581
582 mesh.modification_begin();
583 stk::mesh::Entity side = mesh.declare_element_side(elem, local_side_id, parts);
584 mesh.modification_end();
585
586 check_permutation_given(mesh, elem, local_side_id, perm, side);
587
588 const stk::mesh::Entity *side_nodes = mesh.begin_nodes(side);
589 unsigned num_nodes = mesh.num_nodes(side);
590 ASSERT_EQ(gold_num_nodes, num_nodes);
591
592 for(unsigned i = 0; i < num_nodes; ++i)
593 {
594 //unsigned ordinal = nodes.size() - i - 1;
595 EXPECT_EQ(gold_side_ids[i], mesh.identifier(side_nodes[i]));
596 }
597 }
598
599 TEST(stkTopologyFunctions, check_permutation_with_FEM_Helper)
600 {
601 if (stk::parallel_machine_size(MPI_COMM_WORLD) == 1)
602 {
603 unsigned gold_side_ids[6][4] = {
604 {1,2,6,5},
605 {2,4,8,6},
606 {4,3,7,8},
607 {1,5,7,3},
608 {1,3,4,2},
609 {5,6,8,7}
610 };
611
612 for(unsigned local_side_id = 0; local_side_id < 6; ++local_side_id)
613 {
614 test_side_creation(gold_side_ids[local_side_id],local_side_id);
615 }
616 }
617 }
618
619 TEST(stkTopologyFunctions, check_permutation_without_FEM_Helper)
620 {
621 if (stk::parallel_machine_size(MPI_COMM_WORLD) == 1)
622 {
623 unsigned gold_side_ids[6][4] = {
624 {1,2,6,5},
625 {2,4,8,6},
626 {4,3,7,8},
627 {1,5,7,3},
628 {1,3,4,2},
629 {5,6,8,7}
630 };
631 stk::mesh::Permutation perm = static_cast<stk::mesh::Permutation>(0);
632 unsigned local_side_id = 0;
633 test_side_creation_with_permutation(gold_side_ids[local_side_id],local_side_id, perm);
634 }
635 }
636
637 TEST(stkTopologyFunctions, check_permutations_for_Hex_1x1x1)
638 {
639 if (stk::parallel_machine_size(MPI_COMM_WORLD) == 1)
640 {
641 unsigned gold_side_ids[4] = {5,6,8,7};
642 unsigned local_side_id = 5; // nodes 2,4,8,5 are nodes of face 'local_side_id' of a 1x1x1 hex element (generated)
643
644 unsigned gold_permutations[8][4] = {
645 {5,6,8,7},
646 {7,5,6,8},
647 {8,7,5,6},
648 {6,8,7,5},
649 {5,7,8,6},
650 {7,8,6,5},
651 {8,6,5,7},
652 {6,5,7,8}
653 };
654
655 stk::io::StkMeshIoBroker stkMeshIoBroker(MPI_COMM_WORLD);
656 std::string name = "generated:1x1x1";
657 stkMeshIoBroker.add_mesh_database(name, stk::io::READ_MESH);
658 stkMeshIoBroker.create_input_mesh();
659 stkMeshIoBroker.populate_bulk_data();
660
661 stk::mesh::BulkData &mesh = stkMeshIoBroker.bulk_data();
662
663 stk::mesh::Entity elem = mesh.get_entity(stk::topology::ELEM_RANK, 1);
664
665 stk::mesh::PartVector parts;
666 parts.push_back(&mesh.mesh_meta_data().get_topology_root_part(stk::topology::QUAD_4));
667 unsigned gold_num_nodes = 4;
668 stk::mesh::EntityVector nodes(gold_num_nodes);
669 for(unsigned i = 0; i < gold_num_nodes; ++i) {
670 stk::mesh::Entity node = mesh.get_entity(stk::topology::NODE_RANK, gold_side_ids[i]);
671 nodes[i] = node;
672 }
673
674 mesh.modification_begin();
675 stk::mesh::Entity side = mesh.declare_element_side(elem, local_side_id, parts);
676 mesh.modification_end();
677
678 stk::mesh::EntityVector mapped_face_nodes(gold_num_nodes);
679
680 stk::topology elem_topo = mesh.bucket(elem).topology();
681 const stk::mesh::Entity* face_nodes = mesh.begin_nodes(side);
682
683 stk::topology face_topo = elem_topo.face_topology(local_side_id);
684 unsigned num_permutations = face_topo.num_permutations();
685 for(unsigned i = 0; i < num_permutations; ++i) {
686 stk::mesh::Permutation local_perm = static_cast<stk::mesh::Permutation>(i);
687 face_topo.permutation_nodes(face_nodes, local_perm, &mapped_face_nodes[0]);
688
689 for (unsigned j = 0; j < gold_num_nodes; ++j) {
690 EXPECT_EQ(gold_permutations[i][j], mesh.identifier(mapped_face_nodes[j])) << " for permutation " << i;
691 }
692 }
693 }
694 }
695
696 void pack_downward_relations_for_entity(stk::mesh::BulkData& mesh, stk::mesh::Entity some_entity, std::vector<stk::mesh::Relation>& recv_relations1)
697 {
698 unsigned bucket_ordinal = mesh.bucket_ordinal(some_entity);
699 const stk::mesh::Bucket& bucket = mesh.bucket(some_entity);
700 for(EntityRank irank=stk::topology::BEGIN_RANK; irank<mesh.entity_rank(some_entity);++irank)
701 {
702 Entity const *rels_itr = bucket.begin(bucket_ordinal, irank);
703 Entity const *rels_end = bucket.end(bucket_ordinal, irank);
704 stk::mesh::ConnectivityOrdinal const *ords_itr = bucket.begin_ordinals(bucket_ordinal, irank);
705
706 for(;rels_itr!=rels_end;++rels_itr,++ords_itr)
707 {
708 recv_relations1.push_back(stk::mesh::Relation(*rels_itr, mesh.entity_rank(*rels_itr), *ords_itr));
709 }
710
711 }
712 }
713
714 TEST(stkTopologyFunctions, permutation_consistency_check_3d)
715 {
716 if (stk::parallel_machine_size(MPI_COMM_WORLD) == 1)
717 {
718 unsigned gold_side_ids[4] = {2,4,8,6};
719 unsigned local_side_id = 1; // nodes 2,4,8,5 are nodes of face 'local_side_id' of a 1x1x1 hex element (generated)
720
721 stk::io::StkMeshIoBroker stkMeshIoBroker(MPI_COMM_WORLD);
722 std::string name = "generated:1x1x1";
723 stkMeshIoBroker.add_mesh_database(name, stk::io::READ_MESH);
724 stkMeshIoBroker.create_input_mesh();
725 stkMeshIoBroker.populate_bulk_data();
726
727 stk::mesh::BulkData &mesh = stkMeshIoBroker.bulk_data();
728
729 stk::mesh::Entity elem = mesh.get_entity(stk::topology::ELEM_RANK, 1);
730
731 stk::mesh::PartVector parts;
732 parts.push_back(&mesh.mesh_meta_data().get_topology_root_part(stk::topology::QUAD_4));
733 unsigned gold_num_nodes = 4;
734 stk::mesh::EntityVector nodes(gold_num_nodes);
735 for(unsigned i = 0; i < gold_num_nodes; ++i) {
736 stk::mesh::Entity node = mesh.get_entity(stk::topology::NODE_RANK, gold_side_ids[i]);
737 nodes[i] = node;
738 }
739
740 mesh.modification_begin();
741 stk::mesh::Entity side = mesh.declare_element_side(elem, local_side_id, parts);
742 mesh.modification_end();
743
744 bool rel_bad = false;
745
746 std::vector<stk::mesh::Relation> recv_relations;
747 pack_downward_relations_for_entity(mesh, side, recv_relations);
748 stk::mesh::impl::unpack_not_owned_verify_compare_closure_relations(mesh, side, recv_relations, rel_bad);
749 EXPECT_FALSE(rel_bad);
750
751 std::vector<stk::mesh::Relation> relations;
752 pack_downward_relations_for_entity(mesh, elem, relations);
753 stk::mesh::impl::unpack_not_owned_verify_compare_closure_relations(mesh, elem, relations, rel_bad);
754 EXPECT_FALSE(rel_bad);
755 }
756 }
757
758 TEST(stkTopologyFunctions, check_permutation_consistency_parallel)
759 {
760 if (stk::parallel_machine_size(MPI_COMM_WORLD) == 2)
761 {
762 unsigned gold_side_ids[4] = {5,6,8,7};
763
764 stk::mesh::MetaData meta(3);
765 stk::unit_test_util::BulkDataFaceSharingTester mesh(meta, MPI_COMM_WORLD);
766
767 const std::string generatedMeshSpec = "generated:1x1x2";
768 stk::io::fill_mesh(generatedMeshSpec, mesh);
769
770 unsigned elem_id = 0;
771 unsigned local_side_id = 0;
772
773 if (mesh.parallel_rank()==0)
774 {
775 local_side_id=5;
776 elem_id = 1;
777 }
778 else
779 {
780 local_side_id=4;
781 elem_id = 2;
782 }
783
784 stk::mesh::Entity elem = mesh.get_entity(stk::topology::ELEM_RANK, elem_id);
785 EXPECT_TRUE(mesh.bucket(elem).owned());
786
787 stk::mesh::PartVector parts;
788 parts.push_back(&mesh.mesh_meta_data().get_topology_root_part(stk::topology::QUAD_4));
789 unsigned gold_num_nodes = 4;
790 stk::mesh::EntityVector nodes(gold_num_nodes);
791 for(unsigned i = 0; i < gold_num_nodes; ++i) {
792 stk::mesh::Entity node = mesh.get_entity(stk::topology::NODE_RANK, gold_side_ids[i]);
793 nodes[i] = node;
794 }
795
796 mesh.modification_begin();
797 mesh.declare_element_side(elem, local_side_id, parts);
798 mesh.modification_end();
799
800 std::vector<size_t> mesh_counts;
801 stk::mesh::comm_mesh_counts(mesh, mesh_counts);
802 size_t numFacesGlobal = 1u;
803 EXPECT_EQ(numFacesGlobal, mesh_counts[stk::topology::FACE_RANK]);
804 }
805 }
806
807 TEST(stkTopologyFunctions, permutation_consistency_check_2d)
808 {
809 if (stk::parallel_machine_size(MPI_COMM_WORLD) == 1)
810 {
811 std::shared_ptr<stk::mesh::BulkData> bulkPtr = build_mesh(2, MPI_COMM_WORLD);
812 stk::mesh::MetaData& meta = bulkPtr->mesh_meta_data();
813 stk::mesh::BulkData& mesh = *bulkPtr;
814
815 mesh.modification_begin();
816 stk::mesh::Entity Quad9 = mesh.declare_element(1, stk::mesh::ConstPartVector{&meta.get_topology_root_part(stk::topology::QUAD_9_2D)});
817 unsigned node_ids[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
818
819 stk::mesh::EntityVector nodes(9);
820 for(unsigned i=0;i<9;++i)
821 {
822 nodes[i] = mesh.declare_node(node_ids[i]);
823 }
824
825 for(size_t i=0;i<nodes.size();++i)
826 {
827 mesh.declare_relation(Quad9, nodes[i], i);
828 }
829
830 mesh.modification_end();
831
832 mesh.modification_begin();
833
834 stk::mesh::EntityVector sides(4);
835 stk::mesh::Permutation perm = static_cast<stk::mesh::Permutation>(0);
836 for(size_t i=0;i<sides.size();++i)
837 {
838 sides[i] = mesh.declare_element_side(Quad9, i, stk::mesh::ConstPartVector{&meta.get_topology_root_part(stk::topology::LINE_3)});
839 }
840
841 EXPECT_NO_THROW(mesh.modification_end());
842
843 EXPECT_TRUE(stk::mesh::check_permutation(mesh, Quad9, sides[0], 0, perm)) << "for side 0";
844 EXPECT_TRUE(stk::mesh::check_permutation(mesh, Quad9, sides[1], 1, perm)) << "for side 1";
845 EXPECT_TRUE(stk::mesh::check_permutation(mesh, Quad9, sides[2], 2, perm)) << "for side 2";
846 EXPECT_TRUE(stk::mesh::check_permutation(mesh, Quad9, sides[3], 3, perm)) << "for side 3";
847
848 EXPECT_TRUE(stk::mesh::impl::check_permutations_on_all(mesh));
849 }
850 }
851
852 struct SuperTopologySideData
853 {
854 stk::mesh::EntityIdVector elemIDsPerProc;
855 std::vector<stk::mesh::EntityIdVector> nodeIDsPerProc;
856 stk::mesh::EntityIdVector sharedNodeIds;
857 stk::mesh::EntityId sharedFaceId;
858 std::vector<stk::mesh::ConnectivityOrdinal> ordinalPerProc;
859 std::vector<stk::mesh::Permutation> permPerProc;
860 };
861
862 class SuperTopologies : public stk::unit_test_util::MeshFixture
863 {
864 protected:
865 SuperTopologies(int dim)
866 : stk::unit_test_util::MeshFixture(dim)
867 {
868 }
869
870 void expect_mesh_correct(stk::topology superElem, stk::topology superSide, const SuperTopologySideData &s)
871 {
872 expect_entity_has_topology(stk::topology::ELEM_RANK, s.elemIDsPerProc[0], superElem);
873 expect_entity_has_topology(stk::topology::ELEM_RANK, s.elemIDsPerProc[1], superElem);
874 expect_entity_has_topology(get_meta().side_rank(), s.sharedFaceId, superSide);
875 expect_elem_to_side_connections(superSide, s.elemIDsPerProc[0], s.ordinalPerProc[0], s.permPerProc[0]);
876 expect_elem_to_side_connections(superSide, s.elemIDsPerProc[1], s.ordinalPerProc[1], s.permPerProc[1]);
877 }
878
879 void expect_entity_has_topology(stk::mesh::EntityRank rank, stk::mesh::EntityId id, stk::topology topo)
880 {
881 stk::mesh::Entity entity = get_bulk().get_entity(rank, id);
882 EXPECT_EQ(topo, get_bulk().bucket(entity).topology());
883 EXPECT_EQ(topo.num_nodes(), get_bulk().num_nodes(entity));
884 }
885
886 void expect_elem_to_side_connections(stk::topology superSide,
887 stk::mesh::EntityId elemId,
888 stk::mesh::ConnectivityOrdinal expectedOrdinal,
889 stk::mesh::Permutation expectedPerm)
890 {
891 stk::mesh::Entity elem = get_bulk().get_entity(stk::topology::ELEM_RANK, elemId);
892 unsigned numSides = get_bulk().num_sides(elem);
893 EXPECT_EQ(1u, numSides);
894 const stk::mesh::Entity side = *get_bulk().begin(elem, get_meta().side_rank());
895 EXPECT_EQ(superSide, get_bulk().bucket(side).topology());
896 EXPECT_EQ(superSide.num_nodes(), get_bulk().num_nodes(side));
897 const stk::mesh::ConnectivityOrdinal elemSide = *get_bulk().begin_ordinals(elem, get_meta().side_rank());
898 EXPECT_EQ(expectedOrdinal, elemSide);
899 const stk::mesh::Permutation perm = *get_bulk().begin_permutations(elem, get_meta().side_rank());
900 EXPECT_EQ(expectedPerm, perm);
901 }
902 void create_mesh(stk::topology superElem, stk::topology superSide, const SuperTopologySideData &s)
903 {
904 setup_empty_mesh(stk::mesh::BulkData::AUTO_AURA);
905 int procId = get_bulk().parallel_rank();
906 stk::mesh::PartVector parts = {&get_meta().declare_part_with_topology("superElempart",superElem)};
907 stk::mesh::PartVector sideParts = {&get_meta().declare_part_with_topology("superSidepart",superSide)};
908
909 get_bulk().modification_begin();
910 stk::mesh::declare_element(get_bulk(), parts, s.elemIDsPerProc[procId], s.nodeIDsPerProc[procId]);
911 add_shared_nodes(s.sharedNodeIds);
912 get_bulk().modification_end();
913 create_sides(superSide, sideParts, s);
914 }
915
916 void create_sides(stk::topology /*superSide*/, const stk::mesh::PartVector& parts, const SuperTopologySideData &s)
917 {
918 get_bulk().modification_begin();
919 stk::mesh::Entity side = get_bulk().declare_solo_side(s.sharedFaceId, parts);
920 for(unsigned i=0; i<s.sharedNodeIds.size(); ++i) {
921 stk::mesh::Entity node = get_bulk().get_entity(stk::topology::NODE_RANK, s.sharedNodeIds[i]);
922 get_bulk().declare_relation(side, node, i);
923 }
924
925 int procId = get_bulk().parallel_rank();
926 stk::mesh::Entity elem = get_bulk().get_entity(stk::topology::ELEM_RANK, s.elemIDsPerProc[procId]);
927 get_bulk().declare_relation(elem, side, s.ordinalPerProc[procId], s.permPerProc[procId]);
928 get_bulk().modification_end();
929 }
930
931 void add_shared_nodes(const stk::mesh::EntityIdVector &sharedNodeIds)
932 {
933 int otherProc = 1-get_bulk().parallel_rank();
934 for(stk::mesh::EntityId nodeId : sharedNodeIds) {
935 stk::mesh::Entity node = get_bulk().get_entity(stk::topology::NODE_RANK, nodeId);
936 get_bulk().add_node_sharing(node, otherProc);
937 }
938 }
939
940 };
941
942 class SuperTopologies3d : public SuperTopologies
943 {
944 protected:
945 SuperTopologies3d() : SuperTopologies(3)
946 {
947 superTopo3d.elemIDsPerProc = {1, 2};
948 superTopo3d.nodeIDsPerProc = { {1, 2, 3, 4, 5, 6, 7, 8}, {5, 6, 7, 8, 9, 10, 11, 12} };
949 superTopo3d.sharedNodeIds = {5, 6, 7, 8};
950 superTopo3d.sharedFaceId = 1;
951 superTopo3d.ordinalPerProc = {stk::mesh::ConnectivityOrdinal(4), stk::mesh::ConnectivityOrdinal(5)};
952 superTopo3d.permPerProc = {stk::mesh::Permutation(0), stk::mesh::Permutation(4)};
953 }
954 struct SuperTopologySideData superTopo3d;
955 };
956
957 TEST_F(SuperTopologies3d, twoElemsTwoProcs)
958 {
959 if (stk::parallel_machine_size(MPI_COMM_WORLD) == 2) {
960 stk::topology super8 = stk::create_superelement_topology(8);
961 stk::topology superface4 = stk::create_superface_topology(4);
962 create_mesh(super8, superface4, superTopo3d);
963 expect_mesh_correct(super8, superface4, superTopo3d);
964 }
965 }
966
967 TEST_F(SuperTopologies3d, twoElemsTwoProcsElemGraph)
968 {
969 if (stk::parallel_machine_size(MPI_COMM_WORLD) == 2) {
970 stk::topology super8 = stk::create_superelement_topology(8);
971 stk::topology superface4 = stk::create_superface_topology(4);
972 create_mesh(super8, superface4, superTopo3d);
973 stk::mesh::ElemElemGraph elemGraph(get_bulk());
974 EXPECT_EQ(0u, elemGraph.num_edges());
975 EXPECT_EQ(0u, elemGraph.num_parallel_edges());
976 }
977 }
978
979 class SuperTopologies2d : public SuperTopologies
980 {
981 protected:
982 SuperTopologies2d() : SuperTopologies(2)
983 {
984 superTopo2d.elemIDsPerProc = {1, 2};
985 superTopo2d.nodeIDsPerProc = { {1, 2, 3, 4}, {4, 3, 5, 6} };
986 superTopo2d.sharedNodeIds = {3, 4};
987 superTopo2d.sharedFaceId = 1;
988 superTopo2d.ordinalPerProc = {stk::mesh::ConnectivityOrdinal(3), stk::mesh::ConnectivityOrdinal(0)};
989 superTopo2d.permPerProc = {stk::mesh::Permutation(0), stk::mesh::Permutation(1)};
990 }
991 struct SuperTopologySideData superTopo2d;
992 };
993
994 TEST_F(SuperTopologies2d, twoElemsTwoProcs)
995 {
996 if (stk::parallel_machine_size(MPI_COMM_WORLD) == 2) {
997 stk::topology superElem4 = stk::create_superelement_topology(4);
998 stk::topology superEdge2 = stk::create_superedge_topology(2);
999 create_mesh(superElem4, superEdge2, superTopo2d);
1000 expect_mesh_correct(superElem4, superEdge2, superTopo2d);
1001 }
1002 }
1003
1004 }
1005