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 MOOSE_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 1843 : inline std::shared_ptr<mfem::ParGridFunction> getGridFunction() const { return _gridfunction; } 29 : 30 : /// Returns a reference to the fespace used by the gridfunction. 31 879 : inline const MFEMFESpace & getFESpace() const { return _fespace; } 32 : 33 : /// Returns the variable name corresponding to the time derivative of the MFEMVariable. 34 128 : inline const VariableName & getTimeDerivativeName() const { return _time_derivative_name; } 35 : 36 : protected: 37 : const MFEMFESpace & _fespace; 38 : 39 : private: 40 : /// Constructs the gridfunction. 41 : const std::shared_ptr<mfem::ParGridFunction> buildGridFunction(); 42 : 43 : /// Stores the constructed gridfunction. 44 : const std::shared_ptr<mfem::ParGridFunction> _gridfunction{nullptr}; 45 : 46 : /// Optional name of the time derivative to associate with this variable in transient problems. 47 : const VariableName _time_derivative_name; 48 : }; 49 : 50 : #endif