https://mooseframework.inl.gov
Loading...
Searching...
No Matches
BreakMeshByBlockGenerator.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
11#include "CastUniquePointer.h"
12#include "MooseMeshUtils.h"
13
14#include "libmesh/distributed_mesh.h"
15#include "libmesh/elem.h"
16#include "libmesh/partitioner.h"
17#include "timpi/parallel_sync.h"
18
20
23{
26 "Break the mesh at interfaces between blocks. New nodes will be generated so elements on "
27 "each side of the break are no longer connected.");
28
29 params.addRequiredParam<MeshGeneratorName>("input", "The mesh we want to modify");
30
31 for (const auto & name :
32 {"split_interface", "add_interface_on_two_sides", "split_transition_interface"})
33 params.addDeprecatedParam<bool>(
34 name,
35 "Interfaces are always created on both sides and split by block pairs.",
36 "Remove this parameter. Interfaces are always created on both sides with separate "
37 "block-pair boundary names and IDs; false is no longer supported.");
38 params.addParam<std::vector<SubdomainName>>(
39 "surrounding_blocks",
40 "The list of subdomain names surrounding which interfaces will be generated.");
41 params.addParam<std::vector<std::vector<SubdomainName>>>(
42 "block_pairs", "The list of subdomain pairs between which interfaces will be generated.");
43 params.addRelationshipManager("ElementSideNeighborLayers",
45 [](const InputParameters &, InputParameters & rm_params)
46 { rm_params.set<unsigned short>("layers") = 1; });
47
48 return params;
49}
50
52 : MeshGenerator(parameters),
53 _input(getMesh("input")),
54 _block_pairs_restricted(parameters.isParamSetByUser("block_pairs")),
55 _surrounding_blocks_restricted(parameters.isParamSetByUser("surrounding_blocks"))
56{
57 for (const auto & name :
58 {"split_interface", "add_interface_on_two_sides", "split_transition_interface"})
59 if (isParamValid(name) && !getParam<bool>(name))
61 "Setting ",
62 name,
63 "=false is no longer supported. Interfaces must be created on both sides with "
64 "separate block-pair boundary names and IDs to support distributed-mesh disjoint "
65 "neighbor pairs and avoid merging both directions into one boundary for interface "
66 "kernels. Remove this parameter.");
67
69 paramError("block_pairs_restricted",
70 "BreakMeshByBlockGenerator: 'surrounding_blocks' and 'block_pairs' can not be used "
71 "at the same time.");
72}
73
74BoundaryName
76 subdomain_id_type primaryBlockID,
77 subdomain_id_type secondaryBlockID)
78{
79 std::string primary_block_name = mesh.subdomain_name(primaryBlockID);
80 std::string secondary_block_name = mesh.subdomain_name(secondaryBlockID);
81 if (primary_block_name.empty())
82 primary_block_name = "Block" + std::to_string(primaryBlockID);
83 if (secondary_block_name.empty())
84 secondary_block_name = "Block" + std::to_string(secondaryBlockID);
85
86 return primary_block_name + "_" + secondary_block_name;
87}
88
89void
91 const std::string & boundaryName)
92{
93 _bName_bID_set.insert(std::pair<std::string, int>(boundaryName, boundaryID));
94}
95
96void
98 subdomain_id_type primaryBlockID,
99 subdomain_id_type secondaryBlockID,
100 BoundaryName & boundaryName,
101 boundary_id_type boundaryID,
102 BoundaryInfo & boundary_info)
103{
104 boundaryName = generateBoundaryName(mesh, primaryBlockID, secondaryBlockID);
105
106 // check if the boundary name already exist
107 bool checkBoundaryAlreadyExist = false;
108 for (auto b : _bName_bID_set)
109 {
110 if (b.first.compare(boundaryName) == 0)
111 {
112 mooseAssert(boundaryID == b.second, "Boundary with two inconsistent ids");
113 checkBoundaryAlreadyExist = true;
114 }
115 }
116
117 if (checkBoundaryAlreadyExist)
118 return;
119 else
120 {
121 mapBoundaryIdAndBoundaryName(boundaryID, boundaryName);
122
123 boundary_info.sideset_name(boundaryID) = boundaryName;
124
125 return;
126 }
127}
128
129std::unique_ptr<MeshBase>
131{
132 std::unique_ptr<MeshBase> mesh = std::move(_input);
133
134 // Make sure subdomain caches are up to date
135 if (!mesh->preparation().has_cached_elem_data)
136 mesh->cache_elem_data();
137
138 // Max node id is used later to generate new unique node IDs
139 auto max_node_id = mesh->max_node_id();
140 // If the mesh is prepared, max_node_id is already the same on all processors so do not need to
141 // communicate.
142 if (!mesh->is_replicated() && !mesh->is_prepared())
143 mesh->comm().max(max_node_id);
144#if LIBMESH_ENABLE_UNIQUE_ID
145 const auto max_unique_id = mesh->parallel_max_unique_id();
146#endif
147
148 BoundaryInfo & boundary_info = mesh->get_boundary_info();
149
150 // Handle block restrictions
152 {
153 for (const auto & block_name_pair :
154 getParam<std::vector<std::vector<SubdomainName>>>("block_pairs"))
155 {
156 if (block_name_pair.size() != 2)
157 paramError("block_pairs",
158 "Each row of 'block_pairs' must have a size of two (block names).");
159
160 // check that the blocks exist in the mesh
161 for (const auto & name : block_name_pair)
163 paramError("block_pairs", "The block '", name, "' was not found in the mesh");
164
165 const auto block_pair = MooseMeshUtils::getSubdomainIDs(*mesh, block_name_pair);
166 std::pair<SubdomainID, SubdomainID> pair = std::make_pair(
167 std::min(block_pair[0], block_pair[1]), std::max(block_pair[0], block_pair[1]));
168
169 _block_pairs.insert(pair);
170 // Insert all SubdomainIDs from block_pair into _block_set (duplicates automatically
171 // ignored)
172 std::copy(block_pair.begin(), block_pair.end(), std::inserter(_block_set, _block_set.end()));
173 }
174 }
176 {
177 // check that the blocks exist in the mesh
178 for (const auto & name : getParam<std::vector<SubdomainName>>("surrounding_blocks"))
180 paramError("surrounding_blocks", "The block '", name, "' was not found in the mesh");
181
182 const auto surrounding_block_ids = MooseMeshUtils::getSubdomainIDs(
183 *mesh, getParam<std::vector<SubdomainName>>("surrounding_blocks"));
184 std::copy(surrounding_block_ids.begin(),
185 surrounding_block_ids.end(),
186 std::inserter(_block_set, _block_set.end()));
187 }
188
189 // initialize the node to element map
190 std::unordered_map<dof_id_type, std::vector<dof_id_type>> node_to_elem_map;
191 for (const auto & elem : mesh->active_element_ptr_range())
192 for (const auto n : make_range(elem->n_nodes()))
193 node_to_elem_map[elem->node_id(n)].push_back(elem->id());
194
195 // Sync connected block info across all ranks
196 // a map from a node id to the set of connected block ids
197 const auto nodeid_to_connected_blocks = syncConnectedBlocks(node_to_elem_map, *mesh);
198
199 // Main loop to duplicate nodes
200 for (const auto & [current_node_id, connected_elems] : node_to_elem_map)
201 {
202 const auto * current_node = mesh->node_ptr(current_node_id);
203 if (!current_node)
204 continue;
205
206 // If the node is not connected to any blocks, skip it
207 auto it = nodeid_to_connected_blocks.find(current_node_id);
208 if (it == nodeid_to_connected_blocks.end())
209 continue;
210
211 // Get the set of blocks connected to the current node.
212 // Make a local copy because we'll modify it (e.g., erase Elem::invalid_subdomain_id).
213 // Preserve the original map's information (including invalid_subdomain_id) for global
214 // synchronization/logic, but operate on the copy for duplication decisions.
215 auto connected_blocks = it->second;
216
217 // Remove invalid subdomain if block pairs restriction is active
219 connected_blocks.erase(Elem::invalid_subdomain_id);
220
221 const unsigned int node_multiplicity = connected_blocks.size();
222
223 // check if current_node need to be duplicated
224 if (node_multiplicity > 1)
225 {
226 // find reference_subdomain_id (e.g. the subdomain with lower id or the
227 // Elem::invalid_subdomain_id)
228 auto subdomain_it = connected_blocks.begin();
229 subdomain_id_type reference_subdomain_id =
231 connected_blocks.find(Elem::invalid_subdomain_id) != connected_blocks.end()
232 ? Elem::invalid_subdomain_id
233 : *subdomain_it;
234
235 // For the block_pairs option, the node that is only shared by specific block pairs will be
236 // newly created.
237 bool should_create_new_node = true;
239 {
240 // Default to false; only set to true if this is exactly the pair boundary we want
241 should_create_new_node = false;
242
243 // Directly use the global info synchronized earlier by syncConnectedBlocks
244 // Invalid subdomain is included for correct logic
245 const auto & sets_blocks_for_this_node = it->second;
246
247 // Check if this node is exactly at the boundary between two blocks
248 // If it is a junction between more than two blocks, we do not split it
249 // For the block_pairs option, only nodes shared by the specified block pairs are newly
250 // created.
251 if (sets_blocks_for_this_node.size() == 2)
252 {
253 // Get the two block IDs from the set
254 auto set_blocks_for_this_node_it = sets_blocks_for_this_node.begin();
255 subdomain_id_type block1 = *set_blocks_for_this_node_it;
256 subdomain_id_type block2 = *std::next(set_blocks_for_this_node_it);
257
258 // Check if this block pair is one of the user-specified pairs to split
259 if (findBlockPairs(block1, block2))
260 should_create_new_node = true;
261 }
262 }
263
264 // multiplicity counter to keep track of how many nodes we added
265 unsigned int multiplicity_counter = node_multiplicity;
266 for (auto elem_id : connected_elems)
267 {
268 // all the duplicate nodes are added and assigned
269 if (multiplicity_counter == 0)
270 break;
271
272 Elem * current_elem = mesh->elem_ptr(elem_id);
273 subdomain_id_type block_id = blockRestrictedElementSubdomainID(current_elem);
274
275 // Work on duplicating the node only from the element that is not on the reference subdomain
276 if ((block_id != reference_subdomain_id) ||
277 (_block_pairs_restricted && findBlockPairs(reference_subdomain_id, block_id)))
278 {
279 // assign the newly added node to current_elem
280 Node * new_node = nullptr;
281
282 std::vector<boundary_id_type> node_boundary_ids;
283
284 for (const auto local_node_id : make_range(current_elem->n_nodes()))
285 if (current_elem->node_id(local_node_id) ==
286 current_node->id()) // if current node == node on element
287 {
288 if (should_create_new_node)
289 {
290 // The maximum number of duplications per subdomain will not exceed the original
291 // number of nodes. Since max_node_id is always greater than the original node
292 // count, it is safe to use max_node_id as a stride to generate new unique node ID
293 // values.
294 // max_node_id > original node count > number of duplications per subdomain
295 new_node = Node::build(*current_node,
296 mesh->is_replicated()
297 ? mesh->n_nodes()
298 : (current_elem->subdomain_id() + 1) * max_node_id +
299 current_node->id())
300 .release();
301#if LIBMESH_ENABLE_UNIQUE_ID
302 new_node->set_unique_id((current_elem->subdomain_id() + 1) * max_unique_id +
303 current_node->unique_id());
304#endif
305 // We're duplicating nodes so that each subdomain elem has its own copy, so it
306 // seems natural to assign this new node the same proc id as corresponding
307 // subdomain elem
308 new_node->processor_id() = current_elem->processor_id();
309 mesh->add_node(new_node);
310 current_elem->set_node(local_node_id, new_node);
311 // Add boundary info to the new node
312 boundary_info.boundary_ids(current_node, node_boundary_ids);
313 boundary_info.add_node(new_node, node_boundary_ids);
314 }
315 multiplicity_counter--; // node created, update multiplicity counter
316 break; // once the proper node has been fixed in one element we can break the
317 // loop
318 }
319
320 if (should_create_new_node)
321 {
322 for (auto connected_elem_id : connected_elems)
323 {
324 Elem * connected_elem = mesh->elem_ptr(connected_elem_id);
325
326 // Assign the newly added node to other connected elements with the same
327 // block_id
328 if (connected_elem->subdomain_id() == current_elem->subdomain_id() &&
329 connected_elem != current_elem)
330 {
331 for (const auto local_node_id : make_range(connected_elem->n_nodes()))
332 if (connected_elem->node_id(local_node_id) ==
333 current_node->id()) // if current node == node on element
334 {
335 connected_elem->set_node(local_node_id, new_node);
336 break;
337 }
338 }
339 }
340 }
341 }
342 }
343
344 // create blocks pair and assign element side to new interface boundary map
345 for (auto elem_id : connected_elems)
346 {
347 for (auto connected_elem_id : connected_elems)
348 {
349 Elem * current_elem = mesh->elem_ptr(elem_id);
350 Elem * connected_elem = mesh->elem_ptr(connected_elem_id);
351
352 // Early out if both elements are the same
353 if (current_elem == connected_elem)
354 continue;
355
356 subdomain_id_type curr_elem_subid = blockRestrictedElementSubdomainID(current_elem);
357 subdomain_id_type connected_elem_subid =
358 blockRestrictedElementSubdomainID(connected_elem);
359
360 if (curr_elem_subid < connected_elem_subid)
361 {
362 if (current_elem->has_neighbor(connected_elem))
363 {
364 unsigned int side = current_elem->which_neighbor_am_i(connected_elem);
365 unsigned int connected_elem_side = connected_elem->which_neighbor_am_i(current_elem);
366
367 // in this case we need to play a game to reorder the sides
368 // Ensure consistent ordering: (min, max) for block (subdomain) IDs
369 bool need_to_switch = false;
371 {
372 connected_elem_subid = connected_elem->subdomain_id();
373 if (curr_elem_subid > connected_elem_subid) // we need to switch the ids
374 {
375 connected_elem_subid = current_elem->subdomain_id();
376 curr_elem_subid = connected_elem->subdomain_id();
377
378 side = connected_elem->which_neighbor_am_i(current_elem);
379
380 connected_elem_side = current_elem->which_neighbor_am_i(connected_elem);
381 need_to_switch = true;
382 }
383 }
384
385 std::pair<subdomain_id_type, subdomain_id_type> blocks_pair =
386 std::make_pair(curr_elem_subid, connected_elem_subid);
387
388 std::pair<subdomain_id_type, subdomain_id_type> blocks_pair2 =
389 std::make_pair(connected_elem_subid, curr_elem_subid);
390
391 auto add_boundary_sides =
392 [&](const std::pair<subdomain_id_type, subdomain_id_type> & blocks_pair,
393 const std::pair<subdomain_id_type, subdomain_id_type> & blocks_pair2,
394 Elem * current_elem,
395 Elem * connected_elem,
396 unsigned int side,
397 unsigned int connected_elem_side,
398 bool need_to_switch)
399 {
400 _neighboring_block_list.insert(blocks_pair);
401 _subid_pairs_to_sides[blocks_pair].emplace(
402 !need_to_switch ? current_elem : connected_elem, side);
403 _neighboring_block_list.insert(blocks_pair2);
404 _subid_pairs_to_sides[blocks_pair2].emplace(
405 !need_to_switch ? connected_elem : current_elem, connected_elem_side);
406 };
407
409 {
411 blockRestrictedElementSubdomainID(connected_elem)))
412 add_boundary_sides(blocks_pair,
413 blocks_pair2,
414 current_elem,
415 connected_elem,
416 side,
417 connected_elem_side,
418 need_to_switch);
419 }
420 else
421 add_boundary_sides(blocks_pair,
422 blocks_pair2,
423 current_elem,
424 connected_elem,
425 side,
426 connected_elem_side,
427 need_to_switch);
428 }
429 }
430 }
431 }
432
433 } // end multiplicity check
434 } // end loop to duplicate nodes
435
437
438 // We want to reset node processor ids, which may need to change
439 // because of elements being disconnected, but we may have
440 // completely disconnected some ghosted nodes on some processors
441 // from all ghosted elements that should own them, in which case
442 // libMesh on those processors may not be able to tell who to query
443 // for an authoritative node processor id. Let's just delete
444 // orphaned nodes so we don't end up with invalid_processor_id on
445 // some processors (confusing consistency checks).
446 if (!mesh->is_serial())
447 mesh->remove_orphaned_nodes();
448 Partitioner::set_node_processor_ids(*mesh);
449
450 mesh->unset_is_prepared();
451
452 return dynamic_pointer_cast<MeshBase>(mesh);
453}
454
455void
457{
458 BoundaryInfo & boundary_info = mesh.get_boundary_info();
459
460 boundary_id_type boundary_id;
461
462 BoundaryName boundary_name;
463
464 const std::set<boundary_id_type> & ids = boundary_info.get_boundary_ids();
465 boundary_id_type new_boundaryID = ids.empty() ? 0 : *ids.rbegin() + 1;
466
467 // Make sure the new boundary ID is the same on every processor
468 mesh.comm().set_union(_neighboring_block_list);
469 mesh.comm().max(new_boundaryID);
470 mooseAssert(new_boundaryID >= 0, "Invalid new boundary ID computed.");
471
472 // loop over boundary sides
473 // All ranks will process the pairs in exactly the same order.
474 std::vector<std::pair<subdomain_id_type, subdomain_id_type>> sorted_pairs(
476
477 for (auto & boundary_side : sorted_pairs)
478 {
479 // Find the boundary name and ID for this direction of the block pair.
480 boundary_id = new_boundaryID;
482 mesh, boundary_side.first, boundary_side.second, boundary_name, boundary_id, boundary_info);
483
484 // Map the block pair (subdomain_id_A, subdomain_id_B) to the generated boundary_id
485 _subid_pairs_to_boundary_id[boundary_side] = boundary_id;
486
487 // loop over all the side belonging to each pair and add it to the proper interface
488 auto boundary_side_map = _subid_pairs_to_sides.find(boundary_side);
489 if (boundary_side_map != _subid_pairs_to_sides.end())
490 for (const auto & [elem, side] : boundary_side_map->second)
491 boundary_info.add_side(elem, side, boundary_id);
492 new_boundaryID++;
493 }
494
495 // Sync boundary info
496 boundary_info.parallel_sync_side_ids();
497 boundary_info.parallel_sync_node_ids();
498
499 // Generate boundary_id pairs mapping based on _subid_pairs_to_sides
500 for (const auto & [sub_pair, boundary_id] : _subid_pairs_to_boundary_id)
501 {
502 const auto rev_pair = std::make_pair(sub_pair.second, sub_pair.first);
503 const bool has_reverse =
505 if (has_reverse)
506 {
507 const auto reverse_boundary_id = _subid_pairs_to_boundary_id[rev_pair];
508 mooseAssert(boundary_id != reverse_boundary_id,
509 "Disjoint neighbor boundary pairs must use different boundary IDs.");
510 // Normal disconnected boundary pair: blockA_blockB <-> blockB_blockA
511 mesh.add_disjoint_neighbor_boundary_pairs(
512 boundary_id, reverse_boundary_id, RealVectorValue(0.0, 0.0, 0.0));
513 }
514 }
515}
516
517subdomain_id_type
519{
520 subdomain_id_type elem_subdomain_id = elem->subdomain_id();
522 (_block_set.find(elem_subdomain_id) == _block_set.end()))
523 elem_subdomain_id = Elem::invalid_subdomain_id;
524
525 return elem_subdomain_id;
526}
527
528bool
529BreakMeshByBlockGenerator::findBlockPairs(subdomain_id_type block_one, subdomain_id_type block_two)
530{
531 for (auto block_pair : _block_pairs)
532 if ((block_pair.first == block_one && block_pair.second == block_two) ||
533 (block_pair.first == block_two && block_pair.second == block_one))
534 return true;
535 return false;
536}
537
538std::unordered_map<dof_id_type, std::set<subdomain_id_type>>
540 const std::unordered_map<dof_id_type, std::vector<dof_id_type>> & node_to_elem_map,
541 const MeshBase & mesh)
542{
543 std::unordered_map<dof_id_type, std::set<subdomain_id_type>> nodeid_to_connected_blocks;
544
545 // Phase 0: Each rank computes its local connected blocks for nodes it holds
546 for (const auto & [node_id, elem_ids] : node_to_elem_map)
547 {
548 std::set<subdomain_id_type> connected_blocks;
549 for (const dof_id_type elem_id : elem_ids)
550 {
551 const Elem * current_elem = mesh.elem_ptr(elem_id);
552 subdomain_id_type block_id = blockRestrictedElementSubdomainID(current_elem);
553 nodeid_to_connected_blocks[node_id].insert(block_id);
554 }
555 }
556
557 // No synchronization needed for replicated meshes
558 if (mesh.is_replicated())
559 return nodeid_to_connected_blocks;
560
561 auto & comm = mesh.comm();
562 const auto mesh_pid = mesh.processor_id();
563
564 // Phase 1: Ghost nodes push their connected blocks to the owner
565
566 // (node_id, connected_blocks, ghost_pid)
567 using NodeConnectedBlocksTuple =
568 std::tuple<dof_id_type, std::vector<subdomain_id_type>, processor_id_type>;
569 std::map<processor_id_type, std::vector<NodeConnectedBlocksTuple>> to_owner;
570 for (const auto & [node_id, blocks] : nodeid_to_connected_blocks)
571 {
572 const Node * node = mesh.node_ptr(node_id);
573 if (node && node->processor_id() != mesh_pid)
574 to_owner[node->processor_id()].emplace_back(
575 node_id, std::vector<subdomain_id_type>(blocks.begin(), blocks.end()), mesh_pid);
576 }
577
578 // Owner receives and merges ghost info into its local map, and tracks subscribers
579 std::unordered_map<dof_id_type, std::set<processor_id_type>> subscribers;
580 Parallel::push_parallel_vector_data(
581 comm,
582 to_owner,
583 [&](processor_id_type, const std::vector<NodeConnectedBlocksTuple> & recv_data)
584 {
585 for (const auto & [node_id, blocks_vec, ghost_pid] : recv_data)
586 {
587 subscribers[node_id].insert(ghost_pid);
588 nodeid_to_connected_blocks[node_id].insert(blocks_vec.begin(), blocks_vec.end());
589 }
590 });
591
592 // Phase 2: Node owners broadcast complete connected blocks back to subscribers
593 std::map<processor_id_type, std::vector<NodeConnectedBlocksPair>> from_owner;
594 for (const auto & [node_id, sub_pids] : subscribers)
595 {
596 const Node * node = mesh.node_ptr(node_id);
597 if (node && node->processor_id() == mesh_pid)
598 {
599 const auto & blocks_set = libmesh_map_find(nodeid_to_connected_blocks, node_id);
600 for (const auto pid : sub_pids)
601 from_owner[pid].emplace_back(
602 node_id, std::vector<subdomain_id_type>(blocks_set.begin(), blocks_set.end()));
603 }
604 }
605
606 Parallel::push_parallel_vector_data(
607 comm,
608 from_owner,
609 [&](processor_id_type, const std::vector<NodeConnectedBlocksPair> & recv_data)
610 {
611 for (const auto & [node_id, blocks_vec] : recv_data)
612 nodeid_to_connected_blocks[node_id].insert(blocks_vec.begin(), blocks_vec.end());
613 });
614 return nodeid_to_connected_blocks;
615}
registerMooseObject("MooseApp", BreakMeshByBlockGenerator)
char ** blocks
std::unordered_set< SubdomainID > _block_set
set of the blocks to split the mesh on
std::set< std::pair< std::string, BoundaryID > > _bName_bID_set
A container holding (boundary name, boundary ID) associations.
std::unordered_map< dof_id_type, std::set< subdomain_id_type > > syncConnectedBlocks(const std::unordered_map< dof_id_type, std::vector< dof_id_type > > &node_to_elem_map, const MeshBase &mesh)
Synchronizes connected blocks across all MPI ranks.
BreakMeshByBlockGenerator(const InputParameters &parameters)
std::unique_ptr< MeshBase > & _input
the mesh to modify
const bool _surrounding_blocks_restricted
whether interfaces will be generated surrounding blocks
subdomain_id_type blockRestrictedElementSubdomainID(const Elem *elem)
This is a helper method to avoid recoding the same if everywhere.
BoundaryName generateBoundaryName(const MeshBase &mesh, subdomain_id_type primaryBlockID, subdomain_id_type secondaryBlockID)
this method generate the boundary name by assembling subdomain names
std::unordered_map< SubdomainPair, std::set< ElemSide > > _subid_pairs_to_sides
Map from a pair of block ids to a set of ElemSide tuples.
std::unique_ptr< MeshBase > generate() override
Generate / modify the mesh.
void findBoundaryName(const MeshBase &mesh, subdomain_id_type primaryBlockID, subdomain_id_type secondaryBlockID, BoundaryName &boundary_name, boundary_id_type boundaryID, BoundaryInfo &boundary_info)
given the primary and secondary blocks this method return the appropriate boundary id and name
static InputParameters validParams()
std::unordered_set< std::pair< SubdomainID, SubdomainID > > _block_pairs
set of subdomain pairs between which interfaces will be generated.
void addInterface(MeshBase &mesh)
generate the new boundary interface
bool findBlockPairs(subdomain_id_type block_one, subdomain_id_type block_two)
Return true if block_one and block_two are found in users' provided block_pairs list.
std::set< SubdomainPair > _neighboring_block_list
Set of pairs of block ids between which new boundary sides are created.
const bool _block_pairs_restricted
whether interfaces will be generated between block pairs
std::unordered_map< std::pair< subdomain_id_type, subdomain_id_type >, boundary_id_type > _subid_pairs_to_boundary_id
Map from a pair of block ids to the corresponding boundary id.
void mapBoundaryIdAndBoundaryName(boundary_id_type boundaryID, const std::string &boundaryName)
this method save the boundary name/id pair
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
void addDeprecatedParam(const std::string &name, const T &value, const std::string &doc_string, const std::string &deprecation_message)
void addRelationshipManager(const std::string &name, Moose::RelationshipManagerType rm_type, Moose::RelationshipManagerInputParameterCallback input_parameter_callback=nullptr)
Tells MOOSE about a RelationshipManager that this object needs.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
MeshGenerators are objects that can modify or add to an existing mesh.
static InputParameters validParams()
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
void paramError(const std::string &param, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
Definition MooseBase.h:457
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
Definition MooseBase.h:406
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
Definition MooseBase.h:199
const Parallel::Communicator & comm() const
MeshBase & mesh
bool hasSubdomainName(const MeshBase &input_mesh, const SubdomainName &name)
Whether a particular subdomain name exists in the mesh.
std::vector< subdomain_id_type > getSubdomainIDs(const libMesh::MeshBase &mesh, const std::vector< SubdomainName > &subdomain_name)
Get the associated subdomainIDs for the subdomain names that are passed in.