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 "MFEMObject.h" 15 : 16 : /** 17 : * Constructs and stores an mfem::ParGridFunction object. 18 : */ 19 : class MFEMVariable : public MFEMObject 20 : { 21 : public: 22 : static InputParameters validParams(); 23 : 24 : MFEMVariable(const InputParameters & parameters); 25 : 26 : /// Returns a shared pointer to the constructed gridfunction. 27 10840 : std::shared_ptr<mfem::ParGridFunction> getGridFunction() const { return _gridfunction; } 28 : 29 : /// Returns the variable name corresponding to the time derivative of the MFEMVariable. 30 225 : const VariableName & getTimeDerivativeName() const { return _time_derivative_name; } 31 : 32 : /// Declare default coefficients associated with this gridfunction 33 : void declareCoefficients(); 34 : 35 : protected: 36 : /// The underlying MFEM FESpace - always populated regardless of which parameter was used. 37 : std::shared_ptr<mfem::ParFiniteElementSpace> _par_fespace; 38 : bool _is_scalar = false; 39 : 40 : private: 41 : /// Constructs the gridfunction. 42 : const std::shared_ptr<mfem::ParGridFunction> buildGridFunction(); 43 : 44 : /// Stores the constructed gridfunction. 45 : std::shared_ptr<mfem::ParGridFunction> _gridfunction = nullptr; 46 : 47 : /// Optional name of the time derivative to associate with this variable in transient problems. 48 : const VariableName _time_derivative_name; 49 : }; 50 : 51 : #endif