https://mooseframework.inl.gov
CSGEngUnit.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 
13 #include "JsonIO.h"
14 #include "MooseEnum.h"
15 
16 namespace CSG
17 {
18 
19 class CSGBase; // forward declaration
20 
33 {
34 public:
35  virtual ~CSGEngUnit();
36 
46  virtual const std::string & getName() const = 0;
47 
56  const std::string getBehavior() const { return _behavior; }
57 
63  const std::string getUnitType() const
64  {
65  return MooseUtils::prettyCppType(libMesh::demangle(typeid(*this).name()));
66  }
67 
76  virtual std::unordered_map<std::string, AttributeVariant> getAttributes() const = 0;
77 
79  virtual const std::vector<std::pair<TransformationType, std::tuple<Real, Real, Real>>> &
80  getTransformations() const = 0;
81 
83  virtual std::vector<std::pair<std::string, std::tuple<Real, Real, Real>>>
84  getTransformationsAsStrings() const = 0;
85 
87  bool operator==(const CSGEngUnit & other) const;
88 
90  bool operator!=(const CSGEngUnit & other) const;
91 
92 protected:
99  CSGEngUnit(const std::string & behavior);
100 
110  virtual void expandUnit() = 0;
111 
117  CSGBase & getBase() { return *_internal_base; }
118 
127  std::unique_ptr<CSGBase> releaseBase();
128 
130  std::unique_ptr<CSGBase> _internal_base;
131 
133  MooseEnum _behavior{"SURFACE CELL UNIVERSE"};
134 
135  friend class CSGBase;
136 };
137 
138 } // 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 void expandUnit()=0
Expand this engineering unit into basic CSG objects stored in _internal_base.
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
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:54
std::string demangle(const char *name)
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
virtual std::vector< std::pair< std::string, std::tuple< Real, Real, Real > > > getTransformationsAsStrings() const =0
Get the transformations with string representations for types.
CSGBase & getBase()
Get the internal CSGBase owned by this engineering unit.
Definition: CSGEngUnit.h:117
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
std::string prettyCppType(const std::string &cpp_type)
Definition: MooseUtils.C:1151
virtual ~CSGEngUnit()