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 : #include "ProblemOperatorInterface.h" 13 : 14 : namespace Moose::MFEM 15 : { 16 : void 17 134 : ProblemOperatorInterface::SetGridFunctions() 18 : { 19 134 : _test_variables = _problem.gridfunctions.Get(_test_var_names); 20 134 : _trial_variables = _problem.gridfunctions.Get(_trial_var_names); 21 : 22 : // Set operator size and block structure 23 134 : _block_true_offsets.SetSize(_trial_variables.size() + 1); 24 134 : _block_true_offsets[0] = 0; 25 236 : for (unsigned int ind = 0; ind < _trial_variables.size(); ++ind) 26 : { 27 102 : _block_true_offsets[ind + 1] = _trial_variables.at(ind)->ParFESpace()->TrueVSize(); 28 : } 29 134 : _block_true_offsets.PartialSum(); 30 : 31 134 : _true_x.Update(_block_true_offsets); 32 134 : _true_rhs.Update(_block_true_offsets); 33 134 : } 34 : 35 : void 36 134 : ProblemOperatorInterface::Init(mfem::BlockVector & X) 37 : { 38 134 : X.Update(_block_true_offsets); 39 158 : for (size_t i = 0; i < _test_variables.size(); ++i) 40 : { 41 24 : X.GetBlock(i) = _test_variables.at(i)->GetTrueVector(); 42 24 : _test_variables.at(i)->MakeTRef(_test_variables.at(i)->ParFESpace(), X, _block_true_offsets[i]); 43 : } 44 134 : } 45 : 46 : void 47 136 : ProblemOperatorInterface::SetTestVariablesFromTrueVectors() 48 : { 49 272 : for (unsigned int ind = 0; ind < _test_variables.size(); ++ind) 50 : { 51 136 : _test_variables.at(ind)->SetFromTrueVector(); 52 : } 53 136 : } 54 : 55 : void 56 68 : ProblemOperatorInterface::SetTrialVariablesFromTrueVectors() 57 : { 58 136 : for (unsigned int ind = 0; ind < _trial_variables.size(); ++ind) 59 : { 60 68 : _trial_variables.at(ind)->SetFromTrueVector(); 61 : } 62 68 : } 63 : 64 : } 65 : 66 : #endif