LCOV - code coverage report
Current view: top level - src/actions - ProjectedStatefulMaterialStorageAction.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 26 29 89.7 %
Date: 2025-07-17 01:28:37 Functions: 4 5 80.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             : // MOOSE includes
      11             : #include "ProjectedStatefulMaterialStorageAction.h"
      12             : #include "RankFourTensorForward.h"
      13             : #include "RankTwoTensorForward.h"
      14             : #include "AddAuxVariableAction.h"
      15             : #include "AddVariableAction.h"
      16             : #include "FEProblemBase.h"
      17             : #include "Factory.h"
      18             : 
      19             : #include "libmesh/string_to_enum.h"
      20             : 
      21             : // we need to add these variables after the material property types are known
      22             : registerMooseAction("MooseApp",
      23             :                     ProjectedStatefulMaterialStorageAction,
      24             :                     "setup_projected_properties");
      25             : 
      26             : registerMooseAction("MooseApp", ProjectedStatefulMaterialStorageAction, "add_aux_kernel");
      27             : 
      28             : InputParameters
      29         239 : ProjectedStatefulMaterialStorageAction::validParams()
      30             : {
      31         239 :   InputParameters params = Action::validParams();
      32             : 
      33         239 :   params.addClassDescription("Mark material properties for projected stateful storage.");
      34             : 
      35         717 :   params.addParam<MooseEnum>(
      36             :       "family",
      37         478 :       MooseEnum("LAGRANGE MONOMIAL L2_LAGRANGE L2_HIERARCHIC", "LAGRANGE"),
      38             :       "Finite element variable family to project the material properties onto");
      39         717 :   params.addParam<MooseEnum>(
      40             :       "order",
      41         478 :       AddAuxVariableAction::getAuxVariableOrders(),
      42             :       "Finite element variable order to project the material properties onto");
      43             : 
      44             :   // block restrictions
      45         239 :   params += BlockRestrictable::validParams();
      46             : 
      47         239 :   params.addParam<std::vector<MaterialPropertyName>>(
      48             :       "projected_props", {}, "Material properties to project for stateful storage");
      49         239 :   return params;
      50           0 : }
      51             : 
      52          36 : ProjectedStatefulMaterialStorageAction::ProjectedStatefulMaterialStorageAction(
      53          36 :     const InputParameters & params)
      54             :   : Action(params),
      55          36 :     _prop_names(getParam<std::vector<MaterialPropertyName>>("projected_props")),
      56          36 :     _order(params.get<MooseEnum>("order")),
      57          72 :     _fe_type({Utility::string_to_enum<Order>(_order),
      58          72 :               Utility::string_to_enum<FEFamily>(params.get<MooseEnum>("family"))}),
      59          72 :     _var_type(AddVariableAction::variableType(_fe_type))
      60             : {
      61          36 : }
      62             : 
      63             : void
      64         108 : ProjectedStatefulMaterialStorageAction::addRelationshipManagers(
      65             :     Moose::RelationshipManagerType input_rm_type)
      66             : {
      67         108 :   auto params = ProjectedStatefulMaterialNodalPatchRecoveryBase::validParams();
      68         108 :   addRelationshipManagers(input_rm_type, params);
      69         108 : }
      70             : 
      71             : void
      72          72 : ProjectedStatefulMaterialStorageAction::act()
      73             : {
      74         360 :   for (const auto & prop_name : _prop_names)
      75             :   {
      76             :     // loop over all supported property types
      77         288 :     Moose::typeLoop<ProcessProperty>(SupportedTypes{}, this, prop_name);
      78             :   }
      79          72 : }
      80             : 
      81             : MooseEnum
      82           0 : ProjectedStatefulMaterialStorageAction::getTypeEnum()
      83             : {
      84           0 :   return getTypeEnum(SupportedTypes{});
      85             : }

Generated by: LCOV version 1.14