LCOV - code coverage report
Current view: top level - include/problems - FFTProblem.h (source / functions) Hit Total Coverage
Test: idaholab/magpie: 5710af Lines: 6 8 75.0 %
Date: 2025-07-21 23:34:39 Functions: 2 3 66.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /**********************************************************************/
       2             : /*                     DO NOT MODIFY THIS HEADER                      */
       3             : /* MAGPIE - Mesoscale Atomistic Glue Program for Integrated Execution */
       4             : /*                                                                    */
       5             : /*            Copyright 2017 Battelle Energy Alliance, LLC            */
       6             : /*                        ALL RIGHTS RESERVED                         */
       7             : /**********************************************************************/
       8             : 
       9             : #pragma once
      10             : 
      11             : #include "FEProblem.h"
      12             : #include "AuxiliarySystem.h"
      13             : #include "FFTBufferBase.h"
      14             : 
      15             : /**
      16             :  * Enhanced FEProblem that supports FFT buffers as variables
      17             :  */
      18             : class FFTProblem : public FEProblem
      19             : {
      20             : public:
      21             :   static InputParameters validParams();
      22             : 
      23             :   FFTProblem(const InputParameters & parameters);
      24             : 
      25             :   virtual bool hasVariable(const std::string & var_name) const override;
      26             :   virtual MooseVariableFEBase & getVariable(
      27             :       THREAD_ID tid,
      28             :       const std::string & var_name,
      29             :       Moose::VarKindType expected_var_type = Moose::VarKindType::VAR_ANY,
      30             :       Moose::VarFieldType expected_var_field_type = Moose::VarFieldType::VAR_FIELD_ANY) override;
      31             : 
      32             :   template <typename T>
      33             :   FFTBufferBase<T> & getFFTBuffer(const std::string & name);
      34             : 
      35             : protected:
      36             :   /// map from variable name to list of variable objects (one per thread)
      37             :   std::map<std::string, std::vector<std::unique_ptr<MooseVariableFEBase>>> _fft_vars;
      38             : 
      39             :   /// dummy system for the FFT variables
      40             :   AuxiliarySystem _fft_dummy_system;
      41             : };
      42             : 
      43             : template <typename T>
      44             : FFTBufferBase<T> &
      45          12 : FFTProblem::getFFTBuffer(const std::string & name)
      46             : {
      47             :   std::vector<UserObject *> objs;
      48          24 :   theWarehouse().query().condition<AttribThread>(0).condition<AttribName>(name).queryInto(objs);
      49          12 :   if (objs.empty())
      50           0 :     mooseError("Unable to find FFT buffer with name '" + name + "'");
      51          12 :   auto fft_buffer = dynamic_cast<FFTBufferBase<T> *>(objs[0]);
      52          12 :   if (!fft_buffer)
      53           0 :     mooseError(name, " is not an FFT buffer of the requested type");
      54             : 
      55          12 :   return *fft_buffer;
      56             : }

Generated by: LCOV version 1.14