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 "MFEMGeneralUserObject.h" 14 : #include "libmesh/ignore_warnings.h" 15 : #include <mfem.hpp> 16 : #include "libmesh/restore_warnings.h" 17 : 18 : /** 19 : * Base class for construction of a mfem::ParSubMesh object. Access using the 20 : * getSubMesh() accessor. 21 : */ 22 : class MFEMSubMesh : public MFEMGeneralUserObject 23 : { 24 : public: 25 : static InputParameters validParams(); 26 : 27 : MFEMSubMesh(const InputParameters & parameters); 28 : 29 : /// Returns a shared pointer to the constructed fespace. 30 12 : inline std::shared_ptr<mfem::ParSubMesh> getSubMesh() 31 : { 32 12 : if (!_submesh) 33 12 : buildSubMesh(); 34 12 : return _submesh; 35 : } 36 : 37 : protected: 38 : /// Stores the constructed submesh. 39 : std::shared_ptr<mfem::ParSubMesh> _submesh{nullptr}; 40 : /// Constructs the submesh. 41 : virtual void buildSubMesh() = 0; 42 : }; 43 : 44 : #endif