LCOV - code coverage report
Current view: top level - src/mfem/problem_operators - ComplexEquationSystemProblemOperator.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 30 31 96.8 %
Date: 2026-05-29 20:35:17 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          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             : #include "ComplexEquationSystemProblemOperator.h"
      13             : 
      14             : namespace Moose::MFEM
      15             : {
      16             : void
      17          62 : ComplexEquationSystemProblemOperator::SetGridFunctions()
      18             : {
      19          62 :   _trial_var_names = GetEquationSystem()->GetTrialVarNames();
      20          62 :   _test_var_names = GetEquationSystem()->GetTestVarNames();
      21             : 
      22          62 :   _cmplx_trial_variables = _problem_data.cmplx_gridfunctions.Get(_trial_var_names);
      23          62 :   _cmplx_test_variables = _problem_data.cmplx_gridfunctions.Get(_test_var_names);
      24             : 
      25             :   // Set operator size and block structure for trial spaces
      26          62 :   _block_true_offsets_trial.SetSize(_cmplx_trial_variables.size() + 1);
      27          62 :   _block_true_offsets_trial[0] = 0;
      28         103 :   for (const auto ind : index_range(_cmplx_trial_variables))
      29             :   {
      30          41 :     _block_true_offsets_trial[ind + 1] =
      31          41 :         2 * _cmplx_trial_variables.at(ind)->ParFESpace()->TrueVSize();
      32             :   }
      33          62 :   _block_true_offsets_trial.PartialSum();
      34             : 
      35             :   // Set operator size and block structure for test spaces
      36          62 :   _block_true_offsets_test.SetSize(_cmplx_test_variables.size() + 1);
      37          62 :   _block_true_offsets_test[0] = 0;
      38         103 :   for (const auto ind : index_range(_cmplx_test_variables))
      39             :   {
      40          41 :     _block_true_offsets_test[ind + 1] =
      41          41 :         2 * _cmplx_test_variables.at(ind)->ParFESpace()->TrueVSize();
      42             :   }
      43          62 :   _block_true_offsets_test.PartialSum();
      44             : 
      45          62 :   _true_x.Update(_block_true_offsets_trial);
      46          62 :   _true_rhs.Update(_block_true_offsets_test);
      47             : 
      48          62 :   width = _block_true_offsets_trial[_cmplx_trial_variables.size()];
      49          62 :   height = _block_true_offsets_test[_cmplx_test_variables.size()];
      50          62 : }
      51             : 
      52             : void
      53          41 : ComplexEquationSystemProblemOperator::Solve()
      54             : {
      55          41 :   BuildEquationSystemOperator();
      56             : 
      57          41 :   if (_problem_data.jacobian_solver->isLOR())
      58           0 :     mooseError("LOR solve is not supported for complex equation systems.");
      59             : 
      60          41 :   _problem_data.nonlinear_solver->SetPreconditioner(_problem_data.jacobian_solver->getSolver());
      61          41 :   _problem_data.nonlinear_solver->SetOperator(*GetEquationSystem());
      62          41 :   _problem_data.nonlinear_solver->Mult(_true_rhs, _true_x);
      63             : 
      64          41 :   GetEquationSystem()->SetTrialVariablesFromTrueVectors(_true_x);
      65          41 : }
      66             : 
      67             : } // namespace Moose::MFEM
      68             : 
      69             : #endif

Generated by: LCOV version 1.14