File size: 3,960 Bytes
5a600cf | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | /*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Namespace
Foam::cutPoly
Description
Low level functions for cutting poly faces and cells
Cutting a face using an iso-surface defined at the points is done by
walking around the face. A start point is chosen and then the walk proceeds
until a "cut" edge is found with points on either side of the iso-surface.
This edge is noted and the walk continues until another cut edge is found.
These two edge cuts, along with all points in-between, form a sub-face on
one side of the iso-surface. This algorithm continues around the entire
face, potentially cutting off multiple sub-faces. The remainder is a single
contiguous face on the other side of the iso-surface.
Cutting a cell is then done by walking from cut-edge to cut-edge around the
cell's faces.
SourceFiles
cutPoly.C
\*---------------------------------------------------------------------------*/
#ifndef cutPoly_H
#define cutPoly_H
#include "cellEdgeAddressing.H"
#include "PrimitivePatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class OBJstream;
namespace cutPoly
{
//- This flag determines which side of the iso-surface is separated into
// multiple sub-faces, and which side is kept as the central contiguous face
static const bool separatedBelow = true;
//- Return the cuts for a given face. This returns a list of pairs of
// face-edge indices. Both edges in the pair are cut, and connecting these
// cuts creates an edge of the iso-surface.
List<labelPair> faceCuts
(
const face& f,
const scalarField& pAlphas,
const scalar isoAlpha
);
//- Return the cuts for a given cell. This returns a list of lists of cell-edge
// indices. Each sub-list represents a single closed loop of cell-edges. The
// edges listed are all cut, and connecting these cuts up creates a face of
// the iso-surface.
labelListList cellCuts
(
const cell& c,
const cellEdgeAddressing& cAddr,
const faceUList& fs,
const List<List<labelPair>>& fCuts,
const scalarField& pAlphas,
const scalar isoAlpha
);
//- Write the cuts for a given face to an OBJ file
void writeFaceCuts
(
const face& f,
const List<labelPair>& fCuts,
const pointField& ps,
const scalarField& pAlphas,
const scalar isoAlpha,
OBJstream& obj
);
//- Write the cuts for a given cell to an OBJ file
void writeCellCuts
(
const cell& c,
const cellEdgeAddressing& cAddr,
const List<List<label>>& cCuts,
const faceList& fs,
const pointField& ps,
const scalarField& pAlphas,
const scalar isoAlpha,
OBJstream& obj
);
} // End namespace cutPoly
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
|