https://mooseframework.inl.gov
Loading...
Searching...
No Matches
AugmentSparsityBetweenElements.C
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
11#include "libmesh/elem.h"
12
14
15using namespace libMesh;
16
19{
21 params.addRequiredParam<std::map<dof_id_type, std::vector<dof_id_type>> *>(
22 "_elem_map", "Element to element augmentation map");
23 return params;
24}
25
27 : RelationshipManager(params),
28 _elem_map(*getParam<std::map<dof_id_type, std::vector<dof_id_type>> *>("_elem_map"))
29{
30}
31
37
38std::unique_ptr<GhostingFunctor>
40{
41 return _app.getFactory().clone(*this);
42}
43
44void
49
50void
54
55void
59
60std::string
62{
63 std::ostringstream oss;
64 oss << "AugmentSparsityBetweenElements";
65 return oss.str();
66}
67
68void
70 const MeshBase::const_element_iterator & range_end,
72 map_type & coupled_elements)
73{
74 const CouplingMatrix * const null_mat = libmesh_nullptr;
75 for (const auto & elem : as_range(range_begin, range_end))
76 {
77 auto it = _elem_map.find(elem->id());
78 if (it != _elem_map.end())
79 {
80 for (auto & coupled_elem_id : it->second)
81 {
82 auto coupled_elem = _moose_mesh->elemPtr(coupled_elem_id);
83 if (coupled_elem->processor_id() != p)
84 coupled_elements.insert(std::make_pair(coupled_elem, null_mat));
85 }
86 }
87 }
88}
89
90bool
92{
93 const auto * const rm = dynamic_cast<const AugmentSparsityBetweenElements *>(&rhs);
94 if (!rm)
95 return false;
96
97 return (_elem_map == rm->_elem_map) && baseGreaterEqual(rhs);
98}
registerMooseObject("ThermalHydraulicsApp", AugmentSparsityBetweenElements)
const Real p
Relationship manager to add ghosting between elements.
virtual 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
const std::map< dof_id_type, std::vector< dof_id_type > > & _elem_map
Map of element ghosting. Element IDs linked to list of element IDs that they are connected to.
AugmentSparsityBetweenElements(const InputParameters &)
virtual void internalInitWithMesh(const MeshBase &) override
virtual bool operator>=(const RelationshipManager &rhs) const override
virtual std::unique_ptr< GhostingFunctor > clone() const override
void addRequiredParam(const std::string &name, const std::string &doc_string)
Factory & getFactory()
virtual Elem * elemPtr(const dof_id_type i)
virtual bool baseGreaterEqual(const RelationshipManager &rhs) const
static InputParameters validParams()
MooseMesh * _moose_mesh
std::map< const Elem *, const CouplingMatrix *, CompareDofObjectsByPIDAndThenID > map_type
virtual void mesh_reinit()
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
uint8_t dof_id_type
uint8_t processor_id_type