https://mooseframework.inl.gov
CSGUtils.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
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 // MOOSE includes
11 #include "CSGUtils.h"
12 
13 using namespace CSG;
14 
15 namespace CSGUtils
16 {
17 
19 getInnerRegion(const std::vector<std::reference_wrapper<const CSGSurface>> & surfaces,
20  const libMesh::Point & origin)
21 {
22  CSGRegion inner_region;
23  for (const auto & surf_ref : surfaces)
24  {
25  const auto & surf = surf_ref.get();
26  const auto direction = surf.getHalfspaceFromPoint(origin);
27  auto halfspace = (direction == CSGSurface::Halfspace::POSITIVE) ? +surf : -surf;
28  inner_region = (inner_region.getRegionType() == CSGRegion::RegionType::EMPTY)
29  ? halfspace
30  : inner_region & halfspace;
31  }
32  return inner_region;
33 }
34 }
CSGRegions creates an internal representation of a CSG region, which can refer to an intersection...
Definition: CSGRegion.h:21
RegionType getRegionType() const
Get the region type.
Definition: CSGRegion.h:83
CSG::CSGRegion getInnerRegion(const std::vector< std::reference_wrapper< const CSG::CSGSurface >> &surfaces, const libMesh::Point &origin)
Get inner region of given surfaces, defined as the intersection of halfspaces of each surface...
Definition: CSGUtils.C:19