https://mooseframework.inl.gov
Loading...
Searching...
No Matches
RelationshipManager.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#include "RelationshipManager.h"
11#include "MooseApp.h"
12
13using namespace libMesh;
14
17{
19
35 params.addPrivateParam<bool>("attach_geometric_early", true);
36
45
49 params.addRequiredParam<std::string>("for_whom", "What object is requesting this RM?");
50
51 params.addParam<bool>(
52 "use_displaced_mesh",
53 false,
54 "Whether this RM should be placed on the undisplaced or displaced problem. Note: yes, it "
55 "still says 'mesh' to match with common parameter name in MOOSE - but if it's purely "
56 "algebraic then it's going to the DofMap no matter what!");
57
58 // Set by MOOSE
59 params.addPrivateParam<MooseMesh *>("mesh");
60 params.registerBase("RelationshipManager");
61 return params;
62}
63
65 : MooseObject(parameters),
67 _moose_mesh(getCheckedPointerParam<MooseMesh *>(
68 "mesh",
69 "Mesh is null in RelationshipManager constructor. This could well be because No mesh file "
70 "was supplied and no generation block was provided")),
71 _attach_geometric_early(getParam<bool>("attach_geometric_early")),
72 _rm_type(getParam<Moose::RelationshipManagerType>("rm_type")),
73 _use_displaced_mesh(getParam<bool>("use_displaced_mesh"))
74{
75 _for_whom.push_back(getParam<std::string>("for_whom"));
76}
77
79 : MooseObject(other._pars),
80 GhostingFunctor(other),
81 _moose_mesh(other._moose_mesh),
82 _attach_geometric_early(other._attach_geometric_early),
83 _rm_type(other._rm_type),
84 _for_whom(other._for_whom),
85 _use_displaced_mesh(other._use_displaced_mesh)
86{
87}
88
89bool
95
96bool
102
103bool
109
110bool
112{
113 // !attach early = attach late
114 // If we are supposed to be attached late, then we should take precedence over the rhs. You can
115 // think of this as being >= because we if we are attaching late, then we are asking that *all*
116 // elements be geometrically ghosted during the initial mesh preparation phase. We will only allow
117 // remote elements to be deleted later on after addition of late geomeric ghosting functors (at
118 // the same time as algebraic and coupling)
120}
121
124
128
131{
132 auto params = emptyInputParameters();
133 params.registerBase("dummy");
134 return params;
135}
136
139{
140 auto params = dummyParams();
141 params.addRelationshipManager("ElementSideNeighborLayers",
143 [](const InputParameters &, InputParameters & rm_params)
144 { rm_params.set<unsigned short>("layers") = 0; });
145 return params;
146}
147
150{
151 auto params = dummyParams();
152 params.addRelationshipManager("ElementSideNeighborLayers", rm_type);
153 return params;
154}
155
156void
158 const MeshBase & mesh,
159 const DofMap * const dof_map)
160{
161 mooseAssert(_dof_map ? dof_map == _dof_map : true,
162 "Trying to initialize with a different dof map");
163
164 _dof_map = dof_map;
165 // During the mesh generation phase we haven't set the mesh base in the moose mesh yet
166 if (moose_mesh.getMeshPtr())
167 mooseAssert(moose_mesh.getMeshPtr() == &mesh, "These should match");
168 _moose_mesh = &moose_mesh;
169
170 // It is conceivable that this init method gets called twice, once during early geometric setup
171 // and later when we're doing algebraic/coupling (and late geometric) setup. There might be new
172 // information available during the latter call that the derived RelationshipManager can
173 // leverage, so we should make sure we call through to internal init both times
175
176 // One would hope that internalInitWithMesh set the mesh, but we can't be sure
177 set_mesh(&mesh);
178
179 _inited = true;
180}
InputParameters emptyInputParameters()
InputParameters dummyParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
void addPrivateParam(const std::string &name, const T &value)
These method add a parameter to the InputParameters object which can be retrieved like any other para...
void registerBase(const std::string &value)
This method must be called from every base "Moose System" to create linkage with the Action System.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition MooseMesh.h:95
const MeshBase * getMeshPtr() const
Definition MooseMesh.C:3543
Every object that can be built by the factory should be derived from this class.
Definition MooseObject.h:31
static InputParameters validParams()
Definition MooseObject.C:25
RelationshipManagers are used for describing what kinds of non-local resources are needed for an obje...
bool _inited
Whether or not this has been initialized.
bool isType(const Moose::RelationshipManagerType &type) const
Check to see if an RM is of a given type.
virtual bool baseGreaterEqual(const RelationshipManager &rhs) const
Whether the base class provides more or the same amount and type of ghosting as the rhs.
RelationshipManager(const InputParameters &parameters)
static bool isCoupling(Moose::RelationshipManagerType input_rm)
Whether input_rm is coupling.
std::vector< std::string > _for_whom
The name of the object that requires this RelationshipManager.
const libMesh::DofMap * _dof_map
Pointer to DofMap (may be null if this is geometric only).
Moose::RelationshipManagerType _rm_type
The type of RM this object is.
static bool isGeometric(Moose::RelationshipManagerType input_rm)
Whether input_rm is geometric.
static InputParameters validParams()
void init(MooseMesh &moose_mesh, const MeshBase &mesh, const libMesh::DofMap *dof_map=nullptr)
Called before this RM is attached.
static Moose::RelationshipManagerType geo_alg_and_coupl
A relationship manager type that is geometric, algebraic, and coupling.
virtual void internalInitWithMesh(const MeshBase &)
Called before this RM is attached.
const bool _attach_geometric_early
Boolean indicating whether this RM can be attached early (e.g.
MooseMesh * _moose_mesh
Pointer to the MooseMesh object.
static InputParameters zeroLayerGhosting()
This returns an InputParameters object containing an ElementSideNeighborLayers relationship manager w...
static bool isAlgebraic(Moose::RelationshipManagerType input_rm)
Whether input_rm is algebraic.
static Moose::RelationshipManagerType geo_and_alg
A relationship manager type that is geometric and algebraic.
static InputParameters oneLayerGhosting(Moose::RelationshipManagerType rm_type)
This returns an InputParameters object containing an ElementSideNeighborLayers relationship manager w...
virtual void set_mesh(const MeshBase *mesh)
MeshBase & mesh
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
RelationshipManagerType
Main types of Relationship Managers.
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...