LCOV - code coverage report
Current view: top level - include/userobjects - PKAGeneratorBase.h (source / functions) Hit Total Coverage
Test: idaholab/magpie: 5710af Lines: 3 4 75.0 %
Date: 2025-07-21 23:34:39 Functions: 1 2 50.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             : #pragma once
      10             : 
      11             : #include "DiscreteElementUserObject.h"
      12             : #include "MyTRIMRasterizer.h"
      13             : #include "mytrim/ion.h"
      14             : 
      15             : /**
      16             :  * Abstract base class for PKA calculation UOs that plug into MyTRIMRasterizer
      17             :  * to generate a set of PKAs for the current element
      18             :  */
      19             : class PKAGeneratorBase : public DiscreteElementUserObject
      20             : {
      21             : public:
      22             :   static InputParameters validParams();
      23             : 
      24             :   PKAGeneratorBase(const InputParameters & parameters);
      25             : 
      26             :   /**
      27             :    * Append the ions for the current element and time window dt.
      28             :    * The element volume is passed in as it is computed in the MyTRIMRasterizer anyways.
      29             :    */
      30             :   virtual void appendPKAs(std::vector<MyTRIM_NS::IonBase> &,
      31             :                           const MyTRIMRasterizer::PKAParameters &,
      32             :                           const MyTRIMRasterizer::AveragedData &) const = 0;
      33             : 
      34           0 :   virtual void initialize() {}
      35             : 
      36             :   /// finds the right ion tag; -1 means that the nuclide is not tracked, otherwise the index in the rasterizer nuclide vector must be retrieved
      37             :   int ionTag(const MyTRIMRasterizer::PKAParameters &, Real Z, Real m) const;
      38             : 
      39             : protected:
      40             :   /// helper function to set the ion position to a random location in the current element
      41             :   void setPosition(MyTRIM_NS::IonBase & ion) const;
      42             : 
      43             :   /// helper function to set the ion direction to a random direction
      44             :   void setRandomDirection(MyTRIM_NS::IonBase & ion) const;
      45             : 
      46             :   /// Return a point with random uniformly distributed coordinates in the unit cube (temp variables are required to ensure execution order!)
      47      718143 :   Point getRandomPoint() const
      48             :   {
      49      718143 :     const Real X = getRandomReal(), Y = getRandomReal(), Z = getRandomReal();
      50      718143 :     return Point(X, Y, Z);
      51             :   }
      52             : };

Generated by: LCOV version 1.14