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
17using namespace libMesh;
18
20
23{
25
26 params.addRangeCheckedParam<unsigned short>(
27 "layers",
28 1,
29 "element_side_neighbor_layers>=1 & element_side_neighbor_layers<=10",
30 "The number of additional geometric elements to make available when "
31 "using distributed mesh. No effect with replicated mesh.");
32
33 return params;
34}
35
37 : FunctorRelationshipManager(parameters), _layers(getParam<unsigned short>("layers"))
38{
39}
40
45
46std::unique_ptr<GhostingFunctor>
48{
49 return _app.getFactory().copyConstruct(*this);
50}
51
52std::string
54{
55 std::ostringstream oss;
56 std::string layers = _layers == 1 ? "layer" : "layers";
57
58 oss << "ElementPointNeighborLayers (" << _layers << " " << layers << ')';
59
60 return oss.str();
61}
62
63bool
65{
66 const auto * rm = dynamic_cast<const ElementPointNeighborLayers *>(&rhs);
67 if (!rm)
68 return false;
69 else
70 return _layers >= rm->_layers && baseGreaterEqual(*rm);
71}
72
73void
75{
76 auto functor = std::make_unique<PointNeighborCoupling>();
77 functor->set_n_levels(_layers);
78
79 _functor = std::move(functor);
80}
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).
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.
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...