LCOV - code coverage report
Current view: top level - src/materials/lagrangian - ComputeHomogenizedLagrangianStrain.C (source / functions) Hit Total Coverage
Test: idaholab/moose tensor_mechanics: d6b47a Lines: 21 22 95.5 %
Date: 2024-02-27 11:53:14 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://www.mooseframework.org
       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 "ComputeHomogenizedLagrangianStrain.h"
      11             : 
      12             : registerMooseObject("TensorMechanicsApp", ComputeHomogenizedLagrangianStrain);
      13             : 
      14             : InputParameters
      15         296 : ComputeHomogenizedLagrangianStrain::validParams()
      16             : {
      17         296 :   InputParameters params = Material::validParams();
      18         592 :   params.addParam<std::string>("base_name", "Material property base name");
      19         592 :   params.addRequiredParam<UserObjectName>(
      20             :       "homogenization_constraint", "The UserObject for defining the homogenization constraint");
      21         592 :   params.addParam<MaterialPropertyName>("homogenization_gradient_name",
      22             :                                         "homogenization_gradient",
      23             :                                         "Name of the constant gradient field");
      24         592 :   params.addRequiredCoupledVar("macro_gradient",
      25             :                                "Scalar field defining the "
      26             :                                "macro gradient");
      27         296 :   return params;
      28           0 : }
      29             : 
      30         222 : ComputeHomogenizedLagrangianStrain::ComputeHomogenizedLagrangianStrain(
      31         222 :     const InputParameters & parameters)
      32             :   : Material(parameters),
      33         222 :     _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
      34         222 :     _constraint(getUserObject<HomogenizationConstraint>("homogenization_constraint")),
      35         222 :     _cmap(_constraint.getConstraintMap()),
      36         222 :     _macro_gradient(coupledScalarValue("macro_gradient")),
      37         222 :     _homogenization_contribution(
      38         444 :         declareProperty<RankTwoTensor>(_base_name + "homogenization_gradient_name"))
      39             : {
      40         222 : }
      41             : 
      42             : void
      43    18615672 : ComputeHomogenizedLagrangianStrain::computeQpProperties()
      44             : {
      45    18615672 :   _homogenization_contribution[_qp].zero();
      46             :   unsigned int count = 0;
      47   152966640 :   for (auto && indices : _cmap)
      48             :   {
      49             :     auto && [i, j] = indices.first;
      50   134350968 :     _homogenization_contribution[_qp](i, j) = _macro_gradient[count++];
      51             :   }
      52    18615672 : }

Generated by: LCOV version 1.14