19getInnerRegion(
const std::vector<std::reference_wrapper<const CSGSurface>> & surfaces,
23 for (
const auto & surf_ref : surfaces)
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)
30 : inner_region & halfspace;
40 const std::regex invalid_symbols(R
"([\+\-~|& ])");
43 if (std::regex_search(name, matches, invalid_symbols))
45 char matched_char = name[matches.position(0)];
46 if (matched_char ==
' ')
47 mooseError(
"Detected whitespace in CSG component with name ", name,
". This is not allowed.");
49 mooseError(
"Invalid symbol in CSG component with name ", name,
": ", matched_char);
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
CSGRegions creates an internal representation of a CSG region, which can refer to an intersection,...
RegionType getRegionType() const
Get the region type.
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.
void checkValidCSGName(const std::string &name)
Check name of CSG component for disallowed characters and symbols.