https://mooseframework.inl.gov
Loading...
Searching...
No Matches
GhostLowerDElems.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
10// App includes
11#include "GhostLowerDElems.h"
12#include "Executioner.h"
13#include "FEProblemBase.h"
14#include "MooseApp.h"
15
16// libMesh includes
17#include "libmesh/elem.h"
18#include "libmesh/mesh_base.h"
19#include "libmesh/boundary_info.h"
20
22
23using namespace libMesh;
24
27{
29 params.set<bool>("attach_geometric_early") = false;
30 return params;
31}
32
34
36
37std::string
39{
40 std::ostringstream oss;
41 oss << "GhostLowerDElems";
42 return oss.str();
43}
44
45void
47 const MeshBase::const_element_iterator & range_end,
48 const processor_id_type p,
49 map_type & coupled_elements)
50{
51 mooseAssert(_moose_mesh,
52 "The MOOSE mesh must be non-null in order for this relationship manager to work.");
53 if (!_moose_mesh->hasLowerD())
54 return;
55
56 static const CouplingMatrix * const null_mat = nullptr;
57
58 for (const Elem * const elem : as_range(range_begin, range_end))
59 for (const auto s : elem->side_index_range())
60 {
61 const Elem * const neighbor = elem->neighbor_ptr(s);
62 const bool elem_owns_lowerd = !neighbor || elem->id() < neighbor->id();
63
64 const Elem * const lower_d_elem =
65 elem_owns_lowerd
66 ? _moose_mesh->getLowerDElem(elem, s)
67 : _moose_mesh->getLowerDElem(neighbor, neighbor->which_neighbor_am_i(elem));
68
69 if (lower_d_elem && lower_d_elem->processor_id() != p)
70 coupled_elements.emplace(lower_d_elem, null_mat);
71 }
72}
73
74bool
76{
77 return dynamic_cast<const GhostLowerDElems *>(&other);
78}
79
80std::unique_ptr<GhostingFunctor>
82{
83 return _app.getFactory().copyConstruct(*this);
84}
registerMooseObject("MooseApp", GhostLowerDElems)
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
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.
std::string getInfo() const override
Method for returning relationship manager information (suitable for console output).
static InputParameters validParams()
std::unique_ptr< GhostingFunctor > clone() const override
GhostLowerDElems(const InputParameters &)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
Factory & getFactory()
Retrieve a writable reference to the Factory associated with this App.
Definition MooseApp.h:407
const Elem * getLowerDElem(const Elem *, unsigned short int) const
Returns a const pointer to a lower dimensional element that corresponds to a side of a higher dimensi...
Definition MooseMesh.C:1690
bool hasLowerD() const
Definition MooseMesh.h:1547
MooseApp & _app
The MOOSE application this is associated with.
Definition MooseBase.h:375
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.
processor_id_type processor_id() const
dof_id_type id() const
unsigned int which_neighbor_am_i(const Elem *e) const
const Elem * neighbor_ptr(unsigned int i) const
std::map< const Elem *, const CouplingMatrix *, CompareDofObjectsByPIDAndThenID > map_type
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
uint8_t processor_id_type