112 void createBoundaryEdgeTrees
124 treeBoundaryEdges[surfI] =
153 treeBoundaryEdges[surfI]
165 class findNearestOpSubset
180 shapeMask_(shapeMask)
188 scalar& nearestDistSqr,
197 const label index = indices[i];
203 &&
findIndex(shapeMask_, edgeIndex) != -1
218 if (distSqr < nearestDistSqr)
220 nearestDistSqr = distSqr;
232 int main(
int argc,
char *argv[])
236 "Hook surfaces to other surfaces by moving and re-triangulating \n"
237 "their boundary edges to match other surface boundary edges"
256 << surfFileNames[surfi].c_str() <<
':' <<
endl;
261 if (surfPatchi)
Info <<
' ';
262 Info<< surfs[surfi].patches()[surfPatchi].name();
268 const scalar matchTolerance(
max(1
e-6*dist, small));
269 Info<<
"Hooking distance = " << dist <<
endl;
271 const label maxIters = 100;
283 newSurfs.set(surfi,
new triSurface(surfs[surfi]));
291 Info<<
nl <<
"Iteration = " << nIters++ <<
endl;
294 createBoundaryEdgeTrees(newSurfs, bEdgeTrees, treeBoundaryEdges);
314 forAll(bPointsTobEdges, bPointi)
321 const labelList& pEdges = pointEdges[pointi];
333 bEdgeTree.findNearest
358 nearestHit = currentHit;
359 bPointsHitTree[bPointi] = treeI;
365 if (nearestHit.
hit())
374 forAll(bPointsTobEdges, bPointi)
380 const label hitSurfI = bPointsHitTree[bPointi];
381 const triSurface& hitSurf = newSurfs[hitSurfI];
384 treeBoundaryEdges[hitSurfI][eHit.
index()];
391 if (eFaces.
size() != 1)
394 <<
"Edge is attached to " << eFaces.
size()
395 <<
" faces." <<
endl;
400 const label facei = eFaces[0];
402 if (visitedFace[hitSurfI][facei])
431 if (hitSurfI == surfI)
437 newPoints[hitSurfI].append(newPoints[surfI][pointi]);
438 newPointi = newPoints[hitSurfI].size() - 1;
451 visitedFace[hitSurfI][facei] =
true;
453 forAll(newFacesFromSplit, newFacei)
455 const labelledTri& fN = newFacesFromSplit[newFacei];
459 newFaces[hitSurfI][facei] = fN;
463 newFaces[hitSurfI].
append(fN);
470 Info<<
" Number of edges split = " << nChanged <<
endl;
486 }
while (nChanged > 0 && nIters <= maxIters);
495 + surfFileNames[surfi].
ext();
497 Info<<
"Writing hooked surface " << newSurfFileName <<
endl;
499 newSurfs[surfi].
write(newSurfFileName);
#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.
void size(const label)
Override size to be inconsistent with allocated storage.
virtual Ostream & write(const token &)
Write token.
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...
bool set(const label) const
Is element set.
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.
Extract command arguments and options from the supplied argc and argv parameters.
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.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A class for handling file names.
fileName lessExt() const
Return file name without extension (part before last .)
word ext() const
Return file name extension (part after last .)
Non-pointer based hierarchical recursive searching.
const Type & shapes() const
Reference to shape.
Triangle with additional region number.
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
label size() const
Return size.
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.
Ostream & endl(Ostream &os)
Add newline and flush stream.
vectorField pointField
pointField is a vectorField.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
tmp< DimensionedField< typename outerProduct< Type, Type >::type, GeoMesh, Field >> sqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
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.
tmp< DimensionedField< scalar, GeoMesh, Field > > magSqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
Ostream & indent(Ostream &os)
Indent stream.
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
randomGenerator rndGen(653213)
Foam::argList args(argc, argv)