LCOV - code coverage report
Current view: top level - src/utils - CSGUtils.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 9 21 42.9 %
Date: 2026-05-29 20:35:17 Functions: 1 2 50.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
      18             : CSGRegion
      19           0 : getInnerRegion(const std::vector<std::reference_wrapper<const CSGSurface>> & surfaces,
      20             :                const libMesh::Point & origin)
      21             : {
      22           0 :   CSGRegion inner_region;
      23           0 :   for (const auto & surf_ref : surfaces)
      24             :   {
      25           0 :     const auto & surf = surf_ref.get();
      26           0 :     const auto direction = surf.getHalfspaceFromPoint(origin);
      27           0 :     auto halfspace = (direction == CSGSurface::Halfspace::POSITIVE) ? +surf : -surf;
      28           0 :     inner_region = (inner_region.getRegionType() == CSGRegion::RegionType::EMPTY)
      29           0 :                        ? halfspace
      30           0 :                        : inner_region & halfspace;
      31           0 :   }
      32           0 :   return inner_region;
      33           0 : }
      34             : 
      35             : void
      36        1333 : checkValidCSGName(const std::string & name)
      37             : {
      38             :   // Check if invalid symbol is present in the name. These include whitespaces and symbols
      39             :   // for halfspaces and region operators
      40        1333 :   const std::regex invalid_symbols(R"([\+\-~|& ])");
      41        1333 :   std::smatch matches;
      42             : 
      43        1333 :   if (std::regex_search(name, matches, invalid_symbols))
      44             :   {
      45          12 :     char matched_char = name[matches.position(0)];
      46          12 :     if (matched_char == ' ')
      47           2 :       mooseError("Detected whitespace in CSG component with name ", name, ". This is not allowed.");
      48             :     else
      49          10 :       mooseError("Invalid symbol in CSG component with name ", name, ": ", matched_char);
      50             :   }
      51        1345 : }
      52             : }

Generated by: LCOV version 1.14