LCOV - code coverage report
Current view: top level - include/utils - RandomData.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 2 2 100.0 %
Date: 2025-07-17 01:28:37 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          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             : #pragma once
      11             : 
      12             : // MOOSE includes
      13             : #include "MooseRandom.h"
      14             : #include "MooseTypes.h"
      15             : #include "MooseEnumItem.h"
      16             : 
      17             : #include <unordered_map>
      18             : 
      19             : class FEProblemBase;
      20             : class MooseMesh;
      21             : class RandomInterface;
      22             : 
      23             : class RandomData
      24             : {
      25             : public:
      26             :   RandomData(FEProblemBase & fe_problem, const RandomInterface & random_interface);
      27             : 
      28             :   RandomData(FEProblemBase & fe_problem, bool is_nodal, ExecFlagType reset_on, unsigned int seed);
      29             : 
      30        1395 :   ~RandomData() = default;
      31             : 
      32             :   /**
      33             :    * This method is called to reset or update the seeds based on the reset_on
      34             :    * flag and the passed execution point.
      35             :    */
      36             :   void updateSeeds(ExecFlagType exec_flag);
      37             : 
      38             :   /**
      39             :    * Return the underlying MooseRandom generator object for this data instance.
      40             :    */
      41        1411 :   MooseRandom & getGenerator() { return _generator; }
      42             : 
      43             :   /**
      44             :    * Get the seed for the passed in elem/node id.
      45             :    * @param id - dof object id
      46             :    * @return current seed for this id
      47             :    */
      48             :   unsigned int getSeed(dof_id_type id);
      49             : 
      50             : private:
      51             :   void updateGenerators();
      52             : 
      53             :   FEProblemBase & _rd_problem;
      54             :   MooseMesh & _rd_mesh;
      55             : 
      56             :   MooseRandom _generator;
      57             :   bool _is_nodal;
      58             :   ExecFlagType _reset_on;
      59             : 
      60             :   unsigned int _master_seed;
      61             :   unsigned int _current_master_seed;
      62             :   unsigned int _new_seed;
      63             : 
      64             :   std::unordered_map<dof_id_type, unsigned int> _seeds;
      65             : };

Generated by: LCOV version 1.14