Line data Source code
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 "ElementPointNeighborLayers.h" 11 : #include "MooseMesh.h" 12 : #include "Conversion.h" 13 : #include "MooseApp.h" 14 : 15 : #include "libmesh/point_neighbor_coupling.h" 16 : 17 : using namespace libMesh; 18 : 19 : registerMooseObject("MooseApp", ElementPointNeighborLayers); 20 : 21 : InputParameters 22 322224 : ElementPointNeighborLayers::validParams() 23 : { 24 322224 : InputParameters params = FunctorRelationshipManager::validParams(); 25 : 26 1288896 : params.addRangeCheckedParam<unsigned short>( 27 : "layers", 28 644448 : 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 322224 : return params; 34 0 : } 35 : 36 130853 : ElementPointNeighborLayers::ElementPointNeighborLayers(const InputParameters & parameters) 37 261706 : : FunctorRelationshipManager(parameters), _layers(getParam<unsigned short>("layers")) 38 : { 39 130853 : } 40 : 41 46253 : ElementPointNeighborLayers::ElementPointNeighborLayers(const ElementPointNeighborLayers & others) 42 46253 : : FunctorRelationshipManager(others), _layers(others._layers) 43 : { 44 46253 : } 45 : 46 : std::unique_ptr<GhostingFunctor> 47 46253 : ElementPointNeighborLayers::clone() const 48 : { 49 46253 : return _app.getFactory().copyConstruct(*this); 50 : } 51 : 52 : std::string 53 79 : ElementPointNeighborLayers::getInfo() const 54 : { 55 79 : std::ostringstream oss; 56 79 : std::string layers = _layers == 1 ? "layer" : "layers"; 57 : 58 79 : oss << "ElementPointNeighborLayers (" << _layers << " " << layers << ')'; 59 : 60 158 : return oss.str(); 61 79 : } 62 : 63 : bool 64 323804 : ElementPointNeighborLayers::operator>=(const RelationshipManager & rhs) const 65 : { 66 323804 : const auto * rm = dynamic_cast<const ElementPointNeighborLayers *>(&rhs); 67 323804 : if (!rm) 68 232257 : return false; 69 : else 70 91547 : return _layers >= rm->_layers && baseGreaterEqual(*rm); 71 : } 72 : 73 : void 74 42654 : ElementPointNeighborLayers::internalInitWithMesh(const MeshBase &) 75 : { 76 42654 : auto functor = std::make_unique<PointNeighborCoupling>(); 77 42654 : functor->set_n_levels(_layers); 78 : 79 42654 : _functor = std::move(functor); 80 42654 : }