https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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{
21public:
23
25
26 std::unique_ptr<MeshBase> generate() override;
27
28protected:
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
54 // Whether to put that boundary on 0, 1, or 2 sides of each new
55 // element break
56 const unsigned int _interface_sides;
57};
void createInterface(MeshBase &mesh, const NodeToElemMapType &node_to_elem_map) const
const std::vector< SubdomainID > & _subdomains
std::map< const dof_id_type, std::set< dof_id_type > > NodeToElemMapType
std::unique_ptr< MeshBase > & _input
The mesh to modify.
NodeToElemMapType buildSubdomainRestrictedNodeToElemMap(std::unique_ptr< MeshBase > &mesh, const std::vector< SubdomainID > &subdomains) const
std::unique_ptr< MeshBase > generate() override
Generate / modify the mesh.
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
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
MeshGenerators are objects that can modify or add to an existing mesh.
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131