https://mooseframework.inl.gov
CSGCellEngUnit.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 "CSGCellEngUnit.h"
11 #include "CSGBase.h"
12 #include "CSGRegion.h"
13 
14 namespace CSG
15 {
16 
17 CSGCellEngUnit::CSGCellEngUnit(const std::string & name)
18  : CSGCell(name, CSGRegion()), CSGEngUnit("CELL")
19 {
20 }
21 
22 const CSGCell &
24 {
25  // must contain exactly one cell in the root universe to be considered a correct implementation
26  // and be expanded properly. Additional cells can exist in _internal_base through universe/cell
27  // nesting.
28  const auto & cells = _internal_base->getRootUniverse().getAllCells();
29  if (cells.size() == 0)
30  mooseError("The root universe of CSGCellEngUnit ",
31  getName(),
32  " contains no cells. ",
33  "Either getExpandedCell() was called before expandUnit() or expandUnit() is not "
34  "implemented correctly");
35  if (cells.size() > 1)
36  mooseError("CSGCellEngUnit '",
37  getName(),
38  "' expandUnit() must create exactly one cell in _internal_base's root universe "
39  "(found ",
40  cells.size(),
41  ").");
42  // Check that all universes and cells in _internal_base are reachable from root.
43  if (!_internal_base->areUniversesLinked())
44  mooseError("CSGCellEngUnit '",
45  getName(),
46  "' of type '",
47  getUnitType(),
48  "' contains unlinked universes or cells. All objects created in expandUnit() must "
49  "be reachable from root. Check implementation of expandUnit().");
50 
51  return cells[0];
52 }
53 
54 } // namespace CSG
std::string name(const ElemQuality q)
const std::string & getName() const override
Satisfy CSGEngUnit::getName() (resolved via CSGCell::getName())
CSGRegions creates an internal representation of a CSG region, which can refer to an intersection...
Definition: CSGRegion.h:22
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
std::unique_ptr< CSGBase > _internal_base
CSGBase populated by expandUnit(); joined into the parent CSGBase by expandEngUnit() ...
Definition: CSGEngUnit.h:130
const std::string getUnitType() const
Get the type name of this engineering unit.
Definition: CSGEngUnit.h:63
CSGCell creates an internal representation of a Constructive Solid Geometry (CSG) cell...
Definition: CSGCell.h:29
CSGEngUnit is the abstract base class for all "engineering unit" types in the CSG system...
Definition: CSGEngUnit.h:32
const CSGCell & getExpandedCell() const
Return the single cell in _internal_base&#39;s root, which IS the expanded cell.
CSGCellEngUnit(const std::string &name)
Constructor for derived classes.