LCOV - code coverage report
Current view: top level - include/actioncomponents - ComponentBoundaryConditionInterface.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 1 1 100.0 %
Date: 2025-07-17 01:28:37 Functions: 1 1 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             : #pragma once
      11             : 
      12             : #include "ActionComponent.h"
      13             : #include "InputParameters.h"
      14             : #include "MooseTypes.h"
      15             : 
      16             : /**
      17             :  * Helper class to help Components accept boundary condition parameters that the Physics may use
      18             :  * to generate the adequate boundary conditions
      19             :  * Note: Trying out virtual inheritance. It makes things
      20             :  *       a little easier to define as we can use the attributes
      21             :  *       of the underlying ActionComponent
      22             :  */
      23             : class ComponentBoundaryConditionInterface : public virtual ActionComponent
      24             : {
      25             : public:
      26             :   static InputParameters validParams();
      27             : 
      28             :   ComponentBoundaryConditionInterface(const InputParameters & params);
      29             : 
      30             :   enum BoundaryConditionType
      31             :   {
      32             :     FIXED_VALUE,
      33             :     FLUX
      34             :   };
      35             : 
      36             :   /**
      37             :    * Whether the component has a boundary condition parameter specified for the requested
      38             :    * variable
      39             :    * @param variable the name of the variable
      40             :    * @return Whether the component has a boundary condition parameter specified for the requested
      41             :    * variable
      42             :    */
      43             :   bool hasBoundaryCondition(const VariableName & variable) const;
      44             :   /**
      45             :    * Whether the component has a boundary condition parameter is set for the requested variable and
      46             :    * boundary
      47             :    * @param variable the name of the variable
      48             :    * @param boundary the name of the boundary
      49             :    * @return Whether the component has a boundary condition parameter specified
      50             :    */
      51             :   bool hasBoundaryCondition(const VariableName & variable, const BoundaryName & boundary) const;
      52             :   /**
      53             :    * Get the name of the boundaries on which the variable should have a boundary condition
      54             :    * @param variable the name of the variable concerned
      55             :    * @param requestor name of the requestor for the boundary condition, used in a potential error
      56             :    * message
      57             :    * @return the name of the boundaries
      58             :    */
      59             :   std::vector<BoundaryName> getBoundaryConditionBoundaries(const VariableName & variable) const;
      60             :   /**
      61             :    * Get the name of the functor providing the boundary condition for the requested variable and
      62             :    * boundary
      63             :    * @param variable the name of the variable concerned
      64             :    * @param boundary the name of the boundary concerned
      65             :    * @param requestor name of the requestor for the boundary condition, used in a potential error
      66             :    * message
      67             :    * @return bc_type the type of the boundary condition (flux or fixed value)
      68             :    * @return the name of the functor providing the value of the boundary condition
      69             :    */
      70             :   MooseFunctorName getBoundaryCondition(const VariableName & variable,
      71             :                                         const BoundaryName & boundary,
      72             :                                         const std::string & requestor_name,
      73             :                                         BoundaryConditionType & bc_type) const;
      74             : 
      75             : protected:
      76         148 :   virtual void checkIntegrity() override { checkBoundaryConditionsAllRequested(); }
      77             : 
      78             :   /// Names of the variables to set a fixed value BC on
      79             :   const std::vector<VariableName> _fixed_value_bc_variables;
      80             :   /// Names of the variables to set a flux BC on
      81             :   const std::vector<VariableName> _flux_bc_variables;
      82             : 
      83             :   // TODO: make our custom string types hashable
      84             :   // This would let us return the boundary condition functor name by reference too
      85             : 
      86             :   /// Maps of the fixed value boundary conditions
      87             :   std::map<std::string, std::map<std::string, std::string>> _fixed_value_bcs;
      88             :   /// Maps of the flux boundary conditions
      89             :   std::map<std::string, std::map<std::string, std::string>> _flux_bcs;
      90             : 
      91             :   /// Requested variables. If the IC for a variable was never requested, error
      92             :   mutable std::set<std::pair<VariableName, BoundaryName>> _requested_bc_variables;
      93             : 
      94             : private:
      95             :   /// Checks that all initial conditions were requested.
      96             :   /// An unrequested property necessarily means an unused value
      97             :   void checkBoundaryConditionsAllRequested() const;
      98             : };

Generated by: LCOV version 1.14