Go to the documentation of this file.
69 label fp0 =
f.find(
e[0]);
70 label fp1 =
f.fcIndex(fp0);
71 label fp2 =
f.fcIndex(fp1);
156 void createBoundaryEdgeTrees
168 treeBoundaryEdges[surfI] =
197 treeBoundaryEdges[surfI]
209 class findNearestOpSubset
224 shapeMask_(shapeMask)
232 scalar& nearestDistSqr,
239 for (
const label index : indices)
241 const label edgeIndex = shape.
edgeLabels()[index];
243 if (shapeMask_.found(edgeIndex))
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"
292 const scalar dist(
args.
get<scalar>(1));
293 const scalar matchTolerance(
max(1
e-6*dist, SMALL));
296 Info<<
"Hooking distance = " << dist <<
endl;
317 const wordList& regions = surfs[surfI].regions();
318 forAll(regions, surfRegionI)
338 refCast<const triSurfaceMesh>(surfs[surfI]);
347 "hookedSurface_" + surfs.names()[surfI],
362 Info<<
nl <<
"Iteration = " << nIters++ <<
endl;
365 createBoundaryEdgeTrees(newSurfaces, bEdgeTrees, treeBoundaryEdges);
367 forAll(newSurfaces, surfI)
369 const triSurface& newSurf = newSurfaces[surfI];
373 visitedFace[surfI] =
bitSet(newSurf.size(),
false);
376 forAll(newSurfaces, surfI)
385 forAll(bPointsTobEdges, bPointi)
392 const labelList& pEdges = pointEdges[pointi];
404 bEdgeTree.findNearest
429 nearestHit = currentHit;
430 bPointsHitTree[bPointi] = treeI;
436 if (nearestHit.
hit())
454 forAll(bPointsTobEdges, bPointi)
460 const label hitSurfI = bPointsHitTree[bPointi];
461 const triSurface& hitSurf = newSurfaces[hitSurfI];
464 treeBoundaryEdges[hitSurfI][eHit.
index()];
471 if (eFaces.size() != 1)
474 <<
"Edge is attached to " << eFaces.size()
475 <<
" faces." <<
endl;
480 const label facei = eFaces[0];
482 if (visitedFace[hitSurfI][facei])
511 if (hitSurfI == surfI)
517 newPoints[hitSurfI].append(newPoints[surfI][pointi]);
518 newPointi = newPoints[hitSurfI].size() - 1;
531 visitedFace[hitSurfI].set(facei);
533 forAll(newFacesFromSplit, newFacei)
535 const labelledTri& fN = newFacesFromSplit[newFacei];
539 newFaces[hitSurfI][facei] = fN;
543 newFaces[hitSurfI].
append(fN);
550 Info<<
" Number of edges split = " << nChanged <<
endl;
552 forAll(newSurfaces, surfI)
561 "hookedSurface_" + surfs.names()[surfI],
576 }
while (nChanged > 0 && nIters <=
maxIters);
580 forAll(newSurfaces, surfI)
584 Info<<
"Writing hooked surface " << newSurf.searchableSurface::name()
587 newSurf.searchableSurface::write();
vectorField pointField
pointField is a vectorField.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Defines the attributes of an object for which implicit objectRegistry management is supported,...
treeBoundBox extend(Random &rndGen, const scalar s) const
const labelListList & edgeFaces() const
A class for handling words, derived from Foam::string.
static Form uniform(const Cmpt &s)
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
const edgeList & edges() const
Describes the interaction of a face and a point. It carries the info of a successful hit and (if succ...
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
static constexpr int maxIters
Standard boundBox with extra functionality for use in octree.
const word dictName("faMeshDefinition")
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
static void addNote(const string ¬e)
scalar distance() const noexcept
Unit conversion functions.
const Type & shapes() const
IOoject and searching on triSurface.
Ostream & endl(Ostream &os)
const point_type & hitPoint() const
Ostream & incrIndent(Ostream &os)
T get(const label index) const
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
static void addArgument(const string &argName, const string &usage="")
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
bool hit() const noexcept
Triangulated surface description with patch information.
DynamicList< T, SizeMin > & append(const T &val)
const point_type & rawPoint() const noexcept
const labelListList & pointEdges() const
const edgeList & edges() const
Non-pointer based hierarchical recursive searching.
Holds data for octree to work on an edges subset.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
label max(const labelHashSet &set, label maxValue=labelMin)
const point_type & rawPoint() const noexcept
const List< face_type > & localFaces() const
Ostream & decrIndent(Ostream &os)
Ostream & indent(Ostream &os)
const Field< point_type > & localPoints() const
const labelList & boundaryPoints() const
const pointField & points() const
label nInternalEdges() const
const word & name() const noexcept
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...
label index() const noexcept
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
const dimensionedScalar e
labelList identity(const label len, label start=0)
const polyBoundaryMesh & patches
const labelList & edgeLabels() const
A triFace with additional (region) index.
const word & constant() const
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Foam::argList args(argc, argv)
bool hit() const noexcept
#define WarningInFunction
Minimal example by using system/controlDict.functions: