116 void createBoundaryEdgeTrees
128 treeBoundaryEdges[surfI] =
154 treeBoundaryEdges[surfI]
166 class findNearestOpSubset
181 shapeMask_(shapeMask)
189 scalar& nearestDistSqr,
198 const label index = indices[i];
204 &&
findIndex(shapeMask_, edgeIndex) != -1
219 if (distSqr < nearestDistSqr)
221 nearestDistSqr = distSqr;
233 int main(
int argc,
char *argv[])
237 "hook surfaces to other surfaces by moving and retriangulating their"
238 "boundary edges to match other surface boundary edges"
251 const scalar matchTolerance(
max(1
e-6*dist, small));
252 const label maxIters = 100;
254 Info<<
"Hooking distance = " << dist <<
endl;
275 const wordList& regions = surfs[surfI].regions();
276 forAll(regions, surfRegionI)
296 refCast<const triSurfaceMesh>(surfs[surfI]);
305 "hookedSurface_" + surfs.names()[surfI],
320 Info<<
nl <<
"Iteration = " << nIters++ <<
endl;
323 createBoundaryEdgeTrees(newSurfaces, bEdgeTrees, treeBoundaryEdges);
325 forAll(newSurfaces, surfI)
327 const triSurface& newSurf = newSurfaces[surfI];
334 forAll(newSurfaces, surfI)
343 forAll(bPointsTobEdges, bPointi)
350 const labelList& pEdges = pointEdges[pointi];
362 bEdgeTree.findNearest
387 nearestHit = currentHit;
388 bPointsHitTree[bPointi] = treeI;
394 if (nearestHit.
hit())
403 forAll(bPointsTobEdges, bPointi)
409 const label hitSurfI = bPointsHitTree[bPointi];
410 const triSurface& hitSurf = newSurfaces[hitSurfI];
413 treeBoundaryEdges[hitSurfI][eHit.
index()];
420 if (eFaces.
size() != 1)
423 <<
"Edge is attached to " << eFaces.
size()
424 <<
" faces." <<
endl;
429 const label facei = eFaces[0];
431 if (visitedFace[hitSurfI][facei])
460 if (hitSurfI == surfI)
466 newPoints[hitSurfI].append(newPoints[surfI][pointi]);
467 newPointi = newPoints[hitSurfI].size() - 1;
480 visitedFace[hitSurfI][facei] =
true;
482 forAll(newFacesFromSplit, newFacei)
484 const labelledTri& fN = newFacesFromSplit[newFacei];
488 newFaces[hitSurfI][facei] = fN;
492 newFaces[hitSurfI].
append(fN);
499 Info<<
" Number of edges split = " << nChanged <<
endl;
501 forAll(newSurfaces, surfI)
510 "hookedSurface_" + surfs.names()[surfI],
525 }
while (nChanged > 0 && nIters <= maxIters);
529 forAll(newSurfaces, surfI)
533 Info<<
"Writing hooked surface " << newSurf.searchableSurface::name()
536 newSurf.searchableSurface::write();
#define forAll(list, i)
Loop across all elements in list.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
void size(const label)
Override size to be inconsistent with allocated storage.
scalar distance() const
Return distance to hit.
const Point & rawPoint() const
Return point with no checking.
bool hit() const
Is there a hit.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
const Point & hitPoint() const
Return hit point.
const Point & rawPoint() const
Return point with no checking.
label index() const
Return index.
bool hit() const
Is there a hit.
label nEdges() const
Return number of edges in patch.
const labelListList & pointEdges() const
Return point-edge addressing.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
label nInternalEdges() const
Number of internal edges.
const List< FaceType > & localFaces() const
Return patch faces addressing into local point list.
const labelList & boundaryPoints() const
Return list of boundary points,.
const labelListList & edgeFaces() const
Return edge-face addressing.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
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.
bool empty() const
Return true if the UList is empty (ie, size() is zero)
label size() const
Return the number of elements in the UPtrList.
static void addNote(const string &)
Add extra notes for the usage information.
static void noParallel()
Remove the parallel options.
static SLList< string > validArgs
A list of valid (mandatory) arguments.
T argRead(const label index) const
Read a value from the argument at index.
A list of keyword definitions, which are a keyword followed by any number of values (e....
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Non-pointer based hierarchical recursive searching.
const Type & shapes() const
Reference to shape.
Triangle with additional region number.
static const word & geometryDir()
Return the geometry directory name.
Container for searchableSurfaces.
Standard boundBox + extra functionality for use in octree.
treeBoundBox extend(const scalar s) const
Return asymmetrically extended bounding box, with guaranteed.
Holds data for octree to work on an edges subset.
const labelList & edgeLabels() const
const edgeList & edges() const
const pointField & points() const
A surface geometry formed of discrete facets, e.g. triangles and/or quadrilaterals,...
Triangulated surface description with patch information.
int main(int argc, char *argv[])
const fvPatchList & patches
#define WarningInFunction
Report a warning using Foam::Warning.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
IOdictionary systemDict(const word &dictName, const argList &args, const objectRegistry &ob, const word ®ionName=polyMesh::defaultRegion)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Ostream & endl(Ostream &os)
Add newline and flush stream.
vectorField pointField
pointField is a vectorField.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
Ostream & indent(Ostream &os)
Indent stream.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
randomGenerator rndGen(653213)
Foam::argList args(argc, argv)