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 : #pragma once 11 : 12 : #include "RelationshipManager.h" 13 : 14 : #include "libmesh/ghosting_functor.h" 15 : 16 : class MooseMesh; 17 : 18 : /** 19 : * Intermediate base class for RelationshipManagers that are simply built 20 : * using ghosting functors. The functor should be built in internalInit() 21 : * and set as _functor 22 : */ 23 : class FunctorRelationshipManager : public RelationshipManager 24 : { 25 : public: 26 : static InputParameters validParams(); 27 : 28 : FunctorRelationshipManager(const InputParameters & parameters); 29 : 30 : FunctorRelationshipManager(const FunctorRelationshipManager & other); 31 : 32 : virtual void operator()(const MeshBase::const_element_iterator & range_begin, 33 : const MeshBase::const_element_iterator & range_end, 34 : processor_id_type p, 35 : map_type & coupled_elements) override; 36 : 37 : virtual void mesh_reinit() override; 38 : 39 : virtual void dofmap_reinit() override; 40 : 41 : virtual void redistribute() override; 42 : 43 : virtual void delete_remote_elements() override; 44 : 45 : /** 46 : * It is often called after cloning a ghosting functor/RM. 47 : * It is essential because the operations in a ghosting functor are mesh-dependent. 48 : */ 49 167588 : virtual void set_mesh(const MeshBase * mesh) override 50 : { 51 167588 : if (_functor) 52 : { 53 167588 : _functor->set_mesh(mesh); 54 167588 : _mesh = mesh; 55 : } 56 : else 57 0 : mooseError("functor does not exist"); 58 167588 : } 59 : 60 : protected: 61 : std::unique_ptr<GhostingFunctor> _functor; 62 : };