Go to the documentation of this file.
74 scalar minDistSqr = GREAT;
77 scalar almostMinDistSqr = GREAT;
78 label almostMinI = -1;
82 label pointI = meshPoints[i];
86 if (distSqr < minDistSqr)
88 almostMinDistSqr = minDistSqr;
94 else if (distSqr < almostMinDistSqr)
96 almostMinDistSqr = distSqr;
103 Info<<
"Found to point " << nearPoint <<
nl
104 <<
" nearest point : " << minI
107 <<
" next nearest point : " << almostMinI
108 <<
" distance " <<
Foam::sqrt(almostMinDistSqr)
111 if (almostMinDistSqr < 4*minDistSqr)
113 Info<<
"Next nearest too close to nearest. Aborting" <<
endl;
129 const point& nearPoint
138 scalar minDist = GREAT;
141 scalar almostMinDist = GREAT;
142 label almostMinI = -1;
146 const edge&
e = edges[edgeI];
148 pointHit pHit(
e.line(localPoints).nearestDist(nearPoint));
152 if (pHit.distance() < minDist)
154 almostMinDist = minDist;
157 minDist = pHit.distance();
165 else if (pHit.distance() < almostMinDist)
167 almostMinDist = pHit.distance();
180 Info<<
"Did not find edge close to point " << nearPoint <<
endl;
187 Info<<
"Found to point " << nearPoint <<
nl
188 <<
" nearest edge : " << minI
189 <<
" distance " << minDist <<
" endpoints "
191 <<
" next nearest edge : " << almostMinI
192 <<
" distance " << almostMinDist <<
" endpoints "
196 if (almostMinDist < 2*minDist)
198 Info<<
"Next nearest too close to nearest. Aborting" <<
endl;
214 const point& nearPoint
220 scalar minDist = GREAT;
223 scalar almostMinDist = GREAT;
224 label almostMinI = -1;
232 if (pHit.distance() < minDist)
234 almostMinDist = minDist;
237 minDist = pHit.distance();
240 else if (pHit.distance() < almostMinDist)
242 almostMinDist = pHit.distance();
250 Info<<
"Did not find face close to point " << nearPoint <<
endl;
257 Info<<
"Found to point " << nearPoint <<
nl
258 <<
" nearest face : " << minI
259 <<
" distance " << minDist
261 <<
" next nearest face : " << almostMinI
262 <<
" distance " << almostMinDist
266 if (almostMinDist < 2*minDist)
268 Info<<
"Next nearest too close to nearest. Aborting" <<
endl;
291 scalar minDistSqr = GREAT;
295 label pointI = cPoints[i];
299 if (distSqr < minDistSqr)
301 minDistSqr = distSqr;
307 Info<<
"Found to point " << nearPoint <<
nl
308 <<
" nearest cell : " << cellI
311 <<
" nearest mesh point : " << minI
316 if (minDistSqr < 4*distToCcSqr)
318 Info<<
"Mesh point too close to nearest cell centre. Aborting"
331 int main(
int argc,
char *argv[])
337 runTime.functionObjects().off();
343 Info<<
"Reading modifyMeshDict\n" <<
endl;
368 || edgesToSplit.size()
369 || facesToTriangulate.size()
378 bool cellsToSplit = cellsToPyramidise.size();
384 <<
" Boundary cutting module:" <<
nl
385 <<
" points to move :" << pointsToMove.size() <<
nl
386 <<
" edges to split :" << edgesToSplit.size() <<
nl
387 <<
" faces to triangulate:" << facesToTriangulate.size() <<
nl
388 <<
" Cell splitting module:" <<
nl
389 <<
" cells to split :" << cellsToPyramidise.size() <<
nl
390 <<
" Edge collapsing module:" <<
nl
391 <<
" edges to collapse :" << edgesToCollapse.size() <<
nl
398 || (cutBoundary && cellsToSplit)
403 <<
"Used more than one mesh modifying module "
404 <<
"(boundary cutting, cell splitting, edge collapsing)" <<
nl
423 bool validInputs =
true;
426 Info<<
nl <<
"Looking up points to move ..." <<
nl <<
endl;
432 label pointI = findPoint(allBoundary, pts.
first());
434 if (pointI == -1 || !pointToPos.insert(pointI, pts.
second()))
436 Info<<
"Could not insert mesh point " << pointI
437 <<
" for input point " << pts.
first() <<
nl
438 <<
"Perhaps the point is already marked for moving?" <<
endl;
444 Info<<
nl <<
"Looking up edges to split ..." <<
nl <<
endl;
458 Info<<
"Could not insert mesh edge " << edgeI
459 <<
" for input point " << pts.
first() <<
nl
460 <<
"Perhaps the edge is already marked for cutting?" <<
endl;
467 Info<<
nl <<
"Looking up faces to triangulate ..." <<
nl <<
endl;
468 Map<point> faceToDecompose(facesToTriangulate.size());
469 forAll(facesToTriangulate, i)
475 if (faceI == -1 || !faceToDecompose.insert(faceI, pts.
second()))
477 Info<<
"Could not insert mesh face " << faceI
478 <<
" for input point " << pts.
first() <<
nl
479 <<
"Perhaps the face is already marked for splitting?" <<
endl;
487 Info<<
nl <<
"Looking up cells to convert to pyramids around"
488 <<
" cell centre ..." <<
nl <<
endl;
489 Map<point> cellToPyrCentre(cellsToPyramidise.size());
490 forAll(cellsToPyramidise, i)
496 if (cellI == -1 || !cellToPyrCentre.insert(cellI, pts.
second()))
498 Info<<
"Could not insert mesh cell " << cellI
499 <<
" for input point " << pts.
first() <<
nl
500 <<
"Perhaps the cell is already marked for splitting?" <<
endl;
507 Info<<
nl <<
"Looking up edges to collapse ..." <<
nl <<
endl;
509 forAll(edgesToCollapse, i)
515 if (edgeI == -1 || !edgeToPos.insert(edgeI, pts.
second()))
517 Info<<
"Could not insert mesh edge " << edgeI
518 <<
" for input point " << pts.
first() <<
nl
519 <<
"Perhaps the edge is already marked for collaping?" <<
endl;
529 Info<<
nl <<
"There was a problem in one of the inputs in the"
530 <<
" dictionary. Not modifying mesh." <<
endl;
532 else if (cellToPyrCentre.size())
534 Info<<
nl <<
"All input cells located. Modifying mesh." <<
endl;
543 cutter.setRefinement(cellToPyrCentre, meshMod);
548 if (morphMap().hasMotionPoints())
553 cutter.updateMesh(morphMap());
565 Info<<
"Writing modified mesh to time " << runTime.timeName() <<
endl;
568 else if (edgeToPos.size())
570 Info<<
nl <<
"All input edges located. Modifying mesh." <<
endl;
586 label edgeI = iter.key();
587 const edge&
e = edges[edgeI];
590 collapsePointToLocation.set(
e[1],
points[
e[0]]);
592 newPoints[
e[0]] = iter();
602 cutter.consistentCollapse
606 collapsePointToLocation,
615 cutter.setRefinement(allPointInfo, meshMod);
620 if (morphMap().hasMotionPoints())
639 Info<<
"Writing modified mesh to time " << runTime.timeName() <<
endl;
644 Info<<
nl <<
"All input points located. Modifying mesh." <<
endl;
665 if (morphMap().hasMotionPoints())
670 cutter.updateMesh(morphMap());
682 Info<<
"Writing modified mesh to time " << runTime.timeName() <<
endl;
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
virtual const pointField & points() const
Return raw points.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Calculates points shared by more than two processor patches or cyclic patches.
const Field< PointType > & points() const
Return reference to global points.
A class for handling words, derived from string.
Does modifications to boundary faces.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
#define forAll(list, i)
Loop across all elements in list.
const labelListList & cellPoints() const
This class describes the interaction of a face and a point. It carries the info of a successful hit a...
const fileName & name() const
Return the dictionary name.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
A List obtained as a section of another List.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Direct mesh changes based on v1.3 polyTopoChange syntax.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
const Type & first() const
Return first.
A HashTable to objects of type <T> with a label key.
virtual tmp< scalarField > movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Does polyTopoChanges to remove edges. Can remove faces due to edge collapse but can not remove cells ...
virtual bool write() const
Write mesh using IO settings from time.
const fileName & pointsInstance() const
Return the current instance directory for points.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
Does pyramidal decomposition of selected cells. So all faces will become base of pyramid with as top ...
const Type & second() const
Return second.
int main(int argc, char *argv[])
label nInternalFaces() const
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
const double e
Elementary charge.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void setInstance(const fileName &)
Set the instance for mesh files.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
label findCell(const point &p, const cellDecomposition=CELL_TETS) const
Find cell enclosing this location and return index.
const vectorField & cellCentres() const
virtual const faceList & faces() const
Return raw faces.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
An ordered pair of two objects of type <T> with first() and second() elements.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
dimensionedScalar sqrt(const dimensionedScalar &ds)
const vectorField & faceCentres() const
bool optionFound(const word &opt) const
Return true if the named option is found.
label collapseEdge(triSurface &surf, const scalar minLen)
Keep collapsing all edges < minLen.
const labelList & meshPoints() const
Return labelList of mesh points in patch.
Foam::argList args(argc, argv)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
A list of faces which address into the list of points.
Cell-face mesh analysis engine.