https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ElementPointNeighborLayers.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
11#include "MooseMesh.h"
12#include "Conversion.h"
13#include "MooseApp.h"
14
15#include "libmesh/point_neighbor_coupling.h"
16
18
21{
23
24 params.addRangeCheckedParam<unsigned short>(
25 "layers",
26 1,
27 "element_side_neighbor_layers>=1 & element_side_neighbor_layers<=10",
28 "The number of additional geometric elements to make available when "
29 "using distributed mesh. No effect with replicated mesh.");
30
31 return params;
32}
33
35 : FunctorRelationshipManager(parameters), _layers(getParam<unsigned short>("layers"))
36{
37}
38
43
44std::unique_ptr<libMesh::GhostingFunctor>
49
50std::string
52{
53 std::ostringstream oss;
54 std::string layers = _layers == 1 ? "layer" : "layers";
55
56 oss << "ElementPointNeighborLayers (" << _layers << " " << layers << ')';
57
58 return oss.str();
59}
60
61bool
63{
64 const auto * rm = dynamic_cast<const ElementPointNeighborLayers *>(&rhs);
65 if (!rm)
66 return false;
67 else
68 return _layers >= rm->_layers && baseGreaterEqual(*rm);
69}
70
71void
73{
74 auto functor = std::make_unique<libMesh::PointNeighborCoupling>();
75 functor->set_n_levels(_layers);
76
77 _functor = std::move(functor);
78}
registerMooseObject("MooseApp", ElementPointNeighborLayers)
ElementPointNeighborLayers is used to increase the halo or stencil depth of each processor's partitio...
virtual std::unique_ptr< GhostingFunctor > clone() const override
A clone() is needed because GhostingFunctor can not be shared between different meshes.
ElementPointNeighborLayers(const InputParameters &parameters)
virtual void internalInitWithMesh(const MeshBase &) override
Called before this RM is attached.
unsigned short _layers
Size of the halo or stencil of elements available in each local processors partition.
static InputParameters validParams()
virtual bool operator>=(const RelationshipManager &rhs) const override
Whether this relationship manager provides more or the same amount and type of ghosting as the rhs.
virtual std::string getInfo() const override
Method for returning relationship manager information (suitable for console output).
std::unique_ptr< T > copyConstruct(const T &object)
Copy constructs the object object.
Definition Factory.h:358
Intermediate base class for RelationshipManagers that are simply built using ghosting functors.
static InputParameters validParams()
std::unique_ptr< GhostingFunctor > _functor
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
Factory & getFactory()
Retrieve a writable reference to the Factory associated with this App.
Definition MooseApp.h:407
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...
virtual bool baseGreaterEqual(const RelationshipManager &rhs) const
Whether the base class provides more or the same amount and type of ghosting as the rhs.