LCOV - code coverage report
Current view: top level - include/interfaces - LazyCoupleable.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 0 1 0.0 %
Date: 2025-07-17 01:28:37 Functions: 0 2 0.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             : #pragma once
      11             : 
      12             : // MOOSE includes
      13             : #include "MooseVariableBase.h"
      14             : 
      15             : // Forward declarations
      16             : class InputParameters;
      17             : class MooseObject;
      18             : class MooseApp;
      19             : 
      20             : /**
      21             :  * Interface for objects that need coupling capabilities
      22             :  *
      23             :  */
      24             : class LazyCoupleable
      25             : {
      26             : public:
      27             :   /**
      28             :    * Constructing the object
      29             :    * @param parameters Parameters that come from constructing the object
      30             :    * @param nodal true if we need to couple with nodal values, otherwise false
      31             :    */
      32             :   LazyCoupleable(const MooseObject * moose_object);
      33             : 
      34           0 :   virtual ~LazyCoupleable() = default;
      35             : 
      36             :   /**
      37             :    * Sets the FEProblem pointer which can (and is expected) to happen long after this interface is
      38             :    * constructed. Once this pointer is set, this interface can retrieve the information it requires
      39             :    * from the underlying class and the internal methods can be called. Errors are throw if internal
      40             :    * methods are called when this pointer is nullptr.
      41             :    */
      42             :   void setFEProblemPtr(FEProblemBase * fe_problem);
      43             : 
      44             : private:
      45             :   void init();
      46             : 
      47             :   /**
      48             :    * Returns the index for a coupled variable by name
      49             :    * @param var_name Name of coupled variable
      50             :    * @param comp Component number for vector of coupled variables
      51             :    * @return Index of coupled variable, if this is an optionally coupled variable that wasn't
      52             :    * provided this will return a unique "invalid" index.
      53             :    */
      54             :   unsigned int & coupled(const std::string & var_name, unsigned int comp = 0);
      55             : 
      56             :   // Reference to the interface's input parameters
      57             :   const InputParameters & _l_parameters;
      58             : 
      59             :   /// The name of the object this interface is part of
      60             :   const std::string & _l_name;
      61             : 
      62             :   /// Reference to FEProblemBase
      63             :   FEProblemBase * _l_fe_problem;
      64             : 
      65             :   /// Reference to the MooseApp
      66             :   MooseApp & _l_app;
      67             : 
      68             :   /// Coupled vars whose values we provide
      69             :   std::map<std::string, std::unique_ptr<unsigned int>> _coupled_var_numbers;
      70             : };

Generated by: LCOV version 1.14