/usr/include/freefoam/meshTools/surfaceIntersection.H is in libfreefoam-dev 0.1.0+dfsg-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | /*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ 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/>.
Class
Foam::surfaceIntersection
Description
Basic surface-surface intersection description. Constructed from two
surfaces it creates a description of the intersection.
The intersection information consists of the intersection line(s)
with new points, new edges between points (note that these edges and
points are on both surfaces) and various addressing from original
surface faces/edges to intersection and vice versa.
Gets either precalculated intersection information or calculates it
itself.
Algorithm works by intersecting all edges of one surface with the other
surface and storing a reference from both faces (one on surface1, one on
surface 2) to the vertex. If the reference re-occurs we have the second
hit of both faces and an edge is created between the retrieved vertex and
the new one.
Note: when doing intersecting itself uses intersection::planarTol() as a
fraction of
current edge length to determine if intersection is a point-touching one
instead of an edge-piercing action.
SourceFiles
surfaceIntersection.C
surfaceIntersectionFuncs.C
surfaceIntersectionTemplates.C
\*---------------------------------------------------------------------------*/
#ifndef surfaceIntersection_H
#define surfaceIntersection_H
#include <OpenFOAM/DynamicList.H>
#include <OpenFOAM/point.H>
#include <OpenFOAM/edge.H>
#include <triSurface/labelPairLookup.H>
#include <OpenFOAM/typeInfo.H>
#include <OpenFOAM/edgeList.H>
#include <meshTools/pointIndexHit.H>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class triSurfaceSearch;
class triSurface;
class edgeIntersections;
/*---------------------------------------------------------------------------*\
Class surfaceIntersection Declaration
\*---------------------------------------------------------------------------*/
class surfaceIntersection
{
// Private data
//- Newly introduced points.
pointField cutPoints_;
//- Newly introduced edges (are on both surfaces). Reference into
// cutPoints.
edgeList cutEdges_;
//- From face on surf1 and face on surf2 to intersection point
// (label in cutPoints)
labelPairLookup facePairToVertex_;
//- From face on surf1 and face on surf2 to intersection edge
// (label in cutEdges)
labelPairLookup facePairToEdge_;
//- Edges on surf1 that are cut. From edge on surf1 to label in cutPoint
// If multiple cuts:sorted from edge.start to edge.end
labelListList surf1EdgeCuts_;
//- Edges on surf2 that are cut. From edge on surf2 to label in cutPoint
// If multiple cuts:sorted from edge.start to edge.end
labelListList surf2EdgeCuts_;
// Private Member Functions
//- Write point in obj format.
static void writeOBJ(const point& pt, Ostream& os);
//- Write points and edges in obj format
static void writeOBJ
(
const List<point>&,
const List<edge>&,
Ostream&
);
//- Transfer contents of List<DynamicList<..> > to List<List<..>>
template<class T>
static void transfer(List<DynamicList<T> >&, List<List<T> >&);
//- Get minimum length of all edges connected to point
static scalar minEdgeLen(const triSurface& surf, const label pointI);
//- Get edge label of edge between face vertices fp and fp+1
static label getEdge
(
const triSurface& surf,
const label faceI,
const label fp
);
//- Remove duplicates from ordered dynamic list. Returns map from old
// to new (-1 if element removed)
static void removeDuplicates(const labelList& map, labelList& labels);
//- Apply map to elements of a labelList
static void inlineRemap(const labelList& map, labelList& elems);
// Remove all duplicate and degenerate elements. Return unique elements
// and map from old to new.
static edgeList filterEdges(const edgeList&, labelList& map);
//- Remove all duplicate elements.
static labelList filterLabels(const labelList& elems, labelList& map);
//- Do some checks if edge and face (resulting from hit)
// should not be considered. Returns true if can be discarded.
static bool excludeEdgeHit
(
const triSurface& surf,
const label edgeI,
const label faceI,
const scalar tol
);
////- Given edge (eStart - eEnd) and normal direction construct plane
//// and intersect all edges of hitFace with it.
//// Return the edge and coordinate of hit.
//static pointIndexHit faceEdgeIntersection
//(
// const triSurface&,
// const label hitFaceI,
//
// const vector& n,
// const point& eStart,
// const point& eEnd
//);
//- Debugging: Dump intersected edges to stream
void writeIntersectedEdges
(
const triSurface& surf,
const labelListList& edgeCutVerts,
Ostream& os
) const;
//- Detect if point close to edge of end. Returns -1: not close.
// 0:close (within startTol) to start, 1:close (within endTol) to end
static label classify
(
const scalar startTol,
const scalar endTol,
const point& p,
const edge& e,
const pointField& points
);
//- Update reference between faceA and faceB. Updates facePairToVertex_
// (first occurrence of face pair) and facePairToEdge_ (second occ.)
void storeIntersection
(
const bool isFirstSurf,
const labelList& facesA,
const label faceB,
DynamicList<edge>&,
DynamicList<point>&
);
//- Investigate pHit to whether is case of point hits point,
// point hits edge, point hits face or edge hits face.
void classifyHit
(
const triSurface& surf1,
const scalarField& surf1PointTol,
const triSurface& surf2,
const bool isFirstSurf,
const label edgeI,
const scalar tolDim,
const pointIndexHit& pHit,
DynamicList<edge>& allCutEdges,
DynamicList<point>& allCutPoints,
List<DynamicList<label> >& surfEdgeCuts
);
//- Cut edges of surf1 with surface 2.
void doCutEdges
(
const triSurface& surf1,
const triSurfaceSearch& querySurf2,
const bool isFirstSurf,
const bool isSelfIntersection,
DynamicList<edge>& allCutEdges,
DynamicList<point>& allCutPoints,
List<DynamicList<label> >& surfEdgeCuts
);
public:
ClassName("surfaceIntersection");
// Constructors
//- Construct null
surfaceIntersection();
//- Construct from precalculated intersection information.
// Advantage: intersection information is guaranteed to have no
// degenerate cuts.
surfaceIntersection
(
const triSurface& surf1,
const edgeIntersections& intersections1,
const triSurface& surf2,
const edgeIntersections& intersections2
);
//- Construct from two surfaces. Does all its own cutting.
// Has problems with degenerate cuts
surfaceIntersection
(
const triSurfaceSearch& querySurf1,
const triSurfaceSearch& querySurf2
);
//- Special: intersect surface with itself. Used to check for
// self-intersection.
surfaceIntersection(const triSurfaceSearch& querySurf1);
// Member Functions
const pointField& cutPoints() const;
const edgeList& cutEdges() const;
//const labelPairLookup& facePairToVertex() const;
const labelPairLookup& facePairToEdge() const;
//- Access either surf1EdgeCuts (isFirstSurface = true) or
// surf2EdgeCuts
const labelListList& edgeCuts(const bool) const;
const labelListList& surf1EdgeCuts() const;
const labelListList& surf2EdgeCuts() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include <meshTools/surfaceIntersectionTemplates.C>
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************ vim: set sw=4 sts=4 et: ************************ //
|