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 : 14 : #include "MFEMFESpace.h" 15 : #include "MFEMGeneralUserObject.h" 16 : 17 : /** 18 : * Constructs and stores an mfem::ParGridFunction object. 19 : */ 20 : class MFEMVariable : public MFEMGeneralUserObject 21 : { 22 : public: 23 : static InputParameters validParams(); 24 : 25 : MFEMVariable(const InputParameters & parameters); 26 : 27 : /// Returns a shared pointer to the constructed gridfunction. 28 550 : inline std::shared_ptr<mfem::ParGridFunction> getGridFunction() const { return _gridfunction; } 29 : 30 : /// Returns a reference to the fespace used by the gridfunction. 31 250 : inline const MFEMFESpace & getFESpace() const { return _fespace; } 32 : 33 : protected: 34 : const MFEMFESpace & _fespace; 35 : 36 : private: 37 : /// Constructs the gridfunction. 38 : const std::shared_ptr<mfem::ParGridFunction> buildGridFunction(); 39 : 40 : /// Stores the constructed gridfunction. 41 : const std::shared_ptr<mfem::ParGridFunction> _gridfunction{nullptr}; 42 : }; 43 : 44 : #endif