www.mooseframework.org
RelationshipManager.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 #pragma once
11 
12 #include "MooseObject.h"
13 #include "InputParameters.h"
14 #include "MooseMesh.h"
15 
16 #include "libmesh/ghosting_functor.h"
17 
18 class MooseMesh;
19 
27 {
28 public:
30 
32 
34 
38  void init(MooseMesh & moose_mesh, const MeshBase & mesh, const DofMap * dof_map = nullptr);
39 
47  bool inited() { return _inited; }
48 
52  virtual const std::vector<std::string> & forWhom() const { return _for_whom; }
53 
57  void addForWhom(const std::string & for_whom) { _for_whom.push_back(for_whom); }
58 
62  virtual std::string getInfo() const = 0;
63 
68 
75  {
76  return (_rm_type & type) == type;
77  }
78 
79  virtual bool operator==(const RelationshipManager & /*rhs*/) const
80  {
81  mooseError("RelationshipManager::operator>= must be overridden");
82  }
83 
88  virtual bool operator>=(const RelationshipManager & rhs) const
89  {
91  "Are you overriding RelationshipManager::operator==? We are transitioning to make "
92  "operator>= "
93  "the required override. If you are not overriding operator>= or operator==, you are about "
94  "to get an error message saying that operator>= must be overridden.");
95 
96  return *this == rhs;
97  }
98 
103  virtual bool baseGreaterEqual(const RelationshipManager & rhs) const;
104 
111 
118  bool useDisplacedMesh() const { return _use_displaced_mesh; }
119 
120  const DofMap * dofMap() { return _dof_map; }
121 
122 protected:
126  virtual void internalInitWithMesh(const MeshBase &) { internalInit(); }
127  virtual void internalInit() {}
128 
130  bool _inited = false;
131 
135 
138  const DofMap * _dof_map = nullptr;
139 
144 
148 
150  std::vector<std::string> _for_whom;
151 
154 
155 public:
159  static bool isGeometric(Moose::RelationshipManagerType input_rm);
160 
164  static bool isAlgebraic(Moose::RelationshipManagerType input_rm);
165 
169  static bool isCoupling(Moose::RelationshipManagerType input_rm);
170 
175 
180 
189 
197 };
const DofMap * dofMap()
static bool isCoupling(Moose::RelationshipManagerType input_rm)
Whether input_rm is coupling.
RelationshipManagerType
Main types of Relationship Managers.
Definition: MooseTypes.h:876
void mooseDeprecated(Args &&... args) const
static bool isGeometric(Moose::RelationshipManagerType input_rm)
Whether input_rm is geometric.
std::vector< std::string > _for_whom
The name of the object that requires this RelationshipManager.
MeshBase & mesh
bool inited()
Whether or not this RM has been inited.
MooseMesh * _moose_mesh
Pointer to the MooseMesh object.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
bool _inited
Whether or not this has been initialized.
virtual const std::vector< std::string > & forWhom() const
The object (or Action) this RelationshipManager was built for.
bool attachGeometricEarly()
Whether or not this RM can be attached to the Mesh early if it&#39;s geometric.
const bool _attach_geometric_early
Boolean indicating whether this RM can be attached early (e.g.
virtual bool operator>=(const RelationshipManager &rhs) const
Whether this relationship manager provides more or the same amount and type of ghosting as the rhs...
Moose::RelationshipManagerType getType() const
Getter for returning the enum type for this RM.
static InputParameters oneLayerGhosting(Moose::RelationshipManagerType rm_type)
This returns an InputParameters object containing an ElementSideNeighborLayers relationship manager w...
Moose::RelationshipManagerType _rm_type
The type of RM this object is.
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:33
static Moose::RelationshipManagerType geo_and_alg
A relationship manager type that is geometric and algebraic.
const DofMap * _dof_map
Pointer to DofMap (may be null if this is geometric only).
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:88
const std::string & type() const
Get the type of this class.
Definition: MooseBase.h:50
virtual void internalInit()
virtual void internalInitWithMesh(const MeshBase &)
Called before this RM is attached.
void init(MooseMesh &moose_mesh, const MeshBase &mesh, const DofMap *dof_map=nullptr)
Called before this RM is attached.
bool isType(const Moose::RelationshipManagerType &type) const
Check to see if an RM is of a given type.
virtual bool operator==(const RelationshipManager &) const
virtual bool baseGreaterEqual(const RelationshipManager &rhs) const
Whether the base class provides more or the same amount and type of ghosting as the rhs...
virtual std::string getInfo() const =0
Method for returning relationship manager information (suitable for console output).
void addForWhom(const std::string &for_whom)
Add another name to for_whom.
RelationshipManager(const InputParameters &parameters)
const bool _use_displaced_mesh
Which system this should go to (undisplaced or displaced)
RelationshipManagers are used for describing what kinds of non-local resources are needed for an obje...
static InputParameters validParams()
static InputParameters zeroLayerGhosting()
This returns an InputParameters object containing an ElementSideNeighborLayers relationship manager w...
static Moose::RelationshipManagerType geo_alg_and_coupl
A relationship manager type that is geometric, algebraic, and coupling.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
const InputParameters & parameters() const
Get the parameters of the object.
bool useDisplacedMesh() const
Whether this should be placed on the undisplaced or displaced systems.
static bool isAlgebraic(Moose::RelationshipManagerType input_rm)
Whether input_rm is algebraic.