https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PointInSignedFunctionCheckUO.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
11#include "Function.h"
12#include "SurfaceSide.h"
13
15
18{
21 "Classifies a point as inside, on, or outside a surface defined by the "
22 "zero level set of a signed function.");
23 params.addRequiredParam<FunctionName>(
24 "function",
25 "Signed level-set function; negative inside by default (see inside_is_negative).");
26 params.addParam<Real>("tolerance",
28 "Half-width, in function value space, of the on-surface band around the "
29 "zero level set. Points within this band are labeled as on the surface.");
30 params.addParam<bool>(
31 "inside_is_negative",
32 true,
33 "Whether negative function values denote the interior. True matches the signed-distance "
34 "convention; set false for a level set that is positive inside.");
35 return params;
36}
37
39 : ThreadedGeneralUserObject(parameters),
40 _func(getFunction("function")),
41 _tolerance(getParam<Real>("tolerance")),
42 _inside_is_negative(getParam<bool>("inside_is_negative"))
43{
44 if (_tolerance <= 0.0)
45 paramError("tolerance", "must be greater than zero.");
46}
47
registerMooseObject("MooseApp", PointInSignedFunctionCheckUO)
virtual Real value(Real t, const Point &p) const
Override this to evaluate the scalar function at point (t,x,y,z), by default this returns zero,...
Definition Function.C:30
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump.
void paramError(const std::string &param, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
Definition MooseBase.h:457
Point-containment checker backed by a signed level-set Function: the point is labeled from the sign o...
const Function & _func
The signed level-set function (per-thread copy).
PointInSignedFunctionCheckUO(const InputParameters &parameters)
const bool _inside_is_negative
Whether negative function values denote the interior (SBM convention).
virtual SurfaceGeometry::SurfaceSide sideness(const Point &p) const override
const Real _tolerance
Half-width (in function value space) of the ON band around the zero level set.
An instance of this object type has one copy per thread that runs on each thread.
static InputParameters validParams()
SurfaceSide
The side of a closed surface where a query point is located.
Definition SurfaceSide.h:21
SurfaceSide signedValueSideness(Real phi, Real tolerance, bool inside_is_negative)
Classify a signed level-set value into a SurfaceSide.
Definition SurfaceSide.C:18
static constexpr Real TOLERANCE