https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
13namespace CSG
14{
15
16CSGEngUnit::~CSGEngUnit() = default;
17
18CSGEngUnit::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.
27std::unique_ptr<CSGBase>
29{
30 return std::move(_internal_base);
31}
32
33bool
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;
45 return false;
46 return true;
47}
48
49bool
51{
52 return !(*this == other);
53}
54
55} // namespace CSG
CSGBase creates an internal representation of a Constructive Solid Geometry (CSG) model.
Definition CSGBase.h:54
CSGEngUnit is the abstract base class for all "engineering unit" types in the CSG system.
Definition CSGEngUnit.h:33
std::unique_ptr< CSGBase > releaseBase()
Transfer ownership of the internal CSGBase out of this unit.
Definition CSGEngUnit.C:28
CSGEngUnit(const std::string &behavior)
Constructor for intermediate EngUnit abstract classes.
Definition CSGEngUnit.C:18
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.
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.
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 > _internal_base
CSGBase populated by expandUnit(); joined into the parent CSGBase by expandEngUnit()
Definition CSGEngUnit.h:130
virtual std::unordered_map< std::string, AttributeVariant > getAttributes() const =0
Get the attributes that define this engineering unit.
virtual ~CSGEngUnit()
const std::string getUnitType() const
Get the type name of this engineering unit.
Definition CSGEngUnit.h:63
bool operator==(const CSGEngUnit &other) const
Operator overload for checking if two CSGEngUnit objects are equal.
Definition CSGEngUnit.C:34