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 "MooseObject.h" 15 : #include "FunctionInterface.h" 16 : #include "PostprocessorInterface.h" 17 : #include "VectorPostprocessorInterface.h" 18 : #include "ReporterInterface.h" 19 : 20 : class MFEMProblem; 21 : 22 : /** 23 : * Thin base for MFEM objects backed directly by MooseObject instead of UserObject. 24 : */ 25 : class MFEMObject : public MooseObject, 26 : protected FunctionInterface, 27 : protected PostprocessorInterface, 28 : protected VectorPostprocessorInterface, 29 : protected ReporterInterface 30 : { 31 : public: 32 : /** 33 : * Declare the common parameters required by MFEM MooseObject-backed classes. 34 : */ 35 : static InputParameters validParams(); 36 : 37 : /** 38 : * Construct an MFEM object backed directly by MooseObject. 39 : */ 40 : MFEMObject(const InputParameters & parameters); 41 : 42 : /** 43 : * Return the owning MFEM problem. 44 : */ 45 39736 : MFEMProblem & getMFEMProblem() { return _mfem_problem; } 46 : /** 47 : * Return the owning MFEM problem. 48 : */ 49 : const MFEMProblem & getMFEMProblem() const { return _mfem_problem; } 50 : 51 : /** 52 : * Retrieve a scalar MFEM coefficient by its declared name. 53 : */ 54 : mfem::Coefficient & getScalarCoefficientByName(const MFEMScalarCoefficientName & name); 55 : /** 56 : * Retrieve a vector MFEM coefficient by its declared name. 57 : */ 58 : mfem::VectorCoefficient & getVectorCoefficientByName(const MFEMVectorCoefficientName & name); 59 : /** 60 : * Retrieve a matrix MFEM coefficient by its declared name. 61 : */ 62 : mfem::MatrixCoefficient & getMatrixCoefficientByName(const MFEMMatrixCoefficientName & name); 63 : /** 64 : * Retrieve a scalar MFEM coefficient using the value of an input parameter. 65 : */ 66 : mfem::Coefficient & getScalarCoefficient(const std::string & name); 67 : /** 68 : * Retrieve a vector MFEM coefficient using the value of an input parameter. 69 : */ 70 : mfem::VectorCoefficient & getVectorCoefficient(const std::string & name); 71 : /** 72 : * Retrieve a matrix MFEM coefficient using the value of an input parameter. 73 : */ 74 : mfem::MatrixCoefficient & getMatrixCoefficient(const std::string & name); 75 : 76 : private: 77 : /// Owning MFEM problem for this object. 78 : MFEMProblem & _mfem_problem; 79 : }; 80 : 81 : #endif