228 const scalar concaveCos,
256 if (preserveFaces[set[j]] != -1)
267 allFaceSets[compactI] = set;
277 Info<<
"Merging " << nFaceSets <<
" sets of faces." <<
nl <<
endl;
283 faceSet allSets(mesh_,
"allFaceSets", allFaceSets.
size());
286 forAll(allFaceSets[seti], i)
288 allSets.
insert(allFaceSets[seti][i]);
291 Pout<<
"Writing all faces to be merged to set "
332 const label oldMasterI = allFaceSets[seti][0];
333 retestFaces.
insert(map().reverseFaceMap()[oldMasterI]);
340 Pout<<
"Checking sync after initial merging " << nFaceSets
341 <<
" faces." <<
endl;
344 Pout<<
"Writing initial merged-faces mesh to time "
349 for (
label iteration = 0; iteration < 100; iteration++)
352 <<
"Undo iteration " << iteration <<
nl
353 <<
"----------------" <<
endl;
407 Pout<<
"Writing all faces in error to faceSet "
422 if (masterFacei != -1)
426 const cell& cFaces = mesh_.
cells()[masterCellII];
430 if (errorFaces.
found(cFaces[i]))
432 mastersToRestore.
append(masterFacei);
438 mastersToRestore.
shrink();
442 mastersToRestore.
size(),
446 Info<<
"Masters that need to be restored:"
451 faceSet restoreSet(mesh_,
"mastersToRestore", mastersToRestore);
453 Pout<<
"Writing all " << mastersToRestore.
size()
454 <<
" masterfaces to be restored to set "
516 retestFaces.
insert(iter.key());
532 Pout<<
"Checking sync after restoring " << retestFaces.
size()
533 <<
" faces." <<
endl;
536 Pout<<
"Writing merged-faces mesh to time "
546 Info<<
"No faces merged ..." <<
endl;
569 mesh_.topoChange(map);
572 mesh_.setInstance(
name());
584 retestFaces.
insert(facei);
587 topoChange(map, growFaceCellFace(retestFaces));
592 Pout<<
"Checking sync after removing points." <<
endl;
630 mesh_.topoChange(map);
633 mesh_.setInstance(
name());
640 const label facei = map().reverseFaceMap()[facesToRestore[i]];
643 retestFaces.
insert(facei);
646 topoChange(map, growFaceCellFace(retestFaces));
651 Pout<<
"Checking sync after restoring points on "
652 << facesToRestore.
size() <<
" faces." <<
endl;
669 boolList selected(mesh_.nFaces(),
false);
673 const label facei = candidateFaces[i];
675 if (set.
found(facei))
677 selected[facei] =
true;
689 return selectedFaces;
699 boolList selected(mesh_.nFaces(),
false);
703 const label facei = iter.key();
704 const label own = mesh_.faceOwner()[facei];
706 const cell& ownFaces = mesh_.cells()[own];
707 forAll(ownFaces, ownFacei)
709 selected[ownFaces[ownFacei]] =
true;
712 if (mesh_.isInternalFace(facei))
714 const label nbr = mesh_.faceNeighbour()[facei];
716 const cell& nbrFaces = mesh_.cells()[nbr];
717 forAll(nbrFaces, nbrFacei)
719 selected[nbrFaces[nbrFacei]] =
true;
742 <<
"Merging all points on surface that" <<
nl
743 <<
"- are used by only two boundary faces and" <<
nl
744 <<
"- make an angle with a cosine of more than " << minCos
756 Info<<
"Removing " << nRemove
757 <<
" straight edge points ..." <<
nl <<
endl;
762 doRemovePoints(pointRemover, pointCanBeDeleted);
765 for (
label iteration = 0; iteration < 100; iteration++)
768 <<
"Undo iteration " << iteration <<
nl
769 <<
"----------------" <<
endl;
779 mesh_.nFaces()-mesh_.nInternalFaces()
817 Pout<<
"**Writing all faces in error to faceSet "
833 masterErrorFaces.
size(),
837 Info<<
"Detected " <<
n
838 <<
" error faces on boundaries that have been merged."
839 <<
" These will be restored to their original faces." <<
nl
848 <<
" error faces in mesh."
849 <<
" Restoring neighbours of faces in error." <<
nl
860 doRestorePoints(pointRemover, expandedErrorFaces);
866 doRestorePoints(pointRemover, masterErrorFaces);
871 const_cast<Time&
>(mesh_.time())++;
872 Pout<<
"Writing merged-edges mesh to time "
879 Info<<
"No straight edges simplified and no points removed ..." <<
endl;
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
bool insert(const Key &key)
Insert a new entry.
label size() const
Return number of elements in table.
bool found(const Key &) const
Return true if hashedEntry is found in table.
fileName & instance() const
Return the instance directory, constant, system, <time> etc.
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
A cell is defined as a list of faces with extra functionality.
Combines boundary faces into single face. The faces get the patch of the first face ('the master')
const labelList & savedPointLabels() const
If undoable: set of original point labels of stored points.
labelListList getMergeSets(const scalar featureCos, const scalar minConcaveCos, const labelHashSet &patchIDs, const labelHashSet &boundaryCells) const
Extract lists of all (non-coupled) boundary faces on selected.
void topoChange(const polyTopoChangeMap &)
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.
void setRefinement(const labelListList &, polyTopoChange &)
Play commands into polyTopoChange to combine faces. Gets.
const labelList & masterFace() const
If undoable: masterface for every set.
A list of keyword definitions, which are a keyword followed by any number of values (e....
const Time & time() const
Return the top-level database.
virtual void topoChange(const polyTopoChangeMap &map)
Update mesh corresponding to the given map.
autoPtr< polyTopoChangeMap > doRestorePoints(removePoints &pointRemover, const labelList &facesToRestore)
label mergeEdgesUndo(const scalar minCos, const dictionary &motionDict)
Merge edges, maintain mesh quality. Return global number.
void checkData()
Debugging: check that all faces still obey start()>end()
void topoChange(const polyTopoChangeMap &, const labelList &changedFaces)
Update for external change to mesh. changedFaces are in new mesh.
word name() const
Replacement for Time::name() : return oldInstance (if.
label mergePatchFacesUndo(const scalar minCos, const scalar concaveCos, const labelHashSet &patchIDs, const dictionary &motionDict, const labelList &preserveFaces)
Merge coplanar faces. preserveFaces is != -1 for faces.
autoPtr< polyTopoChangeMap > doRemovePoints(removePoints &pointRemover, const boolList &pointCanBeDeleted)
labelList collectFaces(const labelList &candidateFaces, const labelHashSet &set) const
void storeData(const labelList &pointsToStore, const labelList &facesToStore, const labelList &cellsToStore)
Signal points/face/cells for which to store data.
bool write() const
Write mesh and all data.
labelList growFaceCellFace(const labelHashSet &set) const
virtual const labelList & faceOwner() const
Return face owner.
void setInstance(const fileName &)
Set the instance for mesh files.
Direct mesh changes based on v1.3 polyTopoChange syntax.
autoPtr< polyTopoChangeMap > changeMesh(polyMesh &mesh, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Inplace changes mesh without change of patches.
label nInternalFaces() const
const cellList & cells() const
fileName objectPath() const
Return complete path + object name.
virtual bool write(const bool write=true) const
Write using setting from DB.
Removes selected points from mesh and updates faces using these points.
label countPointUsage(const scalar minCos, boolList &pointCanBeDeleted) const
Mark in pointCanBeDeleted the points that can be deleted.
void setUnrefinement(const labelList &localFaces, const labelList &localPoints, polyTopoChange &)
Restore selected faces and vertices.
void topoChange(const polyTopoChangeMap &)
Force recalculation of locally stored data on topological change.
void setRefinement(const boolList &, polyTopoChange &)
Play commands into polyTopoChange to remove points. Gets.
const labelList & savedFaceLabels() const
If undoable: affected face labels. Already restored faces.
void getUnrefimentSet(const labelList &undoFaces, labelList &localFaces, labelList &localPoints) const
Given set of faces to restore calculates a consistent set of.
Functions for checking mesh topology and geometry.
bool checkMesh(const bool report, const polyMesh &mesh, const dictionary &dict, const labelList &checkFaces, const List< labelPair > &baffles, labelHashSet &wrongFaces)
Check (subset of mesh including baffles) with mesh settings in dict.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
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.
word name(const bool)
Return a word representation of a bool.
labelList findIndices(const ListType &, typename ListType::const_reference, const label start=0)
Find all occurrences of given element. Linear search.
void inplaceMapKey(const labelUList &oldToNew, Container &)
Recreate with mapped keys. Do not map elements with negative key.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
prefixOSstream Pout(cout, "Pout")