https://mooseframework.inl.gov
Loading...
Searching...
No Matches
SurfaceSide.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#include "SurfaceSide.h"
11
12#include <cmath>
13
14namespace SurfaceGeometry
15{
16
18signedValueSideness(Real phi, const Real tolerance, const bool inside_is_negative)
19{
20 // Normalize so that negative always denotes the interior.
21 if (!inside_is_negative)
22 phi = -phi;
23
24 if (phi < -tolerance)
26 if (std::abs(phi) <= tolerance)
27 return SurfaceSide::ON;
29}
30
31// This two-argument form holds the union precedence. Callers fold their per-geometry
32// queries through it one at a time, which lets them stop as soon as the result reaches
33// INSIDE (the maximal value), skipping further (possibly expensive) queries once union
34// membership is decided.
37{
38 // Precedence: INSIDE beats ON beats OUTSIDE.
41 if (a == SurfaceSide::ON || b == SurfaceSide::ON)
42 return SurfaceSide::ON;
44}
45
46} // namespace SurfaceGeometry
SurfaceSide unionSideness(SurfaceSide a, SurfaceSide b)
Combine two classifications for a union: INSIDE if either is INSIDE, otherwise ON if either is ON,...
Definition SurfaceSide.C:36
SurfaceSide
The side of a closed surface where a query point is located.
Definition SurfaceSide.h:21
@ INSIDE
The point lies strictly in the interior of the closed surface.
@ ON
The point lies on the surface itself, within tolerance.
@ OUTSIDE
The point lies strictly in the exterior of the closed surface.
SurfaceSide signedValueSideness(Real phi, Real tolerance, bool inside_is_negative)
Classify a signed level-set value into a SurfaceSide.
Definition SurfaceSide.C:18