https://mooseframework.inl.gov
Loading...
Searching...
No Matches
CSGUniverseList.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 "CSGUniverse.h"
13
14namespace CSG
15{
16
21{
22protected:
27
31 virtual ~CSGUniverseList() = default;
32
39 CSGUniverse & addUniverse(const std::string & name);
40
47 bool hasUniverse(const std::string & name) const
48 {
49 return _universes.find(name) != _universes.end();
50 }
51
57 std::unordered_map<std::string, std::unique_ptr<CSGUniverse>> & getUniverseListMap()
58 {
59 return _universes;
60 }
61
67 const std::unordered_map<std::string, std::unique_ptr<CSGUniverse>> & getUniverseListMap() const
68 {
69 return _universes;
70 }
71
77 std::vector<std::reference_wrapper<const CSGUniverse>> getAllUniverses() const;
78
85 CSGUniverse & getUniverse(const std::string & name) const;
86
92 const CSGUniverse & getRoot() const { return *_root_universe; };
93
103 CSGUniverse & addUniverse(std::unique_ptr<CSGUniverse> universe,
104 const bool ignore_identical_universe = false);
105
112 void renameUniverse(const CSGUniverse & universe, const std::string & name);
113
115 bool operator==(const CSGUniverseList & other) const;
116
118 bool operator!=(const CSGUniverseList & other) const;
119
121 std::unordered_map<std::string, std::unique_ptr<CSGUniverse>> _universes;
122
125
126 // Only CSGBase should be calling the methods in CSGUniverseList
127 friend class CSGBase;
128};
129} // namespace CSG
CSGBase creates an internal representation of a Constructive Solid Geometry (CSG) model.
Definition CSGBase.h:54
CSGUniverseList creates a container for CSGUniverse objects to pass to CSGBase.
std::vector< std::reference_wrapper< const CSGUniverse > > getAllUniverses() const
Get all the universes in CSGBase instance.
const CSGUniverse & getRoot() const
Get the root universe.
void renameUniverse(const CSGUniverse &universe, const std::string &name)
rename the specified universe
bool operator==(const CSGUniverseList &other) const
Operator overload for checking if two CSGUniverseList objects are equal.
std::unordered_map< std::string, std::unique_ptr< CSGUniverse > > & getUniverseListMap()
Get non-const map of all names to universes in universe list.
const std::unordered_map< std::string, std::unique_ptr< CSGUniverse > > & getUniverseListMap() const
Get const map of all names to universes in universe list.
CSGUniverseList()
Default constructor.
bool hasUniverse(const std::string &name) const
return whether universe with given name exists in universe list
bool operator!=(const CSGUniverseList &other) const
Operator overload for checking if two CSGUniverseList objects are not equal.
const CSGUniverse * _root_universe
root universe for the CSGBase instance
std::unordered_map< std::string, std::unique_ptr< CSGUniverse > > _universes
Mapping of universe names to pointers of stored universe objects.
CSGUniverse & getUniverse(const std::string &name) const
Get a Universe from the list by its name.
CSGUniverse & addUniverse(const std::string &name)
create an empty universe
virtual ~CSGUniverseList()=default
Destructor.
CSGUniverse creates an internal representation of a Constructive Solid Geometry (CSG) universe,...
Definition CSGUniverse.h:28