https://mooseframework.inl.gov
CSGCellList.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 "CSGCell.h"
13 
14 namespace CSG
15 {
16 
21 {
22 protected:
26  CSGCellList();
27 
31  virtual ~CSGCellList() = default;
32 
42  CSGCell &
43  addMaterialCell(const std::string & name, const std::string & mat_name, const CSGRegion & region);
44 
53  CSGCell & addVoidCell(const std::string & name, const CSGRegion & region);
54 
64  CSGCell &
65  addUniverseCell(const std::string & name, const CSGUniverse & univ, const CSGRegion & region);
66 
73  bool hasCell(const std::string & name) const { return _cells.find(name) != _cells.end(); }
74 
80  std::unordered_map<std::string, std::unique_ptr<CSGCell>> & getCellListMap() { return _cells; }
81 
87  const std::unordered_map<std::string, std::unique_ptr<CSGCell>> & getCellListMap() const
88  {
89  return _cells;
90  }
91 
97  std::vector<std::reference_wrapper<const CSGCell>> getAllCells() const;
98 
105  CSGCell & getCell(const std::string & name) const;
106 
114  CSGCell & addCell(std::unique_ptr<CSGCell> cell);
115 
122  void renameCell(const CSGCell & cell, const std::string & name);
123 
125  bool operator==(const CSGCellList & other) const;
126 
128  bool operator!=(const CSGCellList & other) const;
129 
131  std::unordered_map<std::string, std::unique_ptr<CSGCell>> _cells;
132 
133  // Only CSGBase should be calling the methods in CSGCellList
134  friend class CSGBase;
135 };
136 } // namespace CSG
std::string name(const ElemQuality q)
CSGCell & addCell(std::unique_ptr< CSGCell > cell)
add a cell to the CellList.
Definition: CSGCellList.C:18
CSGCell & getCell(const std::string &name) const
Get the CSGCell by name.
Definition: CSGCellList.C:28
CSGRegions creates an internal representation of a CSG region, which can refer to an intersection...
Definition: CSGRegion.h:21
CSGCellList creates a container for CSGCell objects to pass to CSGBase object.
Definition: CSGCellList.h:20
CSGCellList()
Default constructor.
Definition: CSGCellList.C:15
std::unordered_map< std::string, std::unique_ptr< CSGCell > > & getCellListMap()
Get non-const map of all names to cells in cell list.
Definition: CSGCellList.h:80
bool operator!=(const CSGCellList &other) const
Operator overload for checking if two CSGCellList objects are not equal.
Definition: CSGCellList.C:108
CSGCell & addVoidCell(const std::string &name, const CSGRegion &region)
Add a Void Cell object cell list.
Definition: CSGCellList.C:37
std::vector< std::reference_wrapper< const CSGCell > > getAllCells() const
Get all the cells in CSGBase instance.
Definition: CSGCellList.C:59
CSGUniverse creates an internal representation of a Constructive Solid Geometry (CSG) universe...
Definition: CSGUniverse.h:26
CSGCell & addMaterialCell(const std::string &name, const std::string &mat_name, const CSGRegion &region)
Add a Material Cell object to cell list.
Definition: CSGCellList.C:43
CSGCell & addUniverseCell(const std::string &name, const CSGUniverse &univ, const CSGRegion &region)
Add a Universe Cell object to cell list.
Definition: CSGCellList.C:51
bool operator==(const CSGCellList &other) const
Operator overload for checking if two CSGCellList objects are equal.
Definition: CSGCellList.C:84
virtual ~CSGCellList()=default
Destructor.
CSGCell creates an internal representation of a Constructive Solid Geometry (CSG) cell...
Definition: CSGCell.h:27
const std::unordered_map< std::string, std::unique_ptr< CSGCell > > & getCellListMap() const
Get const map of all names to cells in cell list.
Definition: CSGCellList.h:87
void renameCell(const CSGCell &cell, const std::string &name)
rename the specified cell
Definition: CSGCellList.C:68
std::unordered_map< std::string, std::unique_ptr< CSGCell > > _cells
Mapping of cell names to pointers of stored cell objects.
Definition: CSGCellList.h:131
CSGBase creates an internal representation of a Constructive Solid Geometry (CSG) model...
Definition: CSGBase.h:29
bool hasCell(const std::string &name) const
return whether cell with given name exists in cell list
Definition: CSGCellList.h:73