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 
76  CSGCell &
77  addLatticeCell(const std::string & name, const CSGLattice & lattice, const CSGRegion & region);
78 
85  bool hasCell(const std::string & name) const { return _cells.find(name) != _cells.end(); }
86 
92  std::unordered_map<std::string, std::unique_ptr<CSGCell>> & getCellListMap() { return _cells; }
93 
99  const std::unordered_map<std::string, std::unique_ptr<CSGCell>> & getCellListMap() const
100  {
101  return _cells;
102  }
103 
109  std::vector<std::reference_wrapper<const CSGCell>> getAllCells() const;
110 
117  CSGCell & getCell(const std::string & name) const;
118 
127  CSGCell & addCell(std::unique_ptr<CSGCell> cell, const bool ignore_identical_cell = false);
128 
135  void renameCell(const CSGCell & cell, const std::string & name);
136 
138  bool operator==(const CSGCellList & other) const;
139 
141  bool operator!=(const CSGCellList & other) const;
142 
144  std::unordered_map<std::string, std::unique_ptr<CSGCell>> _cells;
145 
146  // Only CSGBase should be calling the methods in CSGCellList
147  friend class CSGBase;
148 };
149 } // namespace CSG
std::string name(const ElemQuality q)
CSGCell & getCell(const std::string &name) const
Get the CSGCell by name.
Definition: CSGCellList.C:44
CSGRegions creates an internal representation of a CSG region, which can refer to an intersection...
Definition: CSGRegion.h:22
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:92
bool operator!=(const CSGCellList &other) const
Operator overload for checking if two CSGCellList objects are not equal.
Definition: CSGCellList.C:132
CSGCell & addVoidCell(const std::string &name, const CSGRegion &region)
Add a Void Cell object cell list.
Definition: CSGCellList.C:53
std::vector< std::reference_wrapper< const CSGCell > > getAllCells() const
Get all the cells in CSGBase instance.
Definition: CSGCellList.C:83
CSGUniverse creates an internal representation of a Constructive Solid Geometry (CSG) universe...
Definition: CSGUniverse.h:27
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:59
CSGCell & addUniverseCell(const std::string &name, const CSGUniverse &univ, const CSGRegion &region)
Add a Universe Cell object to cell list.
Definition: CSGCellList.C:67
CSGLattice is the abstract class for defining lattices.
Definition: CSGLattice.h:34
CSGCell & addLatticeCell(const std::string &name, const CSGLattice &lattice, const CSGRegion &region)
Add a Lattice Cell object to cell list.
Definition: CSGCellList.C:75
bool operator==(const CSGCellList &other) const
Operator overload for checking if two CSGCellList objects are equal.
Definition: CSGCellList.C:108
virtual ~CSGCellList()=default
Destructor.
CSGCell & addCell(std::unique_ptr< CSGCell > cell, const bool ignore_identical_cell=false)
add a cell to the CellList.
Definition: CSGCellList.C:18
CSGCell creates an internal representation of a Constructive Solid Geometry (CSG) cell...
Definition: CSGCell.h:29
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:99
void renameCell(const CSGCell &cell, const std::string &name)
rename the specified cell
Definition: CSGCellList.C:92
std::unordered_map< std::string, std::unique_ptr< CSGCell > > _cells
Mapping of cell names to pointers of stored cell objects.
Definition: CSGCellList.h:144
CSGBase creates an internal representation of a Constructive Solid Geometry (CSG) model...
Definition: CSGBase.h:51
bool hasCell(const std::string &name) const
return whether cell with given name exists in cell list
Definition: CSGCellList.h:85