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 327844 : ElementPointNeighborLayers::validParams() 23 : { 24 327844 : InputParameters params = FunctorRelationshipManager::validParams(); 25 : 26 1311376 : params.addRangeCheckedParam<unsigned short>( 27 : "layers", 28 655688 : 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 327844 : return params; 34 0 : } 35 : 36 133060 : ElementPointNeighborLayers::ElementPointNeighborLayers(const InputParameters & parameters) 37 266120 : : FunctorRelationshipManager(parameters), _layers(getParam<unsigned short>("layers")) 38 : { 39 133060 : } 40 : 41 46979 : ElementPointNeighborLayers::ElementPointNeighborLayers(const ElementPointNeighborLayers & others) 42 46979 : : FunctorRelationshipManager(others), _layers(others._layers) 43 : { 44 46979 : } 45 : 46 : std::unique_ptr<GhostingFunctor> 47 46979 : ElementPointNeighborLayers::clone() const 48 : { 49 46979 : 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 327597 : ElementPointNeighborLayers::operator>=(const RelationshipManager & rhs) const 65 : { 66 327597 : const auto * rm = dynamic_cast<const ElementPointNeighborLayers *>(&rhs); 67 327597 : if (!rm) 68 234625 : return false; 69 : else 70 92972 : return _layers >= rm->_layers && baseGreaterEqual(*rm); 71 : } 72 : 73 : void 74 43380 : ElementPointNeighborLayers::internalInitWithMesh(const MeshBase &) 75 : { 76 43380 : auto functor = std::make_unique<PointNeighborCoupling>(); 77 43380 : functor->set_n_levels(_layers); 78 : 79 43380 : _functor = std::move(functor); 80 43380 : }