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 : #ifdef MFEM_ENABLED 11 : 12 : #pragma once 13 : #include "GeneralUserObject.h" 14 : #include "libmesh/ignore_warnings.h" 15 : #include <mfem.hpp> 16 : #include "mfem/miniapps/common/mfem-common.hpp" 17 : #include "libmesh/restore_warnings.h" 18 : 19 : /** 20 : * Base class for construction of an object that is restricted to a subset 21 : * of boundaries of the problem mesh. 22 : */ 23 : class MFEMBoundaryRestrictable 24 : { 25 : public: 26 : static InputParameters validParams(); 27 : 28 : MFEMBoundaryRestrictable(const InputParameters & parameters, const mfem::ParMesh & mfem_mesh); 29 : 30 : mfem::Array<int> boundariesToAttributes(const std::vector<BoundaryName> & boundary_names); 31 : 32 : /// Returns a bool indicating if the object is restricted to a subset of boundaries 33 52 : bool isBoundaryRestricted() const 34 : { 35 52 : return !(_boundary_attributes.Size() == 1 && _boundary_attributes[0] == -1); 36 : } 37 : 38 192 : const mfem::ParMesh & getMesh() { return _mfem_mesh; } 39 4 : const mfem::Array<int> & getBoundaryAttributes() { return _boundary_attributes; } 40 632 : mfem::Array<int> & getBoundaryMarkers() { return _boundary_markers; } 41 : 42 : protected: 43 : /// Stores the names of the boundaries. 44 : const mfem::ParMesh & _mfem_mesh; 45 : /// Stores the names of the boundaries. 46 : std::vector<BoundaryName> _boundary_names; 47 : /// Array storing boundary attribute IDs for this object. 48 : mfem::Array<int> _boundary_attributes; 49 : /// Boolean array indicating which boundaries are active in this object. 50 : mfem::Array<int> _boundary_markers; 51 : }; 52 : 53 : #endif