https://mooseframework.inl.gov
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
16 namespace libMesh
17 {
18 class QGauss;
19 class Elem;
20 }
21 
22 /*
23  * Base class for mesh generators that add sidesets to the mesh
24  */
26 {
27 public:
29 
31  virtual ~SideSetsGeneratorBase(); // dtor required for unique_ptr with forward declarations
32 
33 protected:
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 
99  const bool _check_subdomains;
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 
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 };
const bool _fixed_normal
Whether to fix the normal or allow it to vary to "paint" around curves.
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&#39;s side satisfies the following parameters: include_only_external...
std::unique_ptr< MeshBase > & _input
the mesh to add the sidesets to
const Real _normal_tol
if normal is specified, then faces are only added if face_normal.normal_hat <= 1 - normal_tol where n...
Point _normal
if specified, then faces are only added if their normal is close to this
std::vector< subdomain_id_type > _included_neighbor_subdomain_ids
A list of included neighbor subdomain ids that the sides&#39; neighbor element must be a part of...
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:131
const boundary_id_type side_id
SideSetsGeneratorBase(const InputParameters &parameters)
MeshBase & mesh
const bool _check_included_boundaries
whether to check boundary ids against the included boundary list when adding sides or not ...
const bool _replace
Whether or not to remove the old sidesets (all of them, if any) when adding sidesets.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
std::vector< BoundaryName > _boundary_names
The list of new boundary names.
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
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...
const bool _include_only_external_sides
Whether to only include external side when considering sides to add to the sideset.
int8_t boundary_id_type
const bool _check_excluded_boundaries
whether to check boundary ids against the excluded boundary list when adding sides or not ...
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...
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 ...
void finalize()
This method finalizes the object, setting names back in the boundary_info object and releasing memory...
static InputParameters validParams()
bool _using_normal
true if only faces close to "normal" will be added
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...
const bool _check_subdomains
whether to check subdomain ids of the element in the (element, side, boundary id) tuple when adding s...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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...
std::unique_ptr< libMesh::QGauss > _qface
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_neighbor_subdomains
whether to check the subdomain ids of the neighbor element (on the other &#39;side&#39; of the side) when add...
std::map< boundary_id_type, std::set< const Elem * > > _visited
std::unique_ptr< libMesh::FEBase > _fe_face
MeshGenerators are objects that can modify or add to an existing mesh.
Definition: MeshGenerator.h:33
void setup(MeshBase &mesh)
This method is used to construct the FE object so we can compute normals of faces.