https://mooseframework.inl.gov
Loading...
Searching...
No Matches
SideSetsGeneratorBase.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/fe_base.h"
14
15// libMesh forward declarations
16namespace libMesh
17{
18class QGauss;
19class Elem;
20}
21
22/*
23 * Base class for mesh generators that add sidesets to the mesh
24 */
26{
27public:
29
31 virtual ~SideSetsGeneratorBase(); // dtor required for unique_ptr with forward declarations
32
33protected:
39 void setup(MeshBase & mesh);
40
45 void finalize();
46
51 void
52 flood(const Elem * elem, const Point & normal, const boundary_id_type & side_id, MeshBase & mesh);
53
58 bool elementSideInIncludedBoundaries(const Elem * const elem,
59 const unsigned int side,
60 const MeshBase & mesh) const;
61
66 bool elementSideInExcludedBoundaries(const Elem * const elem,
67 const unsigned int side,
68 const MeshBase & mesh) const;
69
74 bool elemSideSatisfiesRequirements(const Elem * const elem,
75 const unsigned int side,
76 const MeshBase & mesh,
77 const Point & normal,
78 const Point & face_normal);
79
81 std::unique_ptr<MeshBase> & _input;
82
84 std::vector<BoundaryName> _boundary_names;
85
87 const bool _fixed_normal;
88
90 const bool _replace;
91
94
97
100
103
105 std::vector<boundary_id_type> _included_boundary_ids;
106
108 std::vector<boundary_id_type> _excluded_boundary_ids;
109
111 std::vector<subdomain_id_type> _included_subdomain_ids;
112
114 std::vector<subdomain_id_type> _included_neighbor_subdomain_ids;
115
118
121
123 Point _normal;
124
130 const Real _normal_tol;
131
132 std::unique_ptr<libMesh::FEBase> _fe_face;
133 std::unique_ptr<libMesh::QGauss> _qface;
134 std::map<boundary_id_type, std::set<const Elem *>> _visited;
135};
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
void setup(MeshBase &mesh)
This method is used to construct the FE object so we can compute normals of faces.
const Real _normal_tol
if normal is specified, then faces are only added if face_normal.normal_hat <= 1 - normal_tol where n...
std::unique_ptr< libMesh::QGauss > _qface
std::vector< subdomain_id_type > _included_neighbor_subdomain_ids
A list of included neighbor subdomain ids that the sides' neighbor element must be a part of.
std::unique_ptr< libMesh::FEBase > _fe_face
const bool _check_included_boundaries
whether to check boundary ids against the included boundary list when adding sides or not
std::vector< BoundaryName > _boundary_names
The list of new boundary names.
bool elementSideInExcludedBoundaries(const Elem *const elem, const unsigned int side, const MeshBase &mesh) const
Determines whether the given side of an element belongs to any boundaries in the excluded_boundaries ...
const bool _check_excluded_boundaries
whether to check boundary ids against the excluded boundary list when adding sides or not
Point _normal
if specified, then faces are only added if their normal is close to this
static InputParameters validParams()
bool elemSideSatisfiesRequirements(const Elem *const elem, const unsigned int side, const MeshBase &mesh, const Point &normal, const Point &face_normal)
Determines whether the given element's side satisfies the following parameters: include_only_external...
const bool _check_subdomains
whether to check subdomain ids of the element in the (element, side, boundary id) tuple when adding s...
std::unique_ptr< MeshBase > & _input
the mesh to add the sidesets to
void flood(const Elem *elem, const Point &normal, const boundary_id_type &side_id, MeshBase &mesh)
This method implements a recursive flood routine to paint a sideset of mesh to neighboring faces give...
const bool _replace
Whether or not to remove the old sidesets (all of them, if any) when adding sidesets.
std::vector< boundary_id_type > _included_boundary_ids
A list of boundary ids that the side has to be part of, extracted from the included_boundaries parame...
bool _using_normal
true if only faces close to "normal" will be added
void finalize()
This method finalizes the object, setting names back in the boundary_info object and releasing memory...
std::vector< subdomain_id_type > _included_subdomain_ids
A list of included subdomain ids that the side has to be part of, extracted from the included_subdoma...
std::vector< boundary_id_type > _excluded_boundary_ids
A list of boundary ids that the side must not be a part of, extracted from the excluded_boundaries pa...
const bool _check_neighbor_subdomains
whether to check the subdomain ids of the neighbor element (on the other 'side' of the side) when add...
bool elementSideInIncludedBoundaries(const Elem *const elem, const unsigned int side, const MeshBase &mesh) const
Determines whether the given side of an element belongs to any boundaries in the included_boundaries ...
const bool _fixed_normal
Whether to fix the normal or allow it to vary to "paint" around curves.
std::map< boundary_id_type, std::set< const Elem * > > _visited
const bool _include_only_external_sides
Whether to only include external side when considering sides to add to the sideset.
MeshBase & mesh
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
const boundary_id_type side_id