43 namespace searchableSurfaceModifiers
52 void Foam::searchableSurfaceModifiers::cut::triangulate
62 nTris += fcs[i].size()-2;
65 DynamicList<labelledTri> tris(nTris);
69 const face&
f = fcs[i];
71 for (label fp = 1; fp <
f.size()-1; fp++)
73 tris.append(labelledTri(
f[0],
f[fp],
f[
f.fcIndex(fp)], i));
79 patches[patchi] = geometricSurfacePatch
85 cutSurf = triSurface(tris,
patches,
pts,
true);
91 const searchableSurface& cutter,
95 if (isA<searchableBox>(cutter))
97 const searchableBox& bb = refCast<const searchableBox>(cutter);
104 else if (isA<searchableRotatedBox>(cutter))
106 const searchableRotatedBox& bb =
107 refCast<const searchableRotatedBox>(cutter);
114 else if (isA<triSurfaceMesh>(cutter))
116 return const_cast<triSurfaceMesh&
> 118 refCast<const triSurfaceMesh>(cutter)
124 <<
"Triangulation only supported for triSurfaceMesh, searchableBox" 125 <<
", not for surface " << cutter.name()
126 <<
" of type " << cutter.type()
128 return const_cast<triSurfaceMesh&
> 130 refCast<const triSurfaceMesh>(cutter)
138 bool Foam::searchableSurfaceModifiers::cut::intersectSurfaces
141 edgeIntersections& edgeCuts1,
143 edgeIntersections& edgeCuts2
146 bool hasMoved1 =
false;
147 bool hasMoved2 =
false;
149 for (label iter = 0; iter < 10; iter++)
151 Info<<
"Determining intersections of surf1 edges with surf2" 159 triSurfaceSearch querySurf2(surf2);
167 edgeCuts1 = edgeIntersections
179 edgeCuts1.removeDegenerates
191 surf1.movePoints(points1);
197 Info<<
"Determining intersections of surf2 edges with surf1" 202 triSurfaceSearch querySurf1(surf1);
210 edgeCuts2 = edgeIntersections
222 edgeCuts2.removeDegenerates
234 surf2.movePoints(points2);
241 if (nIters1 == 0 && nIters2 == 0)
265 return hasMoved1 || hasMoved2;
273 const searchableSurfaces& geometry,
274 const dictionary&
dict 277 searchableSurfaceModifier(geometry,
dict),
278 cutterNames_(dict_.
get<wordRes>(
"cutters"))
287 searchableSurface& geom
290 triSurface& surf = refCast<triSurfaceMesh>(geom);
292 bool changed =
false;
295 for (
const wordRe& cutterName : cutterNames_)
299 for (
const label geomI : geomIDs)
301 const searchableSurface& cutter = geometry_[geomI];
305 triSurface& cutSurf = triangulate(cutter, work);
308 edgeIntersections edge1Cuts;
309 edgeIntersections edge2Cuts;
320 surfaceIntersection inter(surf, edge1Cuts, cutSurf, edge2Cuts);
324 intersectedSurface surf3(surf,
true, inter);
328 List<volumeType> volTypes;
329 cutter.getVolumeType(surf3.faceCentres(), volTypes);
341 if (nInside && surf3.patches().size() > 0)
344 label sz = newPatches.
size();
345 newPatches.setSize(sz+1);
346 newPatches[sz] = geometricSurfacePatch
348 newPatches[sz-1].
name() +
"_inside",
349 newPatches[sz-1].index(),
350 newPatches[sz-1].geometricType()
353 Info<<
"Moving " << nInside <<
" out of " << surf3.size()
354 <<
" triangles to region " 355 << newPatches[sz].name() <<
endl;
358 List<labelledTri> newTris(surf3);
363 newTris[i].region() = sz;
367 surf = triSurface(newTris, newPatches, newPoints,
true);
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
void size(const label n)
Older name for setAddressableSize.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual bool modify(const labelList ®ions, searchableSurface &) const
Apply this selector.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static const faceList faces
Face to point addressing, using octant corner points.
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
static word defaultName(const label n=-1)
Default patch name: "patch" or "patchN".
List< face > faceList
List of faces.
static scalarField minEdgeLength(const triSurface &surf)
Calculate min edge length for every surface point.
vectorField pointField
pointField is a vectorField.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
A location inside the volume.
List< geometricSurfacePatch > geometricSurfacePatchList
List of geometricSurfacePatch.
defineTypeNameAndDebug(combustionModel, 0)
const polyBoundaryMesh & patches
messageStream Info
Information stream (stdout output on master, null elsewhere)
List< label > labelList
A List of labels.
Triangulated surface description with patch information.
cut(const searchableSurfaces &, const dictionary &)
Construct from dictionary.
labelList findStrings(const regExp &matcher, const UList< StringType > &input, const bool invert=false)
Return list indices for strings matching the regular expression.
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)