https://mooseframework.inl.gov
CSGEngUnit.C
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 #include "CSGEngUnit.h"
11 #include "CSGBase.h"
12 
13 namespace CSG
14 {
15 
16 CSGEngUnit::~CSGEngUnit() = default;
17 
18 CSGEngUnit::CSGEngUnit(const std::string & behavior) : _internal_base(std::make_unique<CSGBase>())
19 {
20  _behavior = behavior;
21 }
22 
23 // Defined out of line (rather than inline in the header) because it returns the
24 // std::unique_ptr<CSGBase> by value, which instantiates ~unique_ptr<CSGBase>() and therefore
25 // requires CSGBase to be a complete type. CSGBase cannot be included in CSGEngUnit.h (circular
26 // include), so the definition lives here where CSGBase.h is available.
27 std::unique_ptr<CSGBase>
29 {
30  return std::move(_internal_base);
31 }
32 
33 bool
34 CSGEngUnit::operator==(const CSGEngUnit & other) const
35 {
36  if (getName() != other.getName())
37  return false;
38  if (getBehavior() != other.getBehavior())
39  return false;
40  if (getUnitType() != other.getUnitType())
41  return false;
42  if (getAttributes() != other.getAttributes())
43  return false;
44  if (getTransformations() != other.getTransformations())
45  return false;
46  return true;
47 }
48 
49 bool
50 CSGEngUnit::operator!=(const CSGEngUnit & other) const
51 {
52  return !(*this == other);
53 }
54 
55 } // namespace CSG
bool operator==(const CSGEngUnit &other) const
Operator overload for checking if two CSGEngUnit objects are equal.
Definition: CSGEngUnit.C:34
std::unique_ptr< CSGBase > _internal_base
CSGBase populated by expandUnit(); joined into the parent CSGBase by expandEngUnit() ...
Definition: CSGEngUnit.h:130
virtual const std::vector< std::pair< TransformationType, std::tuple< Real, Real, Real > > > & getTransformations() const =0
Get the list of transformations applied to this engineering unit.
CSGEngUnit(const std::string &behavior)
Constructor for intermediate EngUnit abstract classes.
Definition: CSGEngUnit.C:18
const std::string getUnitType() const
Get the type name of this engineering unit.
Definition: CSGEngUnit.h:63
virtual std::unordered_map< std::string, AttributeVariant > getAttributes() const =0
Get the attributes that define this engineering unit.
bool operator!=(const CSGEngUnit &other) const
Operator overload for checking if two CSGEngUnit objects are not equal.
Definition: CSGEngUnit.C:50
std::unique_ptr< CSGBase > releaseBase()
Transfer ownership of the internal CSGBase out of this unit.
Definition: CSGEngUnit.C:28
const std::string getBehavior() const
Get the behavior of this engineering unit (surface (i.e.
Definition: CSGEngUnit.h:56
MooseEnum _behavior
The basic CSG type this unit produces: "SURFACE", "CELL", or "UNIVERSE".
Definition: CSGEngUnit.h:133
virtual const std::string & getName() const =0
Get the unique instance name of this engineering unit.
CSGBase creates an internal representation of a Constructive Solid Geometry (CSG) model...
Definition: CSGBase.h:53
CSGEngUnit is the abstract base class for all "engineering unit" types in the CSG system...
Definition: CSGEngUnit.h:32
virtual ~CSGEngUnit()