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 "LineMaterialRankTwoSampler.h" 11 : #include "RankTwoScalarTools.h" 12 : 13 : registerMooseObject("TensorMechanicsApp", LineMaterialRankTwoSampler); 14 : 15 : InputParameters 16 6 : LineMaterialRankTwoSampler::validParams() 17 : { 18 6 : InputParameters params = LineMaterialSamplerBase<Real>::validParams(); 19 6 : params.addClassDescription("Access a component of a RankTwoTensor"); 20 12 : 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 12 : 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 6 : return params; 29 0 : } 30 : 31 3 : LineMaterialRankTwoSampler::LineMaterialRankTwoSampler(const InputParameters & parameters) 32 : : LineMaterialSamplerBase<RankTwoTensor>(parameters), 33 3 : _i(getParam<unsigned int>("index_i")), 34 9 : _j(getParam<unsigned int>("index_j")) 35 : { 36 3 : } 37 : 38 : Real 39 320 : LineMaterialRankTwoSampler::getScalarFromProperty(const RankTwoTensor & property, 40 : const Point & /*curr_point*/) 41 : { 42 320 : return RankTwoScalarTools::component(property, _i, _j); 43 : }