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 "LineMaterialRankTwoSampler.h" 11 : #include "RankTwoScalarTools.h" 12 : 13 : registerMooseObject("SolidMechanicsApp", LineMaterialRankTwoSampler); 14 : 15 : InputParameters 16 12 : LineMaterialRankTwoSampler::validParams() 17 : { 18 12 : InputParameters params = LineMaterialSamplerBase<Real>::validParams(); 19 12 : params.addClassDescription("Access a component of a RankTwoTensor"); 20 24 : params.addRequiredRangeCheckedParam<unsigned int>( 21 : "index_i", 22 : "index_i >= 0 & index_i <= 2", 23 : "The index i of ij for the tensor to output (0, 1, 2)"); 24 24 : params.addRequiredRangeCheckedParam<unsigned int>( 25 : "index_j", 26 : "index_j >= 0 & index_j <= 2", 27 : "The index j of ij for the tensor to output (0, 1, 2)"); 28 12 : return params; 29 0 : } 30 : 31 6 : LineMaterialRankTwoSampler::LineMaterialRankTwoSampler(const InputParameters & parameters) 32 : : LineMaterialSamplerBase<RankTwoTensor>(parameters), 33 6 : _i(getParam<unsigned int>("index_i")), 34 18 : _j(getParam<unsigned int>("index_j")) 35 : { 36 6 : } 37 : 38 : Real 39 640 : LineMaterialRankTwoSampler::getScalarFromProperty(const RankTwoTensor & property, 40 : const Point & /*curr_point*/) 41 : { 42 640 : return RankTwoScalarTools::component(property, _i, _j); 43 : }