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 "PolycrystalColoringIC.h" 11 : #include "IndirectSort.h" 12 : #include "MooseMesh.h" 13 : #include "MooseRandom.h" 14 : #include "NonlinearSystemBase.h" 15 : #include "GrainTrackerInterface.h" 16 : #include "PolycrystalUserObjectBase.h" 17 : 18 : registerMooseObject("PhaseFieldApp", PolycrystalColoringIC); 19 : 20 : InputParameters 21 10607 : PolycrystalColoringIC::validParams() 22 : { 23 10607 : InputParameters params = InitialCondition::validParams(); 24 10607 : params.addClassDescription( 25 : "Random Voronoi tesselation polycrystal (used by PolycrystalVoronoiICAction)"); 26 21214 : params.addRequiredParam<UserObjectName>("polycrystal_ic_uo", 27 : "User object generating a point to grain number mapping"); 28 21214 : params.addRequiredParam<unsigned int>("op_index", "The index for the current order parameter"); 29 : 30 10607 : return params; 31 0 : } 32 : 33 5611 : PolycrystalColoringIC::PolycrystalColoringIC(const InputParameters & parameters) 34 : : InitialCondition(parameters), 35 5611 : _op_index(getParam<unsigned int>("op_index")), 36 11222 : _poly_ic_uo(getUserObject<PolycrystalUserObjectBase>("polycrystal_ic_uo")) 37 : { 38 5611 : } 39 : 40 : Real 41 10404416 : PolycrystalColoringIC::value(const Point & p) 42 : { 43 10404416 : if (_current_node) 44 10404416 : return _poly_ic_uo.getNodalVariableValue(_op_index, *_current_node); 45 : else 46 0 : return _poly_ic_uo.getVariableValue(_op_index, p); 47 : }