LCOV - code coverage report
Current view: top level - src/closures - FunctorClosures.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #30301 (3b550b) with base 2ad78d Lines: 20 22 90.9 %
Date: 2025-07-30 13:02:48 Functions: 4 4 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             : #include "FunctorClosures.h"
      11             : #include "FlowChannelBase.h"
      12             : 
      13             : registerMooseObject("ThermalHydraulicsApp", FunctorClosures);
      14             : 
      15             : InputParameters
      16         114 : FunctorClosures::validParams()
      17             : {
      18         114 :   InputParameters params = ClosuresBase::validParams();
      19             : 
      20         228 :   params.addRequiredParam<std::vector<MooseFunctorName>>(
      21             :       "functors",
      22             :       "The functors defining each material property. Each entry is paired with the corresponding "
      23             :       "entry in 'properties'.");
      24         228 :   params.addRequiredParam<std::vector<MaterialPropertyName>>("properties",
      25             :                                                              "The material properties to create");
      26             : 
      27         114 :   params.addClassDescription("Creates arbitrary closures from functors.");
      28             : 
      29         114 :   return params;
      30           0 : }
      31             : 
      32          57 : FunctorClosures::FunctorClosures(const InputParameters & params) : ClosuresBase(params) {}
      33             : 
      34             : void
      35          57 : FunctorClosures::addMooseObjectsFlowChannel(const FlowChannelBase & flow_channel)
      36             : {
      37          57 :   const auto & functor_names = getParam<std::vector<MooseFunctorName>>("functors");
      38         114 :   const auto & property_names = getParam<std::vector<MaterialPropertyName>>("properties");
      39             : 
      40          57 :   if (functor_names.size() != property_names.size())
      41           0 :     mooseError("The parameters 'functors' and 'properties' must have the same size.");
      42             : 
      43          57 :   const std::string class_name = "MaterialFunctorConverter";
      44          57 :   InputParameters params = _factory.getValidParams(class_name);
      45          57 :   params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
      46          57 :   params.set<std::vector<MooseFunctorName>>("functors_in") = functor_names;
      47          57 :   params.set<std::vector<MaterialPropertyName>>("ad_props_out") = property_names;
      48          57 :   _sim.addMaterial(class_name, genName(flow_channel.name(), name()), params);
      49         114 : }
      50             : 
      51             : void
      52          76 : FunctorClosures::addMooseObjectsHeatTransfer(const HeatTransferBase & /*heat_transfer*/,
      53             :                                              const FlowChannelBase & /*flow_channel*/)
      54             : {
      55          76 : }

Generated by: LCOV version 1.14