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 : #include "CSGSurface.h" 11 : 12 : namespace CSG 13 : { 14 : 15 262 : CSGSurface::CSGSurface(const std::string & name, const std::string & surf_type) 16 262 : : _name(name), _surface_type(surf_type) 17 : { 18 262 : } 19 : 20 : CSGSurface::Halfspace 21 148 : CSGSurface::getHalfspaceFromPoint(const Point & p) const 22 : { 23 148 : auto eval = evaluateSurfaceEquationAtPoint(p); 24 148 : if (MooseUtils::absoluteFuzzyGreaterThan(eval, 0)) 25 73 : return Halfspace::POSITIVE; 26 75 : else if (MooseUtils::absoluteFuzzyLessThan(eval, 0)) 27 73 : return Halfspace::NEGATIVE; 28 : else 29 2 : mooseError("Point ", 30 : p, 31 : " used to determine halfspace evaluation lies on the surface ", 32 2 : _name, 33 : ", leading to an ambiguously defined halfspace."); 34 : } 35 : 36 : bool 37 96 : CSGSurface::operator==(const CSGSurface & other) const 38 : { 39 190 : return (this->getName() == other.getName()) && 40 286 : (this->getSurfaceType() == other.getSurfaceType()) && 41 190 : (this->getCoeffs() == other.getCoeffs()); 42 : } 43 : 44 : bool 45 90 : CSGSurface::operator!=(const CSGSurface & other) const 46 : { 47 90 : return !(*this == other); 48 : } 49 : 50 : } // namespace CSG