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 "CSGSurface.h" 13 : 14 : namespace CSG 15 : { 16 : 17 : /** 18 : * CSGSurfaceList is a container for storing CSGSurface objects in the CSGBase object 19 : */ 20 : class CSGSurfaceList 21 : { 22 : protected: 23 : /** 24 : * Default constructor 25 : */ 26 : CSGSurfaceList(); 27 : 28 : /** 29 : * Destructor 30 : */ 31 87 : virtual ~CSGSurfaceList() = default; 32 : 33 : /** 34 : * @brief Get map of all names to surfaces in surface list 35 : * 36 : * @return map of all names to CSGSurface pointers 37 : */ 38 6 : std::unordered_map<std::string, std::unique_ptr<CSGSurface>> & getSurfaceListMap() 39 : { 40 6 : return _surfaces; 41 : } 42 : 43 : /** 44 : * @brief Get list of references to all surfaces in surface list 45 : * 46 : * @return list of references to surfaces 47 : */ 48 : std::vector<std::reference_wrapper<const CSGSurface>> getAllSurfaces() const; 49 : 50 : /** 51 : * @brief Get a surface by name 52 : * 53 : * @param name name of surface 54 : * 55 : * @return reference to CSGSurface of the specified name 56 : */ 57 : CSGSurface & getSurface(const std::string & name) const; 58 : 59 : /** 60 : * @brief add a surface object to existing SurfaceList. Ownership of surface will be transferred 61 : * to surface list object that calls this function 62 : * 63 : * @param surf CSGSurface to add 64 : * 65 : * @return reference to CSGSurface 66 : */ 67 : CSGSurface & addSurface(std::unique_ptr<CSGSurface> surf); 68 : 69 : /** 70 : * @brief rename the specified surface 71 : * 72 : * @param name new name of surface 73 : */ 74 : void renameSurface(const CSGSurface & surface, const std::string & name); 75 : 76 : /// Mapping of surface names to pointers of stored surface objects 77 : std::unordered_map<std::string, std::unique_ptr<CSGSurface>> _surfaces; 78 : 79 : // Only CSGBase should be calling the methods in CSGSurfaceList 80 : friend class CSGBase; 81 : }; 82 : } // namespace CSG