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 // Forward declarations
20 class MooseMesh;
21 
22 template <>
24 
31 class RelationshipManager : public MooseObject, public libMesh::GhostingFunctor
32 {
33 public:
35 
39  void init()
40  {
41  _inited = true;
42  internalInit();
43  }
44 
48  bool inited() { return _inited; }
49 
53  virtual const std::vector<std::string> & forWhom() const { return _for_whom; }
54 
58  void addForWhom(const std::string & for_whom) { _for_whom.push_back(for_whom); }
59 
63  virtual std::string getInfo() const = 0;
64 
69 
76  {
77  return (_rm_type & type) == type;
78  }
79 
80  virtual bool operator==(const RelationshipManager & /*rhs*/) const
81  {
82  mooseError("Comparison operator required for this RelationshipManager required");
83  }
84 
91 
98  bool useDisplacedMesh() const { return _use_displaced_mesh; }
99 
100 protected:
104  virtual void internalInit() = 0;
105 
107  bool _inited = false;
108 
111 
116 
120 
122  std::vector<std::string> _for_whom;
123 
126 };
127 
RelationshipManagerType
Main types of Relationship Managers.
Definition: MooseTypes.h:716
virtual void internalInit()=0
Called before this RM is attached.
std::vector< std::string > _for_whom
The name of the object that requires this RelationshipManager.
MooseMesh & _mesh
Reference to the Mesh object.
bool inited()
Whether or not this RM has been inited.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
bool _inited
Whether or not this has been initialized.
void mooseError(Args &&... args) const
Definition: MooseObject.h:147
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.
InputParameters validParams< RelationshipManager >()
const std::string & type() const
Get the type of this object.
Definition: MooseObject.h:53
Moose::RelationshipManagerType getType() const
Getter for returning the enum type for this RM.
void init()
Called before this RM is attached.
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:42
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:65
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:74
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 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...
bool useDisplacedMesh() const
Whether this should be placed on the undisplaced or displaced systems.