https://mooseframework.inl.gov
CSGSurfaceList.h
Go to the documentation of this file.
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 
21 {
22 protected:
27 
31  CSGSurfaceList(const CSGSurfaceList & other_surface_list);
32 
36  virtual ~CSGSurfaceList() = default;
37 
43  std::unordered_map<std::string, std::unique_ptr<CSGSurface>> & getSurfaceListMap()
44  {
45  return _surfaces;
46  }
47 
53  const std::unordered_map<std::string, std::unique_ptr<CSGSurface>> & getSurfaceListMap() const
54  {
55  return _surfaces;
56  }
57 
63  std::vector<std::reference_wrapper<const CSGSurface>> getAllSurfaces() const;
64 
71  bool hasSurface(const std::string & name) const
72  {
73  return _surfaces.find(name) != _surfaces.end();
74  }
75 
83  CSGSurface & getSurface(const std::string & name) const;
84 
93  CSGSurface & addSurface(std::unique_ptr<CSGSurface> surf);
94 
100  void renameSurface(const CSGSurface & surface, const std::string & name);
101 
103  bool operator==(const CSGSurfaceList & other) const;
104 
106  bool operator!=(const CSGSurfaceList & other) const;
107 
109  std::unordered_map<std::string, std::unique_ptr<CSGSurface>> _surfaces;
110 
111  // Only CSGBase should be calling the methods in CSGSurfaceList
112  friend class CSGBase;
113 };
114 } // namespace CSG
bool operator!=(const CSGSurfaceList &other) const
Operator overload for checking if two CSGSurfaceList objects are not equal.
std::string name(const ElemQuality q)
bool hasSurface(const std::string &name) const
return whether surface with given name exists in surface list
CSGSurface & getSurface(const std::string &name) const
Get a surface by name.
std::vector< std::reference_wrapper< const CSGSurface > > getAllSurfaces() const
Get list of references to all surfaces in surface list.
std::unordered_map< std::string, std::unique_ptr< CSGSurface > > _surfaces
Mapping of surface names to pointers of stored surface objects.
void renameSurface(const CSGSurface &surface, const std::string &name)
rename the specified surface
bool operator==(const CSGSurfaceList &other) const
Operator overload for checking if two CSGSurfaceList objects are equal.
std::unordered_map< std::string, std::unique_ptr< CSGSurface > > & getSurfaceListMap()
Get non-const map of all names to surfaces in surface list.
virtual ~CSGSurfaceList()=default
Destructor.
CSGSurfaceList()
Default constructor.
const std::unordered_map< std::string, std::unique_ptr< CSGSurface > > & getSurfaceListMap() const
Get const map of all names to surfaces in surface list.
CSGSurfaceList is a container for storing CSGSurface objects in the CSGBase object.
CSGSurface creates an internal representation of a Constructive Solid Geometry (CSG) surface...
Definition: CSGSurface.h:26
CSGSurface & addSurface(std::unique_ptr< CSGSurface > surf)
add a surface object to existing SurfaceList.
CSGBase creates an internal representation of a Constructive Solid Geometry (CSG) model...
Definition: CSGBase.h:29