https://mooseframework.inl.gov
ProblemOperatorInterface.C
Go to the documentation of this file.
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 
13 
14 namespace Moose::MFEM
15 {
16 void
18 {
21 
22  // Set operator size and block structure
23  _block_true_offsets.SetSize(_trial_variables.size() + 1);
24  _block_true_offsets[0] = 0;
25  for (unsigned int ind = 0; ind < _trial_variables.size(); ++ind)
26  {
27  _block_true_offsets[ind + 1] = _trial_variables.at(ind)->ParFESpace()->TrueVSize();
28  }
29  _block_true_offsets.PartialSum();
30 
33 }
34 
35 void
36 ProblemOperatorInterface::Init(mfem::BlockVector & X)
37 {
38  X.Update(_block_true_offsets);
39  for (size_t i = 0; i < _test_variables.size(); ++i)
40  {
41  X.GetBlock(i) = _test_variables.at(i)->GetTrueVector();
42  _test_variables.at(i)->MakeTRef(_test_variables.at(i)->ParFESpace(), X, _block_true_offsets[i]);
43  }
44 }
45 
46 void
48 {
49  for (unsigned int ind = 0; ind < _test_variables.size(); ++ind)
50  {
51  _test_variables.at(ind)->SetFromTrueVector();
52  }
53 }
54 
55 void
57 {
58  for (unsigned int ind = 0; ind < _trial_variables.size(); ++ind)
59  {
60  _trial_variables.at(ind)->SetFromTrueVector();
61  }
62 }
63 
64 }
65 
66 #endif
std::vector< mfem::ParGridFunction * > _trial_variables
std::vector< mfem::ParGridFunction * > _test_variables
T * Get(const std::string &field_name) const
Returns a non-owning pointer to the field. This is guaranteed to return a non-null pointer...
Moose::MFEM::GridFunctions gridfunctions
virtual void Init(mfem::BlockVector &X)