Go to the documentation of this file.
53 const label newPointI,
63 label fp1 =
f.fcIndex(fp0);
64 label fp2 =
f.fcIndex(fp1);
151 void createBoundaryEdgeTrees
163 treeBoundaryEdges[surfI] =
179 bb.min() -=
point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
180 bb.max() +=
point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
192 treeBoundaryEdges[surfI]
204 class findNearestOpSubset
219 shapeMask_(shapeMask)
227 scalar& nearestDistSqr,
236 const label index = indices[i];
242 &&
findIndex(shapeMask_, edgeIndex) != -1
257 if (distSqr < nearestDistSqr)
259 nearestDistSqr = distSqr;
271 int main(
int argc,
char *argv[])
275 "hook surfaces to other surfaces by moving and retriangulating their"
276 "boundary edges to match other surface boundary edges"
294 const scalar matchTolerance(
max(1
e-6*dist, SMALL));
295 const label maxIters = 100;
297 Info<<
"Hooking distance = " << dist <<
endl;
318 const wordList& regions = surfs[surfI].regions();
319 forAll(regions, surfRegionI)
339 refCast<const triSurfaceMesh>(surfs[surfI]);
348 "hookedSurface_" + surfs.names()[surfI],
363 Info<<
nl <<
"Iteration = " << nIters++ <<
endl;
366 createBoundaryEdgeTrees(newSurfaces, bEdgeTrees, treeBoundaryEdges);
368 forAll(newSurfaces, surfI)
370 const triSurface& newSurf = newSurfaces[surfI];
377 forAll(newSurfaces, surfI)
386 forAll(bPointsTobEdges, bPointI)
393 const labelList& pEdges = pointEdges[pointI];
430 nearestHit = currentHit;
431 bPointsHitTree[bPointI] = treeI;
437 if (nearestHit.
hit())
455 forAll(bPointsTobEdges, bPointI)
461 const label hitSurfI = bPointsHitTree[bPointI];
462 const triSurface& hitSurf = newSurfaces[hitSurfI];
465 treeBoundaryEdges[hitSurfI][eHit.
index()];
472 if (eFaces.
size() != 1)
475 <<
"Edge is attached to " << eFaces.
size()
476 <<
" faces." <<
endl;
481 const label faceI = eFaces[0];
483 if (visitedFace[hitSurfI][faceI])
509 label newPointI = -1;
512 if (hitSurfI == surfI)
518 newPoints[hitSurfI].append(newPoints[surfI][pointI]);
519 newPointI = newPoints[hitSurfI].size() - 1;
532 visitedFace[hitSurfI][faceI] =
true;
534 forAll(newFacesFromSplit, newFaceI)
536 const labelledTri& fN = newFacesFromSplit[newFaceI];
540 newFaces[hitSurfI][faceI] = fN;
544 newFaces[hitSurfI].
append(fN);
551 Info<<
" Number of edges split = " << nChanged <<
endl;
553 forAll(newSurfaces, surfI)
562 "hookedSurface_" + surfs.names()[surfI],
577 }
while (nChanged > 0 && nIters <= maxIters);
581 forAll(newSurfaces, surfI)
585 Info<<
"Writing hooked surface " << newSurf.searchableSurface::name()
588 newSurf.searchableSurface::write();
static SLList< string > validArgs
A list of valid (mandatory) arguments.
vectorField pointField
pointField is a vectorField.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Simple random number generator.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
label index() const
Return index.
const labelListList & edgeFaces() const
Return edge-face addressing.
bool hit() const
Is there a hit.
A class for handling words, derived from string.
List< label > labelList
A List of labels.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
static void addNote(const string &)
Add extra notes for the usage information.
#define forAll(list, i)
Loop across all elements in list.
This class describes the interaction of a face and a point. It carries the info of a successful hit a...
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
const Point & rawPoint() const
Return point with no checking.
label nEdges() const
Return number of edges in patch.
Standard boundBox + extra functionality for use in octree.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
bool hit() const
Is there a hit.
Unit conversion functions.
const Type & shapes() const
Reference to shape.
IOoject and searching on triSurface.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
const word dictName("particleTrackDict")
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
const Point & rawPoint() const
Return point with no checking.
scalar distance() const
Return distance to hit.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Triangulated surface description with patch information.
treeBoundBox extend(Random &, const scalar s) const
Return slightly wider bounding box.
const Point & hitPoint() const
Return hit point.
const labelListList & pointEdges() const
Return point-edge addressing.
const edgeList & edges() const
Non-pointer based hierarchical recursive searching.
Holds data for octree to work on an edges subset.
int main(int argc, char *argv[])
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
const double e
Elementary charge.
Ostream & indent(Ostream &os)
Indent stream.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
const labelList & boundaryPoints() const
Return list of boundary points,.
const pointField & points() const
label nInternalEdges() const
Number of internal edges.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Container for searchableSurfaces.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
label size() const
Return the number of elements in the PtrList.
const labelList & edgeLabels() const
Triangle with additional region number.
const List< Face > & localFaces() const
Return patch faces addressing into local point list.
T argRead(const label index) const
Read a value from the argument at index.
void findNearest(const label nodeI, const linePointRef &ln, treeBoundBox &tightest, label &nearestShapeI, point &linePoint, point &nearestPoint, const FindNearestOp &fnOp) const
Find nearest point to line.
void size(const label)
Override size to be inconsistent with allocated storage.
vector point
Point is a vector.
static void noParallel()
Remove the parallel options.
Foam::argList args(argc, argv)
#define WarningInFunction
Report a warning using Foam::Warning.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
cachedRandom rndGen(label(0), -1)
IOobject dictIO(dictName, runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE)