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 "
324 const label oldMasterI = allFaceSets[seti][0];
325 retestFaces.
insert(map().reverseFaceMap()[oldMasterI]);
332 Pout<<
"Checking sync after initial merging " << nFaceSets
333 <<
" faces." <<
endl;
336 Pout<<
"Writing initial merged-faces mesh to time "
341 for (
label iteration = 0; iteration < 100; iteration++)
344 <<
"Undo iteration " << iteration <<
nl
345 <<
"----------------" <<
endl;
399 Pout<<
"Writing all faces in error to faceSet "
414 if (masterFacei != -1)
418 const cell& cFaces = mesh_.
cells()[masterCellII];
422 if (errorFaces.
found(cFaces[i]))
424 mastersToRestore.
append(masterFacei);
430 mastersToRestore.
shrink();
434 mastersToRestore.
size(),
438 Info<<
"Masters that need to be restored:"
443 faceSet restoreSet(mesh_,
"mastersToRestore", mastersToRestore);
445 Pout<<
"Writing all " << mastersToRestore.
size()
446 <<
" masterfaces to be restored to set "
498 retestFaces.
insert(iter.key());
506 Pout<<
"Checking sync after restoring " << retestFaces.
size()
507 <<
" faces." <<
endl;
510 Pout<<
"Writing merged-faces mesh to time "
520 Info<<
"No faces merged ..." <<
endl;
543 mesh_.topoChange(map);
546 mesh_.setInstance(
name());
558 retestFaces.
insert(facei);
561 topoChange(map, growFaceCellFace(retestFaces));
566 Pout<<
"Checking sync after removing points." <<
endl;
604 mesh_.topoChange(map);
607 mesh_.setInstance(
name());
614 const label facei = map().reverseFaceMap()[facesToRestore[i]];
617 retestFaces.
insert(facei);
620 topoChange(map, growFaceCellFace(retestFaces));
625 Pout<<
"Checking sync after restoring points on "
626 << facesToRestore.
size() <<
" faces." <<
endl;
643 boolList selected(mesh_.nFaces(),
false);
647 const label facei = candidateFaces[i];
649 if (set.
found(facei))
651 selected[facei] =
true;
663 return selectedFaces;
673 boolList selected(mesh_.nFaces(),
false);
677 const label facei = iter.key();
678 const label own = mesh_.faceOwner()[facei];
680 const cell& ownFaces = mesh_.cells()[own];
681 forAll(ownFaces, ownFacei)
683 selected[ownFaces[ownFacei]] =
true;
686 if (mesh_.isInternalFace(facei))
688 const label nbr = mesh_.faceNeighbour()[facei];
690 const cell& nbrFaces = mesh_.cells()[nbr];
691 forAll(nbrFaces, nbrFacei)
693 selected[nbrFaces[nbrFacei]] =
true;
716 <<
"Merging all points on surface that" <<
nl
717 <<
"- are used by only two boundary faces and" <<
nl
718 <<
"- make an angle with a cosine of more than " << minCos
730 Info<<
"Removing " << nRemove
731 <<
" straight edge points ..." <<
nl <<
endl;
736 doRemovePoints(pointRemover, pointCanBeDeleted);
739 for (
label iteration = 0; iteration < 100; iteration++)
742 <<
"Undo iteration " << iteration <<
nl
743 <<
"----------------" <<
endl;
753 mesh_.nFaces()-mesh_.nInternalFaces()
791 Pout<<
"**Writing all faces in error to faceSet "
807 masterErrorFaces.
size(),
811 Info<<
"Detected " <<
n
812 <<
" error faces on boundaries that have been merged."
813 <<
" These will be restored to their original faces." <<
nl
822 <<
" error faces in mesh."
823 <<
" Restoring neighbours of faces in error." <<
nl
834 doRestorePoints(pointRemover, expandedErrorFaces);
840 doRestorePoints(pointRemover, masterErrorFaces);
845 const_cast<Time&
>(mesh_.time())++;
846 Pout<<
"Writing merged-edges mesh to time "
853 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')
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 setRefinement(const labelListList &faceSets, polyTopoChange &meshMod)
Play commands into polyTopoChange to combine faces. Gets.
void setUnrefinement(const labelList &masterFaces, polyTopoChange &meshMod, Map< label > &restoredFaces)
Play commands into polyTopoChange to reinsert original faces.
void topoChange(const polyTopoChangeMap &map)
Force recalculation of locally stored data on topological change.
const labelList & masterFace() const
If undoable: master face for every set.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
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
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.
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.
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)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
prefixOSstream Pout(cout, "Pout")