19#include "libmesh/elem.h"
20#include "libmesh/mesh_base.h"
21#include "libmesh/boundary_info.h"
29 params.
set<
bool>(
"attach_geometric_early") =
false;
46 std::ostringstream oss;
47 oss <<
"GhostAllPointNeighbors";
53 const MeshBase::const_element_iterator & range_end,
54 const processor_id_type p,
58 "The MOOSE mesh must be non-null in order for this relationship manager to work.");
61 static const CouplingMatrix *
const null_mat =
nullptr;
62 std::unordered_set<dof_id_type> visited_nodes;
64 for (
const Elem *
const elem : as_range(range_begin, range_end))
65 for (
const auto & node : elem->node_ref_range())
70 const auto node_pid = node.processor_id();
71 if (node_pid == p || node_pid == DofObject::invalid_processor_id)
73 const auto [_, inserted] = visited_nodes.insert(node.id());
78 const auto & elem_node_neighbors = libmesh_map_find(node_to_elem_map, node.id());
79 for (
const auto elem_id : elem_node_neighbors)
81 const Elem *
const elem_node_neighbor =
_mesh->
elem_ptr(elem_id);
82 if (elem_node_neighbor->processor_id() != p)
83 coupled_elements.emplace(elem_node_neighbor, null_mat);
97std::unique_ptr<libMesh::GhostingFunctor>
registerMooseObject("MooseApp", GhostAllPointNeighbors)
std::unique_ptr< T > copyConstruct(const T &object)
Copy constructs the object object.
Ghosts all point neighbors (not including periodic neighbors) regardless of the dimensionality of the...
std::unique_ptr< GhostingFunctor > clone() const override
GhostAllPointNeighbors(const InputParameters &)
std::string getInfo() const override
Method for returning relationship manager information (suitable for console output).
void operator()(const MeshBase::const_element_iterator &range_begin, const MeshBase::const_element_iterator &range_end, processor_id_type p, map_type &coupled_elements) override
static InputParameters validParams()
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.
Ghosts lower-D point neighbors of higher-D elements.
Factory & getFactory()
Retrieve a writable reference to the Factory associated with this App.
const std::unordered_map< dof_id_type, std::vector< dof_id_type > > & nodeToElemMap()
If not already created, creates a map from every node to all elements to which they are connected.
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...
static InputParameters validParams()
MooseMesh * _moose_mesh
Pointer to the MooseMesh object.
std::map< const Elem *, const CouplingMatrix *, CompareDofObjectsByPIDAndThenID > map_type
virtual const Elem * elem_ptr(const dof_id_type i) const=0