https://mooseframework.inl.gov
BreakMeshByElementGenerator.h
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 
10 #pragma once
11 
12 #include "MeshGenerator.h"
13 #include "libmesh/elem.h"
14 
15 /*
16  * A mesh generator to split a mesh by breaking all element-element interfaces in the
17  * specified subdomains
18  */
20 {
21 public:
23 
25 
26  std::unique_ptr<MeshBase> generate() override;
27 
28 protected:
29  // It is important to maintain the exact same ordering across processors. Otherwise nodes with the
30  // same ID might have different processor IDs. std::map and std::set of dof_id_type are used here
31  // to ensure the same ordering.
32  typedef std::map<const dof_id_type, std::set<dof_id_type>> NodeToElemMapType;
33 
35  buildSubdomainRestrictedNodeToElemMap(std::unique_ptr<MeshBase> & mesh,
36  const std::vector<SubdomainID> & subdomains) const;
37 
38  void duplicateNodes(std::unique_ptr<MeshBase> & mesh,
39  const NodeToElemMapType & node_to_elem_map) const;
40 
41  void duplicateNode(std::unique_ptr<MeshBase> & mesh, Elem * elem, const Node * node) const;
42 
43  void createInterface(MeshBase & mesh, const NodeToElemMapType & node_to_elem_map) const;
44 
46  std::unique_ptr<MeshBase> & _input;
47 
48  // The subdomains to explode
49  const std::vector<SubdomainID> & _subdomains;
50 
51  // The name of the new boundary
52  const BoundaryName _interface_name;
53 };
std::map< const dof_id_type, std::set< dof_id_type > > NodeToElemMapType
NodeToElemMapType buildSubdomainRestrictedNodeToElemMap(std::unique_ptr< MeshBase > &mesh, const std::vector< SubdomainID > &subdomains) const
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
std::unique_ptr< MeshBase > & _input
The mesh to modify.
void duplicateNode(std::unique_ptr< MeshBase > &mesh, Elem *elem, const Node *node) const
void duplicateNodes(std::unique_ptr< MeshBase > &mesh, const NodeToElemMapType &node_to_elem_map) const
std::unique_ptr< MeshBase > generate() override
Generate / modify the mesh.
BreakMeshByElementGenerator(const InputParameters &parameters)
const InputParameters & parameters() const
Get the parameters of the object.
const std::vector< SubdomainID > & _subdomains
MeshGenerators are objects that can modify or add to an existing mesh.
Definition: MeshGenerator.h:32
void createInterface(MeshBase &mesh, const NodeToElemMapType &node_to_elem_map) const