LCOV - code coverage report
Current view: top level - include/csg - CSGXCylinder.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #31730 (e8b711) with base e0c998 Lines: 1 1 100.0 %
Date: 2025-10-29 16:49:47 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://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             : 
      12             : #include "CSGSurface.h"
      13             : 
      14             : #include "libmesh/point.h"
      15             : 
      16             : namespace CSG
      17             : {
      18             : 
      19             : /**
      20             :  * CSGXCylinder creates an internal representation of a Constructive Solid Geometry (CSG)
      21             :  * x-axis aligned cylinder, represented in the following form (y - y0)^2 + (z - z0)^2 = r^2
      22             :  */
      23             : class CSGXCylinder : public CSGSurface
      24             : {
      25             : public:
      26             :   /**
      27             :    * @brief Construct a cylinder surface aligned with the x axis
      28             :    *
      29             :    * @param name unique name of surface
      30             :    * @param y0 y coordinate of center
      31             :    * @param z0 z coordinate of center
      32             :    * @param r radius
      33             :    */
      34             :   CSGXCylinder(const std::string & name, const Real y0, const Real z0, const Real r);
      35             : 
      36             :   /**
      37             :    * Destructor
      38             :    */
      39           4 :   virtual ~CSGXCylinder() = default;
      40             : 
      41             :   /**
      42             :    * @brief Get the coefficients (y0, z0, and r) that define the cylindrical surface
      43             :    * with the equation: (y - y0)^2 + (z - z0)^2 = r^2
      44             :    *
      45             :    * @return map of coefficients to their value
      46             :    */
      47             :   virtual std::unordered_map<std::string, Real> getCoeffs() const override;
      48             : 
      49             :   /**
      50             :    * @brief given a point, determine its evaluation based on the equation of the cylinder
      51             :    *
      52             :    * @param p point
      53             :    * @return evaluation of point based on surface equation
      54             :    */
      55             :   virtual Real evaluateSurfaceEquationAtPoint(const Point & p) const override;
      56             : 
      57             : protected:
      58             :   // check that radius is positive
      59             :   void checkRadius() const;
      60             : 
      61             :   /// Value of y0 in equation of an x-axis aligned cylinder
      62             :   Real _y0;
      63             : 
      64             :   /// Value of z0 in equation of an x-axis aligned cylinder
      65             :   Real _z0;
      66             : 
      67             :   /// Value of r in equation of an x-axis aligned cylinder
      68             :   Real _r;
      69             : };
      70             : } // namespace CSG

Generated by: LCOV version 1.14