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
15{
17
33 params.addPrivateParam<bool>("attach_geometric_early", true);
34
43
47 params.addRequiredParam<std::string>("for_whom", "What object is requesting this RM?");
48
49 params.addParam<bool>(
50 "use_displaced_mesh",
51 false,
52 "Whether this RM should be placed on the undisplaced or displaced problem. Note: yes, it "
53 "still says 'mesh' to match with common parameter name in MOOSE - but if it's purely "
54 "algebraic then it's going to the DofMap no matter what!");
55
56 // Set by MOOSE
57 params.addPrivateParam<MooseMesh *>("mesh");
58 params.registerBase("RelationshipManager");
59 return params;
60}
61
63 : MooseObject(parameters),
64 GhostingFunctor(),
65 _moose_mesh(getCheckedPointerParam<MooseMesh *>(
66 "mesh",
67 "Mesh is null in RelationshipManager constructor. This could well be because No mesh file "
68 "was supplied and no generation block was provided")),
69 _attach_geometric_early(getParam<bool>("attach_geometric_early")),
70 _rm_type(getParam<Moose::RelationshipManagerType>("rm_type")),
71 _use_displaced_mesh(getParam<bool>("use_displaced_mesh"))
72{
73 _for_whom.push_back(getParam<std::string>("for_whom"));
74}
75
77 : MooseObject(other._pars),
78 GhostingFunctor(other),
79 _moose_mesh(other._moose_mesh),
80 _attach_geometric_early(other._attach_geometric_early),
81 _rm_type(other._rm_type),
82 _for_whom(other._for_whom),
83 _use_displaced_mesh(other._use_displaced_mesh)
84{
85}
86
87bool
93
94bool
100
101bool
107
108bool
110{
111 // !attach early = attach late
112 // If we are supposed to be attached late, then we should take precedence over the rhs. You can
113 // think of this as being >= because we if we are attaching late, then we are asking that *all*
114 // elements be geometrically ghosted during the initial mesh preparation phase. We will only allow
115 // remote elements to be deleted later on after addition of late geomeric ghosting functors (at
116 // the same time as algebraic and coupling)
118}
119
122
126
129{
130 auto params = emptyInputParameters();
131 params.registerBase("dummy");
132 return params;
133}
134
137{
138 auto params = dummyParams();
139 params.addRelationshipManager("ElementSideNeighborLayers",
141 [](const InputParameters &, InputParameters & rm_params)
142 { rm_params.set<unsigned short>("layers") = 0; });
143 return params;
144}
145
148{
149 auto params = dummyParams();
150 params.addRelationshipManager("ElementSideNeighborLayers", rm_type);
151 return params;
152}
153
154void
156 const MeshBase & mesh,
157 const libMesh::DofMap * const dof_map)
158{
159 mooseAssert(_dof_map ? dof_map == _dof_map : true,
160 "Trying to initialize with a different dof map");
161
162 _dof_map = dof_map;
163 // During the mesh generation phase we haven't set the mesh base in the moose mesh yet
164 if (moose_mesh.getMeshPtr())
165 mooseAssert(moose_mesh.getMeshPtr() == &mesh, "These should match");
166 _moose_mesh = &moose_mesh;
167
168 // It is conceivable that this init method gets called twice, once during early geometric setup
169 // and later when we're doing algebraic/coupling (and late geometric) setup. There might be new
170 // information available during the latter call that the derived RelationshipManager can
171 // leverage, so we should make sure we call through to internal init both times
173
174 // One would hope that internalInitWithMesh set the mesh, but we can't be sure
175 set_mesh(&mesh);
176
177 _inited = true;
178}
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:3551
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.