LCOV - code coverage report
Current view: top level - src/dirackernels - MyTRIMDiracSource.C (source / functions) Hit Total Coverage
Test: idaholab/magpie: 5710af Lines: 26 27 96.3 %
Date: 2025-07-21 23:34:39 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          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 "MyTRIMDiracSource.h"
      10             : #include "MyTRIMDiracRun.h"
      11             : #include "MyTRIMRasterizer.h"
      12             : #include "MooseMesh.h"
      13             : 
      14             : registerMooseObject("MagpieApp", MyTRIMDiracSource);
      15             : 
      16             : InputParameters
      17          12 : MyTRIMDiracSource::validParams()
      18             : {
      19          12 :   InputParameters params = DiracKernel::validParams();
      20          24 :   params.addRequiredParam<UserObjectName>(
      21             :       "runner", "Name of the MyTRIMDiracRun userobject to pull data from.");
      22          24 :   params.addParam<unsigned int>("ivar", "Element index");
      23          24 :   MooseEnum defectType("VAC=0 INT REPLACEMENT_IN REPLACEMENT_OUT", "VAC");
      24          24 :   params.addParam<MooseEnum>("defect", defectType, "Defect type to read out");
      25             : 
      26             :   // this needs multiplicity enabled to give meaningful results
      27          12 :   params.set<bool>("drop_duplicate_points") = false;
      28             : 
      29          12 :   return params;
      30          12 : }
      31             : 
      32           6 : MyTRIMDiracSource::MyTRIMDiracSource(const InputParameters & parameters)
      33             :   : DiracKernel(parameters),
      34           6 :     _mytrim(getUserObject<MyTRIMDiracRun>("runner")),
      35           6 :     _rasterizer(_mytrim.rasterizer()),
      36           6 :     _ivar(getParam<unsigned int>("ivar")),
      37          12 :     _defect(getParam<MooseEnum>("defect").getEnum<ThreadedRecoilLoopBase::DefectType>()),
      38          12 :     _trim_parameters(_rasterizer.getTrimParameters())
      39             : {
      40          12 :   if (getParam<bool>("drop_duplicate_points"))
      41           0 :     mooseWarning("Explicitly setting drop_duplicate_points to true will cause overlapping defects "
      42             :                  "to be miscounted.");
      43           6 : }
      44             : 
      45             : void
      46          48 : MyTRIMDiracSource::addPoints()
      47             : {
      48      279792 :   for (auto && defect : _mytrim.result())
      49      279744 :     if (defect._type == _defect && defect._var == _ivar)
      50             :     {
      51      101880 :       Elem * elem = _mesh.elemPtr(defect._elem_id);
      52      101880 :       if (elem)
      53      101880 :         addPoint(elem, defect._location);
      54             :     }
      55          48 : }
      56             : 
      57             : Real
      58      338352 : MyTRIMDiracSource::computeQpResidual()
      59             : {
      60      338352 :   return -_test[_i][_qp] / _trim_parameters.last_executed_dt;
      61             : }

Generated by: LCOV version 1.14