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 "GrainCentersPostprocessor.h" 11 : #include "ComputeGrainCenterUserObject.h" 12 : 13 : InputParameters 14 0 : GrainCentersPostprocessor::validParams() 15 : { 16 0 : InputParameters params = VectorPostprocessor::validParams(); 17 0 : params.addClassDescription("Outputs the values from ComputeGrainCenterUserObject"); 18 0 : params.addParam<UserObjectName>( 19 : "grain_data", "Specify user object that gives center of mass and volume of grains"); 20 0 : return params; 21 0 : } 22 : 23 0 : GrainCentersPostprocessor::GrainCentersPostprocessor(const InputParameters & parameters) 24 : : GeneralVectorPostprocessor(parameters), 25 0 : _grain_volume_center_vector(declareVector("grain_volume_center_vector")), 26 0 : _grain_data(getUserObject<ComputeGrainCenterUserObject>("grain_data")), 27 0 : _grain_volumes(_grain_data.getGrainVolumes()), 28 0 : _grain_centers(_grain_data.getGrainCenters()), 29 0 : _total_grains(_grain_volumes.size()) 30 : { 31 0 : _grain_volume_center_vector.resize(_total_grains * 4); 32 0 : } 33 : 34 : void 35 0 : GrainCentersPostprocessor::execute() 36 : { 37 0 : for (unsigned int i = 0; i < _total_grains; ++i) 38 : { 39 0 : _grain_volume_center_vector[4 * i + 0] = _grain_volumes[i]; 40 0 : _grain_volume_center_vector[4 * i + 1] = _grain_centers[i](0); 41 0 : _grain_volume_center_vector[4 * i + 2] = _grain_centers[i](1); 42 0 : _grain_volume_center_vector[4 * i + 3] = _grain_centers[i](2); 43 : } 44 0 : }