54 const label newPointi,
152 void createBoundaryEdgeTrees
164 treeBoundaryEdges[surfI] =
180 bb.
min() -=
point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
181 bb.max() +=
point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
193 treeBoundaryEdges[surfI]
205 class findNearestOpSubset
220 shapeMask_(shapeMask)
228 scalar& nearestDistSqr,
237 const label index = indices[i];
243 &&
findIndex(shapeMask_, edgeIndex) != -1
249 const edge& e = shape.
edges()[edgeIndex];
258 if (distSqr < nearestDistSqr)
260 nearestDistSqr = distSqr;
272 int main(
int argc,
char *argv[])
276 "hook surfaces to other surfaces by moving and retriangulating their" 277 "boundary edges to match other surface boundary edges" 295 const scalar matchTolerance(
max(1e-6*dist, SMALL));
296 const label maxIters = 100;
298 Info<<
"Hooking distance = " << dist <<
endl;
319 const wordList& regions = surfs[surfI].regions();
320 forAll(regions, surfRegionI)
340 refCast<const triSurfaceMesh>(surfs[surfI]);
349 "hookedSurface_" + surfs.names()[surfI],
364 Info<<
nl <<
"Iteration = " << nIters++ <<
endl;
367 createBoundaryEdgeTrees(newSurfaces, bEdgeTrees, treeBoundaryEdges);
369 forAll(newSurfaces, surfI)
371 const triSurface& newSurf = newSurfaces[surfI];
378 forAll(newSurfaces, surfI)
387 forAll(bPointsTobEdges, bPointi)
394 const labelList& pEdges = pointEdges[pointi];
406 bEdgeTree.findNearest
431 nearestHit = currentHit;
432 bPointsHitTree[bPointi] = treeI;
438 if (nearestHit.
hit())
456 forAll(bPointsTobEdges, bPointi)
462 const label hitSurfI = bPointsHitTree[bPointi];
463 const triSurface& hitSurf = newSurfaces[hitSurfI];
466 treeBoundaryEdges[hitSurfI][eHit.
index()];
473 if (eFaces.
size() != 1)
476 <<
"Edge is attached to " << eFaces.
size()
477 <<
" faces." <<
endl;
482 const label facei = eFaces[0];
484 if (visitedFace[hitSurfI][facei])
510 label newPointi = -1;
513 if (hitSurfI == surfI)
519 newPoints[hitSurfI].
append(newPoints[surfI][pointi]);
520 newPointi = newPoints[hitSurfI].size() - 1;
533 visitedFace[hitSurfI][facei] =
true;
535 forAll(newFacesFromSplit, newFacei)
537 const labelledTri& fN = newFacesFromSplit[newFacei];
541 newFaces[hitSurfI][facei] = fN;
545 newFaces[hitSurfI].
append(fN);
552 Info<<
" Number of edges split = " << nChanged <<
endl;
554 forAll(newSurfaces, surfI)
563 "hookedSurface_" + surfs.names()[surfI],
578 }
while (nChanged > 0 && nIters <= maxIters);
582 forAll(newSurfaces, surfI)
586 Info<<
"Writing hooked surface " << newSurf.searchableSurface::name()
589 newSurf.searchableSurface::write();
const labelListList & pointEdges() const
Return point-edge addressing.
#define forAll(list, i)
Loop across all elements in list.
bool empty() const
Return true if the UList is empty (ie, size() is zero)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & indent(Ostream &os)
Indent stream.
const pointField & points() const
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Unit conversion functions.
void size(const label)
Override size to be inconsistent with allocated storage.
const labelList & boundaryPoints() const
Return list of boundary points,.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Holds data for octree to work on an edges subset.
label nInternalEdges() const
Number of internal edges.
static void noParallel()
Remove the parallel options.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
static SLList< string > validArgs
A list of valid (mandatory) arguments.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
IOoject and searching on triSurface.
const List< Face > & localFaces() const
Return patch faces addressing into local point list.
const Point & hitPoint() const
Return hit point.
label region() const
Return region label.
linePointRef line(const pointField &) const
Return edge line.
vectorField pointField
pointField is a vectorField.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A class for handling words, derived from string.
void append(const T &)
Append an element at the end of the list.
cachedRandom rndGen(label(0), -1)
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
bool hit() const
Is there a hit.
Container for searchableSurfaces.
const Type & shapes() const
Reference to shape.
const labelListList & edgeFaces() const
Return edge-face addressing.
bool hit() const
Is there a hit.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
List< label > labelList
A List of labels.
const word dictName("particleTrackDict")
Triangle with additional region number.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
Simple random number generator.
const Point & rawPoint() const
Return point with no checking.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
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.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
treeBoundBox extend(Random &, const scalar s) const
Return slightly wider bounding box.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
IOobject dictIO(dictName, runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE)
label size() const
Return the number of elements in the UPtrList.
const edgeList & edges() const
vector point
Point is a vector.
Non-pointer based hierarchical recursive searching.
#define WarningInFunction
Report a warning using Foam::Warning.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
label end() const
Return end vertex label.
T argRead(const label index) const
Read a value from the argument at index.
Standard boundBox + extra functionality for use in octree.
scalar distance() const
Return distance to hit.
const point & min() const
Minimum describing the bounding box.
static void addNote(const string &)
Add extra notes for the usage information.
Triangulated surface description with patch information.
Foam::argList args(argc, argv)
Ostream & incrIndent(Ostream &os)
Increment the indent level.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
label index() const
Return index.
const labelList & edgeLabels() const
label start() const
Return start vertex label.