LCOV - code coverage report
Current view: top level - src/functormaterials - PiecewiseByBlockFunctorMaterial.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 17 18 94.4 %
Date: 2025-07-17 01:28:37 Functions: 18 48 37.5 %
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 "PiecewiseByBlockFunctorMaterial.h"
      11             : 
      12             : registerMooseObject("MooseApp", PiecewiseByBlockFunctorMaterial);
      13             : registerMooseObject("MooseApp", ADPiecewiseByBlockFunctorMaterial);
      14             : registerMooseObject("MooseApp", PiecewiseByBlockVectorFunctorMaterial);
      15             : registerMooseObject("MooseApp", ADPiecewiseByBlockVectorFunctorMaterial);
      16             : registerMooseObjectRenamed("MooseApp",
      17             :                            FVPropValPerSubdomainMaterial,
      18             :                            "06/30/2022 24:00",
      19             :                            PiecewiseByBlockFunctorMaterial);
      20             : registerMooseObjectRenamed("MooseApp",
      21             :                            FVADPropValPerSubdomainMaterial,
      22             :                            "06/30/2022 24:00",
      23             :                            ADPiecewiseByBlockFunctorMaterial);
      24             : 
      25             : template <typename T>
      26             : InputParameters
      27       86242 : PiecewiseByBlockFunctorMaterialTempl<T>::validParams()
      28             : {
      29       86242 :   auto params = FunctorMaterial::validParams();
      30       86242 :   params.addClassDescription("Computes a property value on a per-subdomain basis");
      31             :   // Somehow min gcc doesn't know the typename of params here
      32       86242 :   params.template addRequiredParam<MooseFunctorName>("prop_name",
      33             :                                                      "The name of the property to declare");
      34       86242 :   params.template addRequiredParam<std::map<std::string, std::string>>(
      35             :       "subdomain_to_prop_value",
      36             :       "Map from subdomain to property value. The value may be a constant"
      37             :       " or any kind of functor (functions, variables, functor material properties)");
      38       86242 :   return params;
      39           0 : }
      40             : 
      41             : template <typename T>
      42         330 : PiecewiseByBlockFunctorMaterialTempl<T>::PiecewiseByBlockFunctorMaterialTempl(
      43             :     const InputParameters & params)
      44         330 :   : FunctorMaterial(params)
      45             : {
      46             :   // Ultimately this can impose more caching than the original functors, but not less
      47         330 :   const std::set<ExecFlagType> clearance_schedule(_execute_enum.begin(), _execute_enum.end());
      48        1112 :   for (const auto & map_pr :
      49         330 :        getParam<std::map<std::string, std::string>>("subdomain_to_prop_value"))
      50             :   {
      51         782 :     const auto & name = map_pr.second;
      52         782 :     const auto & functor = getFunctor<T>(name);
      53         782 :     addFunctorPropertyByBlocks<T>(
      54             :         "prop_name",
      55      821322 :         [&functor](const auto & r, const auto & t) -> T { return functor(r, t); },
      56        1564 :         std::set<SubdomainID>({_mesh.getSubdomainID(map_pr.first)}),
      57             :         clearance_schedule);
      58             :   }
      59         330 : }
      60             : 
      61             : template class PiecewiseByBlockFunctorMaterialTempl<GenericReal<false>>;
      62             : template class PiecewiseByBlockFunctorMaterialTempl<GenericReal<true>>;
      63             : template class PiecewiseByBlockFunctorMaterialTempl<GenericRealVectorValue<false>>;
      64             : template class PiecewiseByBlockFunctorMaterialTempl<GenericRealVectorValue<true>>;

Generated by: LCOV version 1.14