Line data Source code
1 : /**********************************************************************/ 2 : /* DO NOT MODIFY THIS HEADER */ 3 : /* MAGPIE - Mesoscale Atomistic Glue Program for Integrated Execution */ 4 : /* */ 5 : /* Copyright 2017 Battelle Energy Alliance, LLC */ 6 : /* ALL RIGHTS RESERVED */ 7 : /**********************************************************************/ 8 : 9 : #include "MyTRIMDiracResult.h" 10 : #include "MyTRIMDiracRun.h" 11 : 12 : registerMooseObject("MagpieApp", MyTRIMDiracResult); 13 : 14 : InputParameters 15 32 : MyTRIMDiracResult::validParams() 16 : { 17 32 : InputParameters params = GeneralVectorPostprocessor::validParams(); 18 64 : params.addRequiredParam<UserObjectName>( 19 : "runner", "Name of the MyTRIMDiracRun userobject to pull data from."); 20 64 : params.addParam<unsigned int>("ivar", "Element index"); 21 64 : MooseEnum defectType("VAC INT", "VAC"); 22 64 : params.addParam<MooseEnum>("defect", defectType, "Defect type to read out"); 23 32 : return params; 24 32 : } 25 : 26 16 : MyTRIMDiracResult::MyTRIMDiracResult(const InputParameters & parameters) 27 : : GeneralVectorPostprocessor(parameters), 28 16 : _mytrim(getUserObject<MyTRIMDiracRun>("runner")), 29 32 : _ivar(getParam<unsigned int>("ivar")), 30 32 : _defect(getParam<MooseEnum>("defect")), 31 16 : _x(declareVector("x")), 32 16 : _y(declareVector("y")), 33 16 : _z(declareVector("z")), 34 32 : _elem_id(declareVector("elem_id")) 35 : { 36 16 : } 37 : 38 : void 39 16 : MyTRIMDiracResult::initialize() 40 : { 41 16 : _x.clear(); 42 16 : _y.clear(); 43 16 : _z.clear(); 44 16 : _elem_id.clear(); 45 16 : } 46 : 47 : void 48 16 : MyTRIMDiracResult::execute() 49 : { 50 1684304 : for (auto && defect : _mytrim.result()) 51 1684288 : if (defect._type >= 0 && static_cast<unsigned int>(defect._type) == _defect && 52 : defect._var == _ivar) 53 : { 54 586812 : _x.push_back(defect._location(0)); 55 586812 : _y.push_back(defect._location(1)); 56 586812 : _z.push_back(defect._location(2)); 57 586812 : _elem_id.push_back(defect._elem_id); 58 : } 59 16 : } 60 : 61 : void 62 16 : MyTRIMDiracResult::finalize() 63 : { 64 : // the MyTRIMDiracRunner already does the necessary communication 65 16 : }