https://mooseframework.inl.gov
Loading...
Searching...
No Matches
CSGEngUnitList.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 "CSGSurfaceEngUnit.h"
13#include "CSGCellEngUnit.h"
14#include "CSGUniverseEngUnit.h"
15
16namespace CSG
17{
18
29{
30protected:
35
39 virtual ~CSGEngUnitList() = default;
40
47 bool hasEngUnit(const std::string & name) const
48 {
49 for (const auto * ptr : _eng_units)
50 if (ptr->getName() == name)
51 return true;
52 return false;
53 }
54
60 std::vector<std::reference_wrapper<const CSGEngUnit>> getAllEngUnits() const;
61
67 std::vector<std::reference_wrapper<const CSGSurfaceEngUnit>> getAllSurfaceEngUnits() const;
68
74 std::vector<std::reference_wrapper<const CSGCellEngUnit>> getAllCellEngUnits() const;
75
81 std::vector<std::reference_wrapper<const CSGUniverseEngUnit>> getAllUniverseEngUnits() const;
82
93
100 CSGEngUnit & getEngUnit(const std::string & name) const;
101
110 void removeEngUnit(const CSGEngUnit & unit);
111
113 bool operator==(const CSGEngUnitList & other) const;
114
116 bool operator!=(const CSGEngUnitList & other) const;
117
120 std::vector<CSGEngUnit *> _eng_units;
121
122 // Only CSGBase should be calling the methods in CSGEngUnitList
123 friend class CSGBase;
124};
125
126} // namespace CSG
CSGBase creates an internal representation of a Constructive Solid Geometry (CSG) model.
Definition CSGBase.h:54
CSGEngUnitList is a non-owning index of CSGEngUnit objects stored in the type lists (CSGSurfaceList,...
std::vector< CSGEngUnit * > _eng_units
Non-owning index: raw pointers into the type lists.
virtual ~CSGEngUnitList()=default
Destructor.
CSGEngUnit & addEngUnit(CSGEngUnit &unit)
Register an engineering unit in this index.
std::vector< std::reference_wrapper< const CSGSurfaceEngUnit > > getAllSurfaceEngUnits() const
Get all surface-like engineering units.
CSGEngUnitList()
Default constructor.
void removeEngUnit(const CSGEngUnit &unit)
Remove an engineering unit from this index by address.
CSGEngUnit & getEngUnit(const std::string &name) const
Get an engineering unit by name.
std::vector< std::reference_wrapper< const CSGUniverseEngUnit > > getAllUniverseEngUnits() const
Get all universe-like engineering units.
bool operator==(const CSGEngUnitList &other) const
Operator overload for checking if two CSGEngUnitList objects are equal.
std::vector< std::reference_wrapper< const CSGEngUnit > > getAllEngUnits() const
Get all engineering units of all types in the list.
std::vector< std::reference_wrapper< const CSGCellEngUnit > > getAllCellEngUnits() const
Get all cell-like engineering units.
bool hasEngUnit(const std::string &name) const
Return whether an engineering unit with the given name exists in this list.
bool operator!=(const CSGEngUnitList &other) const
Operator overload for checking if two CSGEngUnitList objects are not equal.
CSGEngUnit is the abstract base class for all "engineering unit" types in the CSG system.
Definition CSGEngUnit.h:33