https://mooseframework.inl.gov
CSGLatticeList.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 "CSGLattice.h"
13 
14 namespace CSG
15 {
16 
21 {
22 protected:
27 
31  virtual ~CSGLatticeList() = default;
32 
42  CSGLattice & addLattice(std::unique_ptr<CSGLattice> lattice,
43  const bool ignore_identical_lattice = false);
44 
51  bool hasLattice(const std::string & name) const
52  {
53  return _lattices.find(name) != _lattices.end();
54  }
55 
61  std::unordered_map<std::string, std::unique_ptr<CSGLattice>> & getLatticeListMap()
62  {
63  return _lattices;
64  }
65 
71  const std::unordered_map<std::string, std::unique_ptr<CSGLattice>> & getLatticeListMap() const
72  {
73  return _lattices;
74  }
75 
81  std::vector<std::reference_wrapper<const CSGLattice>> getAllLattices() const;
82 
89  CSGLattice & getLattice(const std::string & name) const;
90 
97  void renameLattice(const CSGLattice & lattice, const std::string & name);
98 
100  bool operator==(const CSGLatticeList & other) const;
101 
103  bool operator!=(const CSGLatticeList & other) const;
104 
106  std::unordered_map<std::string, std::unique_ptr<CSGLattice>> _lattices;
107 
108  // Only CSGBase should be calling the methods in CSGLatticeList
109  friend class CSGBase;
110 };
111 } // namespace CSG
std::string name(const ElemQuality q)
CSGLattice & addLattice(std::unique_ptr< CSGLattice > lattice, const bool ignore_identical_lattice=false)
add an existing lattice to list.
bool operator!=(const CSGLatticeList &other) const
Operator overload for checking if two CSGLatticeList objects are not equal.
std::vector< std::reference_wrapper< const CSGLattice > > getAllLattices() const
Get all the lattices in CSGBase instance.
void renameLattice(const CSGLattice &lattice, const std::string &name)
rename the specified lattice
CSGLatticeList creates a container for CSGLattice objects to pass to CSGBase.
std::unordered_map< std::string, std::unique_ptr< CSGLattice > > _lattices
Mapping of lattice names to pointers of stored lattice objects.
CSGLattice is the abstract class for defining lattices.
Definition: CSGLattice.h:34
CSGLatticeList()
Default constructor.
bool hasLattice(const std::string &name) const
return whether lattice with given name exists in lattice list
std::unordered_map< std::string, std::unique_ptr< CSGLattice > > & getLatticeListMap()
Get map of all names to lattices in lattice list.
const std::unordered_map< std::string, std::unique_ptr< CSGLattice > > & getLatticeListMap() const
Get const map of all names to lattices in lattice list.
bool operator==(const CSGLatticeList &other) const
Operator overload for checking if two CSGLatticeList objects are equal.
CSGBase creates an internal representation of a Constructive Solid Geometry (CSG) model...
Definition: CSGBase.h:51
virtual ~CSGLatticeList()=default
Destructor.
CSGLattice & getLattice(const std::string &name) const
Get a Lattice from the list by its name.