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 296847 : ElementPointNeighborLayers::validParams() 23 : { 24 296847 : InputParameters params = FunctorRelationshipManager::validParams(); 25 : 26 890541 : params.addRangeCheckedParam<unsigned short>( 27 : "layers", 28 593694 : 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 296847 : return params; 34 0 : } 35 : 36 120013 : ElementPointNeighborLayers::ElementPointNeighborLayers(const InputParameters & parameters) 37 120013 : : FunctorRelationshipManager(parameters), _layers(getParam<unsigned short>("layers")) 38 : { 39 120013 : } 40 : 41 42556 : ElementPointNeighborLayers::ElementPointNeighborLayers(const ElementPointNeighborLayers & others) 42 42556 : : FunctorRelationshipManager(others), _layers(others._layers) 43 : { 44 42556 : } 45 : 46 : std::unique_ptr<GhostingFunctor> 47 42556 : ElementPointNeighborLayers::clone() const 48 : { 49 42556 : return _app.getFactory().copyConstruct(*this); 50 : } 51 : 52 : std::string 53 73 : ElementPointNeighborLayers::getInfo() const 54 : { 55 73 : std::ostringstream oss; 56 73 : std::string layers = _layers == 1 ? "layer" : "layers"; 57 : 58 73 : oss << "ElementPointNeighborLayers (" << _layers << " " << layers << ')'; 59 : 60 146 : return oss.str(); 61 73 : } 62 : 63 : bool 64 326097 : ElementPointNeighborLayers::operator>=(const RelationshipManager & rhs) const 65 : { 66 326097 : const auto * rm = dynamic_cast<const ElementPointNeighborLayers *>(&rhs); 67 326097 : if (!rm) 68 241751 : return false; 69 : else 70 84346 : return _layers >= rm->_layers && baseGreaterEqual(*rm); 71 : } 72 : 73 : void 74 39287 : ElementPointNeighborLayers::internalInitWithMesh(const MeshBase &) 75 : { 76 39287 : auto functor = std::make_unique<PointNeighborCoupling>(); 77 39287 : functor->set_n_levels(_layers); 78 : 79 39287 : _functor = std::move(functor); 80 39287 : }