LCOV - code coverage report
Current view: top level - src/materials - ComputeEigenstrain.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 14 15 93.3 %
Date: 2025-07-25 05:00:39 Functions: 6 6 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 "ComputeEigenstrain.h"
      11             : 
      12             : registerMooseObject("SolidMechanicsApp", ComputeEigenstrain);
      13             : registerMooseObject("SolidMechanicsApp", ADComputeEigenstrain);
      14             : 
      15             : template <bool is_ad>
      16             : InputParameters
      17         144 : ComputeEigenstrainTempl<is_ad>::validParams()
      18             : {
      19         144 :   InputParameters params = ComputeEigenstrainBase::validParams();
      20         144 :   params.addClassDescription("Computes a constant Eigenstrain");
      21         288 :   params.addRequiredParam<std::vector<Real>>(
      22             :       "eigen_base", "Vector of values defining the constant base tensor for the Eigenstrain");
      23         288 :   params.addParam<MaterialPropertyName>(
      24         288 :       "prefactor", 1.0, "Name of material property defining the variable dependence");
      25         144 :   return params;
      26           0 : }
      27             : 
      28             : template <bool is_ad>
      29         108 : ComputeEigenstrainTempl<is_ad>::ComputeEigenstrainTempl(const InputParameters & parameters)
      30             :   : ComputeEigenstrainBaseTempl<is_ad>(parameters),
      31         108 :     _prefactor(this->template getGenericMaterialProperty<Real, is_ad>("prefactor"))
      32             : {
      33         216 :   _eigen_base_tensor.fillFromInputVector(this->template getParam<std::vector<Real>>("eigen_base"));
      34         108 : }
      35             : 
      36             : template <bool is_ad>
      37             : void
      38       33536 : ComputeEigenstrainTempl<is_ad>::computeQpEigenstrain()
      39             : {
      40             :   // Define Eigenstrain
      41       33536 :   _eigenstrain[_qp] = _eigen_base_tensor * _prefactor[_qp];
      42       33536 : }

Generated by: LCOV version 1.14