https://mooseframework.inl.gov
Loading...
Searching...
No Matches
SBMUtils.h
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#pragma once
11
12#include "MooseMesh.h"
13#include "MooseTypes.h"
14#include "libmesh/enum_order.h"
15
16#include <functional>
17#include <optional>
18
19class Function;
21class InputParameters;
22namespace libMesh
23{
24class Point;
25}
26
27namespace SBMUtils
28{
29bool checkWatertightnessFromRawElems(const std::vector<const Elem *> & bd_elements);
30
32Real activeElementFraction(const Elem & elem,
33 Order qrule_order,
34 const std::function<bool(const libMesh::Point &)> & is_active);
35
40bool isInactive(Real active_fraction, Real lambda);
41
53
59elementDomainOccupancy(const Elem & elem,
60 Order qrule_order,
61 const std::function<bool(const libMesh::Point &)> & is_in_domain);
62
66elementDomainOccupancy(const Elem & elem,
67 Order qrule_order,
68 const std::function<bool(const libMesh::Point &)> & is_in_domain,
69 const std::function<bool(const libMesh::Point &)> & is_outside_domain);
70
77
84
95std::optional<SubdomainID>
96selectSubdomainFromOccupancies(const std::vector<SubdomainOccupancy> & candidate_occupancies,
97 const InterceptedSubdomainPolicy & intercepted_policy,
98 Real lambda);
99
107
115 const ClassificationSubdomains & subdomain_id_settings,
116 bool mark_intercepted,
117 Real lambda);
118
120std::vector<const Function *>
121buildDistanceFunctions(const std::vector<FunctionName> & function_names,
122 const FunctionInterface & function_provider);
123
128RealVectorValue
129distanceVectorFromFunction(const Function * func, const libMesh::Point & pt, Real t);
130
132RealVectorValue trueNormalFromFunction(const Function * func, const libMesh::Point & pt, Real t);
133
135RealVectorValue closestDistanceVector(const std::vector<const Function *> & funcs,
136 const libMesh::Point & pt,
137 Real t);
138
140RealVectorValue closestTrueNormalVector(const std::vector<const Function *> & funcs,
141 const libMesh::Point & pt,
142 Real t);
143
147Real unionSignedDistance(const std::vector<const Function *> & funcs, Real t, const Point & p);
148}
const Real p
std::optional< SubdomainID > selectSubdomainFromOccupancies(const std::vector< SubdomainOccupancy > &candidate_occupancies, const InterceptedSubdomainPolicy &intercepted_policy, Real lambda)
Select a subdomain based on how multiple candidate domains occupy an element.
Definition SBMUtils.C:92
ElementDomainOccupancy elementDomainOccupancy(const Elem &elem, Order qrule_order, const std::function< bool(const libMesh::Point &)> &is_in_domain)
Test an element against the domain defined by is_in_domain.
Definition SBMUtils.C:51
Real activeElementFraction(const Elem &elem, Order qrule_order, const std::function< bool(const libMesh::Point &)> &is_active)
Compute the fraction of an element's quadrature-weighted measure satisfying a predicate.
Definition SBMUtils.C:26
Real unionSignedDistance(const std::vector< const Function * > &funcs, Real t, const Point &p)
Computes the union signed distance by taking the minimum of all signed distance functions.
Definition SBMUtils.C:284
RealVectorValue closestTrueNormalVector(const std::vector< const Function * > &funcs, const libMesh::Point &pt, Real t)
Scan all distance functions and return the corresponding normal vector.
Definition SBMUtils.C:262
bool checkWatertightnessFromRawElems(const std::vector< const Elem * > &bd_elements)
Definition SBMUtils.C:161
SubdomainID classifySubdomainFromOccupancy(const ElementDomainOccupancy &occupancy, const ClassificationSubdomains &subdomain_id_settings, bool mark_intercepted, Real lambda)
Classify an element from its retained-domain occupancy measurements.
Definition SBMUtils.C:138
bool isInactive(Real active_fraction, Real lambda)
Return whether a partial element is inactive, i.e.
Definition SBMUtils.C:81
std::vector< const Function * > buildDistanceFunctions(const std::vector< FunctionName > &function_names, const FunctionInterface &function_provider)
Build a list of distance functions based on names specified in input.
Definition SBMUtils.C:172
RealVectorValue distanceVectorFromFunction(const Function *func, const libMesh::Point &pt, Real t)
Compute the distance vector induced by a distance function.
Definition SBMUtils.C:197
RealVectorValue trueNormalFromFunction(const Function *func, const libMesh::Point &pt, Real t)
Compute the true boundary surface normal at the point on the boundary closest to pt.
Definition SBMUtils.C:217
RealVectorValue closestDistanceVector(const std::vector< const Function * > &funcs, const libMesh::Point &pt, Real t)
Scan all distance functions and return the closest distance vector.
Definition SBMUtils.C:240
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
The subdomain IDs a (possibly partial) element can be labeled with.
Definition SBMUtils.h:102
Results of testing an element against a domain.
Definition SBMUtils.h:45
bool all_nodes_in_domain
Whether all element nodes lie in the retained domain.
Definition SBMUtils.h:47
bool all_nodes_outside_domain
Whether all element nodes lie outside the retained domain.
Definition SBMUtils.h:49
Real fraction_of_element_in_domain
Quadrature-based estimate of the fraction of this element inside the domain.
Definition SBMUtils.h:51
Policy for assigning partial elements to a dedicated intercepted subdomain.
Definition SBMUtils.h:73
A candidate subdomain and its occupancy of an element.
Definition SBMUtils.h:80
ElementDomainOccupancy occupancy
Definition SBMUtils.h:82