LCOV - code coverage report
Current view: top level - include/csg - CSGCellList.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #31730 (e8b711) with base e0c998 Lines: 2 2 100.0 %
Date: 2025-10-29 16:49:47 Functions: 2 3 66.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://www.mooseframework.org
       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             : #include "CSGCell.h"
      13             : 
      14             : namespace CSG
      15             : {
      16             : 
      17             : /**
      18             :  * CSGCellList creates a container for CSGCell objects to pass to CSGBase object
      19             :  */
      20             : class CSGCellList
      21             : {
      22             : protected:
      23             :   /**
      24             :    * Default constructor
      25             :    */
      26             :   CSGCellList();
      27             : 
      28             :   /**
      29             :    * Destructor
      30             :    */
      31          87 :   virtual ~CSGCellList() = default;
      32             : 
      33             :   /**
      34             :    * @brief Add a Material Cell object to cell list
      35             :    *
      36             :    * @param name unique cell name
      37             :    * @param mat_name material name
      38             :    * @param region cell region
      39             :    * @return reference to CSGCell with material fill that was created and
      40             :    * added to this CSGCellList
      41             :    */
      42             :   CSGCell &
      43             :   addMaterialCell(const std::string & name, const std::string & mat_name, const CSGRegion & region);
      44             : 
      45             :   /**
      46             :    * @brief Add a Void Cell object cell list
      47             :    *
      48             :    * @param name unique cell name
      49             :    * @param region cell region
      50             :    * @return reference to CSGCell with void fill that was created and
      51             :    * added to this CSGCellList
      52             :    */
      53             :   CSGCell & addVoidCell(const std::string & name, const CSGRegion & region);
      54             : 
      55             :   /**
      56             :    * @brief Add a Universe Cell object to cell list
      57             :    *
      58             :    * @param name unique cell name
      59             :    * @param univ universe
      60             :    * @param region cell region
      61             :    * @return reference to CSGCell with universe fill that was created and
      62             :    * added to this CSGCellList
      63             :    */
      64             :   CSGCell &
      65             :   addUniverseCell(const std::string & name, const CSGUniverse & univ, const CSGRegion & region);
      66             : 
      67             :   /**
      68             :    * @brief Get map of all names to cells in cell list
      69             :    *
      70             :    * @return map of all names to CSGCell pointers
      71             :    */
      72           6 :   std::unordered_map<std::string, std::unique_ptr<CSGCell>> & getCellListMap() { return _cells; }
      73             : 
      74             :   /**
      75             :    * @brief Get all the cells in CSGBase instance
      76             :    *
      77             :    * @return list of references to all CSGCell objects
      78             :    */
      79             :   std::vector<std::reference_wrapper<const CSGCell>> getAllCells() const;
      80             : 
      81             :   /**
      82             :    * @brief Get the CSGCell by name
      83             :    *
      84             :    * @param name
      85             :    * @return reference to CSGCell of the specified name
      86             :    */
      87             :   CSGCell & getCell(const std::string & name) const;
      88             : 
      89             :   /**
      90             :    * @brief add a cell to the CellList. Ownership of cell will be transferred to cell list object
      91             :    * that calls this function
      92             :    *
      93             :    * @param cell cell to add to the CellList.
      94             :    * @return reference to CSGCell that was added to CellList
      95             :    */
      96             :   CSGCell & addCell(std::unique_ptr<CSGCell> cell);
      97             : 
      98             :   /**
      99             :    * @brief rename the specified cell
     100             :    *
     101             :    * @param cell reference to CSGCell object that should be renamed
     102             :    * @param name new name
     103             :    */
     104             :   void renameCell(const CSGCell & cell, const std::string & name);
     105             : 
     106             :   /// Mapping of cell names to pointers of stored cell objects
     107             :   std::unordered_map<std::string, std::unique_ptr<CSGCell>> _cells;
     108             : 
     109             :   // Only CSGBase should be calling the methods in CSGCellList
     110             :   friend class CSGBase;
     111             : };
     112             : } // namespace CSG

Generated by: LCOV version 1.14