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 "MFEMProblemData.h" 14 : 15 : namespace Moose::MFEM 16 : { 17 : /// Interface inherited by ProblemOperator and TimeDomainProblemOperator. Removes duplicated code in both classes. 18 : class ProblemOperatorInterface 19 : { 20 : public: 21 134 : ProblemOperatorInterface(MFEMProblemData & problem) : _problem(problem) {} 22 134 : virtual ~ProblemOperatorInterface() = default; 23 : 24 : virtual void SetGridFunctions(); 25 : virtual void SetTestVariablesFromTrueVectors(); 26 : virtual void SetTrialVariablesFromTrueVectors(); 27 : virtual void Init(mfem::BlockVector & X); 28 : 29 : mfem::Array<int> _block_true_offsets; 30 : 31 : mfem::BlockVector _true_x, _true_rhs; 32 : mfem::OperatorHandle _equation_system_operator; 33 : 34 : protected: 35 : // Reference to the current problem. 36 : MFEMProblemData & _problem; 37 : 38 : // Vector of names of state gridfunctions used in formulation, ordered by appearance in block 39 : // vector during solve. 40 : std::vector<std::string> _test_var_names; 41 : std::vector<mfem::ParGridFunction *> _test_variables; 42 : 43 : // Vector of names of state gridfunctions used in formulation, ordered by appearance in block 44 : // vector during solve. 45 : std::vector<std::string> _trial_var_names; 46 : std::vector<mfem::ParGridFunction *> _trial_variables; 47 : }; 48 : } 49 : 50 : #endif