12#include "libmesh/boundary_info.h"
13#include "libmesh/elem.h"
24 "The name of the primary boundary sideset.");
26 "The name of the secondary boundary sideset.");
27 params.
addRequiredParam<
bool>(
"enabled",
"Whether this relationship manager should ghost.");
29 "Ghosts full-dimensional elements with sides on the primary boundary to processors that own "
30 "full-dimensional elements with sides on the secondary boundary.");
36 _primary_boundary_name(getParam<BoundaryName>(
"primary_boundary")),
37 _secondary_boundary_name(getParam<BoundaryName>(
"secondary_boundary")),
38 _enabled(getParam<bool>(
"enabled"))
44 _primary_boundary_name(other._primary_boundary_name),
45 _secondary_boundary_name(other._secondary_boundary_name),
46 _enabled(other._enabled)
58 std::ostringstream oss;
59 oss <<
"GhostPrimaryFace" << (
_enabled ?
"" :
" (disabled)");
65 const MeshBase::const_element_iterator & range_end,
67 const bool generating_mesh)
const
72 for (
const Elem *
const elem : as_range(range_begin, range_end))
74 if (elem->dim() != mesh_dim)
81 if (elem->on_boundary())
85 for (
const auto side : elem->side_index_range())
86 if (binfo.has_boundary_id(elem, side, secondary_boundary_id))
95 const MeshBase::const_element_iterator & range_end,
96 const processor_id_type p,
103 const auto primary_boundary_id = generating_mesh
106 const auto secondary_boundary_id = generating_mesh
116 for (
const Elem *
const elem :
_mesh->active_element_ptr_range())
118 if (elem->processor_id() == p || elem->dim() != mesh_dim)
125 if (elem->on_boundary())
126 coupled_elements.emplace(elem,
_null_mat);
129 for (
const auto side : elem->side_index_range())
130 if (binfo.has_boundary_id(elem, side, primary_boundary_id))
132 coupled_elements.emplace(elem,
_null_mat);
141 const auto *
const primary_face =
dynamic_cast<const GhostPrimaryFace *
>(&other);
147 if (
_enabled && !primary_face->_enabled)
156 return primary_face->_enabled &&
_use_displaced_mesh == primary_face->_use_displaced_mesh &&
161std::unique_ptr<libMesh::GhostingFunctor>
boundary_id_type BoundaryID
registerMooseObject("MooseApp", GhostPrimaryFace)
std::unique_ptr< T > copyConstruct(const T &object)
Copy constructs the object object.
Ghosts full-dimensional elements with sides on the primary boundary to processors that own full-dimen...
const BoundaryName _secondary_boundary_name
Secondary boundary whose local presence triggers primary boundary ghosting.
virtual std::unique_ptr< libMesh::GhostingFunctor > clone() const override
const libMesh::CouplingMatrix *const _null_mat
null matrix for generating full variable coupling
const BoundaryName _primary_boundary_name
Primary boundary whose full-dimensional elements may be ghosted.
bool hasSecondaryBoundaryFace(const libMesh::MeshBase::const_element_iterator &range_begin, const libMesh::MeshBase::const_element_iterator &range_end, BoundaryID secondary_boundary_id, bool generating_mesh) const
Return whether the local element range contains a secondary boundary face.
std::string getInfo() const override
Method for returning relationship manager information (suitable for console output).
virtual bool operator>=(const RelationshipManager &other) const override
Whether this relationship manager provides more or the same amount and type of ghosting as the rhs.
static InputParameters validParams()
const bool _enabled
Whether this relationship manager should add ghosting entries.
GhostPrimaryFace(const InputParameters ¶ms)
virtual void internalInitWithMesh(const libMesh::MeshBase &) override
virtual void operator()(const libMesh::MeshBase::const_element_iterator &range_begin, const libMesh::MeshBase::const_element_iterator &range_end, libMesh::processor_id_type p, map_type &coupled_elements) override
Factory & getFactory()
Retrieve a writable reference to the Factory associated with this App.
const MeshBase * getMeshPtr() const
BoundaryID getBoundaryID(const BoundaryName &boundary_name) const
Get the associated BoundaryID for the boundary name.
MooseApp & _app
The MOOSE application this is associated with.
RelationshipManagers are used for describing what kinds of non-local resources are needed for an obje...
const bool _use_displaced_mesh
Which system this should go to (undisplaced or displaced)
virtual bool baseGreaterEqual(const RelationshipManager &rhs) const
Whether the base class provides more or the same amount and type of ghosting as the rhs.
static InputParameters validParams()
MooseMesh * _moose_mesh
Pointer to the MooseMesh object.
std::map< const Elem *, const CouplingMatrix *, CompareDofObjectsByPIDAndThenID > map_type
const BoundaryInfo & get_boundary_info() const
unsigned int mesh_dimension() const
const BoundaryID INVALID_BOUNDARY_ID