LCOV - code coverage report
Current view: top level - src/auxkernels - ShellLocalCoordinatesAux.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 29 31 93.5 %
Date: 2025-07-25 05:00:39 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://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 "ShellLocalCoordinatesAux.h"
      11             : #include "libmesh/utility.h"
      12             : #include "libmesh/string_to_enum.h"
      13             : 
      14             : registerMooseObject("SolidMechanicsApp", ShellLocalCoordinatesAux);
      15             : 
      16             : InputParameters
      17         324 : ShellLocalCoordinatesAux::validParams()
      18             : {
      19         324 :   InputParameters params = AuxKernel::validParams();
      20         324 :   params.addClassDescription(
      21             :       "This AuxKernel stores a specific component of a shell element's local coordinate "
      22             :       "vector in an auxiliary variable.");
      23         648 :   params.addParam<std::string>("base_name", "Mechanical property base name");
      24             : 
      25         648 :   MooseEnum property("first_local_vector second_local_vector normal_local_vector");
      26         648 :   params.addRequiredParam<MooseEnum>(
      27             :       "property",
      28             :       property,
      29             :       "The local axis to output: first_local_vector, second_local_vector or normal_local_vector");
      30         648 :   params.addRequiredParam<unsigned int>(
      31             :       "component", "The vector component of the local coordinate vector: 0, 1 or 2");
      32             : 
      33         324 :   return params;
      34         324 : }
      35             : 
      36         162 : ShellLocalCoordinatesAux::ShellLocalCoordinatesAux(const InputParameters & parameters)
      37             :   : AuxKernel(parameters),
      38         162 :     _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
      39         324 :     _property(getParam<MooseEnum>("property").getEnum<PropertyType>()),
      40         486 :     _component(getParam<unsigned int>("component"))
      41             : 
      42             : {
      43         162 :   _local_coordinates =
      44         162 :       &getMaterialProperty<RankTwoTensor>(_base_name + "local_transformation_t_points_0");
      45             : 
      46         162 :   if (_component > 2)
      47           0 :     mooseError("Invalid component: ",
      48           0 :                _component,
      49             :                ". The component index of a shell local vector must be 0, 1, or 2.");
      50         162 : }
      51             : 
      52             : Real
      53       63072 : ShellLocalCoordinatesAux::computeValue()
      54             : {
      55             :   Real output_value = 0.0;
      56             : 
      57       63072 :   switch (_property)
      58             :   {
      59       21024 :     case PropertyType::first_local_vector:
      60       21024 :       output_value = (*_local_coordinates)[_qp](0, _component);
      61       21024 :       break;
      62       21024 :     case PropertyType::second_local_vector:
      63       21024 :       output_value = (*_local_coordinates)[_qp](1, _component);
      64       21024 :       break;
      65       21024 :     case PropertyType::normal_local_vector:
      66       21024 :       output_value = (*_local_coordinates)[_qp](2, _component);
      67       21024 :       break;
      68             :   }
      69             : 
      70       63072 :   return output_value;
      71             : }

Generated by: LCOV version 1.14