Go to the documentation of this file.
41 const scalar concaveCos,
42 const label mergeSize,
52 labelHashSet boundaryCells(mesh_.nFaces()-mesh_.nInternalFaces());
56 label patchI = patchIDs[i];
64 boundaryCells.
insert(mesh_.faceOwner()[patch.
start()+i]);
86 if (mergeSets[setI].size() == mergeSize)
88 mergeSets[compactI++] = mergeSets[setI];
97 Info<<
"Merging " << nFaceSets <<
" sets of faces." <<
nl <<
endl;
112 mesh_.updateMesh(map);
115 if (map().hasMotionPoints())
117 mesh_.movePoints(map().preMotionPoints());
137 label oldMasterI = mergeSets[setI][0];
138 retestFaces.
insert(map().reverseFaceMap()[oldMasterI]);
140 updateMesh(map, growFaceCellFace(retestFaces));
255 const scalar concaveCos,
265 labelHashSet boundaryCells(mesh_.nFaces()-mesh_.nInternalFaces());
272 label patchI = patchIDs[i];
280 boundaryCells.
insert(mesh_.faceOwner()[patch.
start()+i]);
310 if (preserveFaces[set[j]] != -1)
321 allFaceSets[compactI] = set;
331 Info<<
"Merging " << nFaceSets <<
" sets of faces." <<
nl <<
endl;
337 faceSet allSets(mesh_,
"allFaceSets", allFaceSets.
size());
340 forAll(allFaceSets[setI], i)
342 allSets.
insert(allFaceSets[setI][i]);
345 Pout<<
"Writing all faces to be merged to set "
350 const_cast<Time&
>(mesh_.time())++;
372 mesh_.updateMesh(map);
375 if (map().hasMotionPoints())
377 mesh_.movePoints(map().preMotionPoints());
397 label oldMasterI = allFaceSets[setI][0];
398 retestFaces.
insert(map().reverseFaceMap()[oldMasterI]);
400 updateMesh(map, growFaceCellFace(retestFaces));
405 Pout<<
"Checking sync after initial merging " << nFaceSets
406 <<
" faces." <<
endl;
409 Pout<<
"Writing initial merged-faces mesh to time "
414 for (
label iteration = 0; iteration < 100; iteration++)
417 <<
"Undo iteration " << iteration <<
nl
418 <<
"----------------" <<
endl;
428 mesh_.nFaces()-mesh_.nInternalFaces()
472 Pout<<
"Writing all faces in error to faceSet "
487 if (masterFaceI != -1)
489 label masterCellII = mesh_.faceOwner()[masterFaceI];
491 const cell& cFaces = mesh_.cells()[masterCellII];
495 if (errorFaces.
found(cFaces[i]))
497 mastersToRestore.
append(masterFaceI);
503 mastersToRestore.
shrink();
507 mastersToRestore.size(),
511 Info<<
"Masters that need to be restored:"
516 faceSet restoreSet(mesh_,
"mastersToRestore", mastersToRestore);
518 Pout<<
"Writing all " << mastersToRestore.size()
519 <<
" masterfaces to be restored to set "
536 const_cast<Time&
>(mesh_.time())++;
561 mesh_.updateMesh(map);
564 if (map().hasMotionPoints())
566 mesh_.movePoints(map().preMotionPoints());
593 retestFaces.
insert(iter.key());
600 growFaceCellFace(retestFaces),
609 Pout<<
"Checking sync after restoring " << retestFaces.
size()
610 <<
" faces." <<
endl;
613 Pout<<
"Writing merged-faces mesh to time "
623 Info<<
"No faces merged ..." <<
endl;
646 mesh_.updateMesh(map);
649 if (map().hasMotionPoints())
651 mesh_.movePoints(map().preMotionPoints());
672 retestFaces.
insert(faceI);
675 updateMesh(map, growFaceCellFace(retestFaces));
680 Pout<<
"Checking sync after removing points." <<
endl;
719 mesh_.updateMesh(map);
722 if (map().hasMotionPoints())
724 mesh_.movePoints(map().preMotionPoints());
740 label faceI = map().reverseFaceMap()[facesToRestore[i]];
743 retestFaces.
insert(faceI);
746 updateMesh(map, growFaceCellFace(retestFaces));
751 Pout<<
"Checking sync after restoring points on "
752 << facesToRestore.
size() <<
" faces." <<
endl;
769 boolList selected(mesh_.nFaces(),
false);
773 label faceI = candidateFaces[i];
775 if (set.
found(faceI))
777 selected[faceI] =
true;
780 syncTools::syncFaceList
789 return selectedFaces;
799 boolList selected(mesh_.nFaces(),
false);
803 label faceI = iter.key();
805 label own = mesh_.faceOwner()[faceI];
807 const cell& ownFaces = mesh_.cells()[own];
808 forAll(ownFaces, ownFaceI)
810 selected[ownFaces[ownFaceI]] =
true;
813 if (mesh_.isInternalFace(faceI))
815 label nbr = mesh_.faceNeighbour()[faceI];
817 const cell& nbrFaces = mesh_.cells()[nbr];
818 forAll(nbrFaces, nbrFaceI)
820 selected[nbrFaces[nbrFaceI]] =
true;
824 syncTools::syncFaceList
843 <<
"Merging all points on surface that" <<
nl
844 <<
"- are used by only two boundary faces and" <<
nl
845 <<
"- make an angle with a cosine of more than " << minCos
857 Info<<
"Removing " << nRemove
858 <<
" straight edge points ..." <<
nl <<
endl;
863 doRemovePoints(pointRemover, pointCanBeDeleted);
866 for (
label iteration = 0; iteration < 100; iteration++)
869 <<
"Undo iteration " << iteration <<
nl
870 <<
"----------------" <<
endl;
880 mesh_.nFaces()-mesh_.nInternalFaces()
918 Pout<<
"**Writing all faces in error to faceSet "
934 Info<<
"Detected " <<
n
935 <<
" error faces on boundaries that have been merged."
936 <<
" These will be restored to their original faces." <<
nl
945 <<
" error faces in mesh."
946 <<
" Restoring neighbours of faces in error." <<
nl
957 doRestorePoints(pointRemover, expandedErrorFaces);
963 doRestorePoints(pointRemover, masterErrorFaces);
968 const_cast<Time&
>(mesh_.time())++;
969 Pout<<
"Writing merged-edges mesh to time "
976 Info<<
"No straight edges simplified and no points removed ..." <<
endl;
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Combines boundary faces into single face. The faces get the patch of the first face ('the master')
bool checkMesh(const polyMeshGen &mesh, const bool report)
Check mesh for correctness. Returns false for no error.
List< label > labelList
A List of labels.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
const labelList & savedPointLabels() const
If undoable: set of original point labels of stored points.
#define forAll(list, i)
Loop across all elements in list.
Removes selected points from mesh and updates faces using these points.
autoPtr< mapPolyMesh > changeMesh(polyMesh &mesh, const bool inflate, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Inplace changes mesh without change of patches.
labelList collectFaces(const labelList &candidateFaces, const labelHashSet &set) const
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
Direct mesh changes based on v1.3 polyTopoChange syntax.
void getUnrefimentSet(const labelList &undoFaces, labelList &localFaces, labelList &localPoints) const
Given set of faces to restore calculates a consistent set of.
labelListList getMergeSets(const scalar featureCos, const scalar minConcaveCos, const labelHashSet &boundaryCells) const
Extract lists of all (non-coupled) boundary faces on selected.
virtual bool write() const
Write using setting from DB.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const fileName & instance() const
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
fileName objectPath() const
Return complete path + object name.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A patch is a list of labels that address the faces in the global face list.
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
void setUnrefinement(const labelList &masterFaces, polyTopoChange &meshMod, Map< label > &restoredPoints, Map< label > &restoredFaces, Map< label > &restoredCells)
Play commands into polyTopoChange to reinsert original faces.
autoPtr< mapPolyMesh > doRemovePoints(removePoints &pointRemover, const boolList &pointCanBeDeleted)
void inplaceMapKey(const labelUList &oldToNew, Container &)
Recreate with mapped keys. Do not map elements with negative key.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
const labelList & savedFaceLabels() const
If undoable: affected face labels. Already restored faces.
label mergeEdgesUndo(const scalar minCos, const dictionary &motionDict)
Merge edges, maintain mesh quality. Return global number.
void setUnrefinement(const labelList &localFaces, const labelList &localPoints, polyTopoChange &)
Restore selected faces and vertices.
A list of keyword definitions, which are a keyword followed by any number of values (e....
label size() const
Return number of elements in table.
bool found(const Key &) const
Return true if hashedEntry is found in table.
label start() const
Return start label of this patch in the polyMesh face list.
const labelList & masterFace() const
If undoable: masterface for every set.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
label mergePatchFaces(const scalar minCos, const scalar concaveCos, const label mergeSize, const labelList &patchIDs)
Merge coplanar faces if sets are of size mergeSize.
void setSize(const label)
Reset size of List.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
prefixOSstream Pout(cout, "Pout")
label mergePatchFacesUndo(const scalar minCos, const scalar concaveCos, const labelList &patchIDs, const dictionary &motionDict, const labelList &preserveFaces)
Merge coplanar faces. preserveFaces is != -1 for faces.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
bool insert(const Key &key)
Insert a new entry.
void setRefinement(const labelListList &, polyTopoChange &)
Play commands into polyTopoChange to combine faces. Gets.
autoPtr< mapPolyMesh > doRestorePoints(removePoints &pointRemover, const labelList &facesToRestore)
void size(const label)
Override size to be inconsistent with allocated storage.
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
void setRefinement(const boolList &, polyTopoChange &)
Play commands into polyTopoChange to remove points. Gets.
labelList findIndices(const ListType &, typename ListType::const_reference, const label start=0)
Find all occurences of given element. Linear search.
A cell is defined as a list of faces with extra functionality.
label countPointUsage(const scalar minCos, boolList &pointCanBeDeleted) const
Mark in pointCanBeDeleted the points that can be deleted.
labelList growFaceCellFace(const labelHashSet &set) const