chombo-discharge
Loading...
Searching...
No Matches
CD_PolyhedralEBUtils.H
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021-2026 SINTEF Energy Research
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
13#ifndef CD_POLYHEDRALEBUTILS_H
14#define CD_POLYHEDRALEBUTILS_H
15
16// Chombo includes
17#include <RealVect.H>
18
19// Our includes
20#include <CD_CutCellSurface.H>
21#include <CD_NamespaceHeader.H>
22
23namespace PolyhedralEB {
24
37inline bool
38isFluid(const Real a_value) noexcept;
39
51namespace detail {
52
53#if CH_SPACEDIM == 3
59constexpr int s_transverse[3][2] = {{1, 2}, {0, 2}, {0, 1}};
60#endif
61
67inline int
68edgeDirection(const int a_edge) noexcept;
69
75inline void
76edgeOrigin(const int a_edge, int a_offset[SpaceDim]) noexcept;
77
84inline void
85edgeCorners(const int a_edge, int& a_lo, int& a_hi) noexcept;
86
92inline RealVect
93cornerPosition(const int a_corner) noexcept;
94
104inline void
105faceCorners(const int a_dir, const int a_side, int a_corner[1 << (SpaceDim - 1)]) noexcept;
106
115inline int
116edgeIndex(const int a_dir, const int a_offset[SpaceDim]) noexcept;
117
131inline RealVect
132crossingPosition(const CutCellSurface& a_surface, const int a_edge, const Real a_tolerance) noexcept;
133
134#if CH_SPACEDIM == 3
141inline void
142faceEdges(const int a_dir, const int a_side, int a_edge[4]) noexcept;
143
159inline void
160polygonMoments(const RealVect* a_vertex,
161 const int a_num,
162 Real& a_area,
163 RealVect& a_vector,
164 RealVect& a_centroid) noexcept;
165
181inline int
182facePairs(const int a_dir, const int a_side, const CutCellSurface& a_surface, int a_pair[2][2]) noexcept;
183
197inline int
198crossingLoops(const CutCellSurface& a_surface,
199 int a_loop[CutCellSurface::s_numEdges],
200 int a_start[CutCellSurface::s_numEdges + 1]) noexcept;
201#endif
210constexpr Real s_weldTolerance = 1.0E-10;
211
218inline bool
219sameVertex(const RealVect& a_a, const RealVect& a_b) noexcept;
220
221} // namespace detail
222} // namespace PolyhedralEB
223
224#include <CD_NamespaceFooter.H>
225
227
228#endif
Declaration of the data a cut cell's embedded boundary is reconstructed from.
Implementation of CD_PolyhedralEBUtils.H.
bool isFluid(const Real a_value) noexcept
Which side of the interface a value lies on.
Definition CD_PolyhedralEBUtilsImplem.H:29
The values a cut cell's embedded boundary is reconstructed from.
Definition CD_CutCellSurface.H:41
static constexpr int s_numEdges
Number of cell edges a crossing can sit on.
Definition CD_CutCellSurface.H:46
void edgeOrigin(const int a_edge, int a_offset[SpaceDim]) noexcept
Corner offsets of a cell edge's low end.
Definition CD_PolyhedralEBUtilsImplem.H:45
void polygonMoments(const RealVect *a_vertex, const int a_num, Real &a_area, RealVect &a_vector, RealVect &a_centroid) noexcept
Area vector, area and centroid of a planar polygon given in circuit order.
Definition CD_PolyhedralEBUtilsImplem.H:206
constexpr int s_transverse[3][2]
The two directions transverse to each coordinate direction, in increasing order.
Definition CD_PolyhedralEBUtils.H:59
void faceEdges(const int a_dir, const int a_side, int a_edge[4]) noexcept
The edges of a cell face, edge i joining face corners i and i+1.
Definition CD_PolyhedralEBUtilsImplem.H:175
int facePairs(const int a_dir, const int a_side, const CutCellSurface &a_surface, int a_pair[2][2]) noexcept
The chords on a cell face, each an unordered pair of edge indices.
Definition CD_PolyhedralEBUtilsImplem.H:253
bool sameVertex(const RealVect &a_a, const RealVect &a_b) noexcept
Whether two positions are the same vertex.
Definition CD_PolyhedralEBUtilsImplem.H:411
RealVect cornerPosition(const int a_corner) noexcept
Position of a cell corner in the cell's own frame.
Definition CD_PolyhedralEBUtilsImplem.H:86
constexpr Real s_weldTolerance
Distance within which two vertices are taken to be the same one.
Definition CD_PolyhedralEBUtils.H:210
int edgeDirection(const int a_edge) noexcept
Direction a cell edge runs along.
Definition CD_PolyhedralEBUtilsImplem.H:37
void edgeCorners(const int a_edge, int &a_lo, int &a_hi) noexcept
The corners a cell edge joins, low end first.
Definition CD_PolyhedralEBUtilsImplem.H:67
void faceCorners(const int a_dir, const int a_side, int a_corner[1<<(SpaceDim - 1)]) noexcept
The corners of a cell face, in circuit order around the face.
Definition CD_PolyhedralEBUtilsImplem.H:100
int edgeIndex(const int a_dir, const int a_offset[SpaceDim]) noexcept
Index of the edge running along a_dir whose low corner has the given offsets.
Definition CD_PolyhedralEBUtilsImplem.H:124
RealVect crossingPosition(const CutCellSurface &a_surface, const int a_edge, const Real a_tolerance) noexcept
Position of an edge crossing in the cell's own frame.
Definition CD_PolyhedralEBUtilsImplem.H:140
int crossingLoops(const CutCellSurface &a_surface, int a_loop[CutCellSurface::s_numEdges], int a_start[CutCellSurface::s_numEdges+1]) noexcept
Order the crossings into closed loops, or fail if they do not form clean cycles.
Definition CD_PolyhedralEBUtilsImplem.H:313