251 const scalar concaveCos,
279 if (preserveFaces[set[j]] != -1)
290 allFaceSets[compactI] = set;
300 Info<<
"Merging " << nFaceSets <<
" sets of faces." <<
nl <<
endl;
306 faceSet allSets(mesh_,
"allFaceSets", allFaceSets.
size());
309 forAll(allFaceSets[seti], i)
311 allSets.
insert(allFaceSets[seti][i]);
314 Pout<<
"Writing all faces to be merged to set "
344 if (map().hasMotionPoints())
366 const label oldMasterI = allFaceSets[seti][0];
367 retestFaces.
insert(map().reverseFaceMap()[oldMasterI]);
374 Pout<<
"Checking sync after initial merging " << nFaceSets
375 <<
" faces." <<
endl;
378 Pout<<
"Writing initial merged-faces mesh to time "
383 for (
label iteration = 0; iteration < 100; iteration++)
386 <<
"Undo iteration " << iteration <<
nl
387 <<
"----------------" <<
endl;
441 Pout<<
"Writing all faces in error to faceSet "
456 if (masterFacei != -1)
460 const cell& cFaces = mesh_.
cells()[masterCellII];
464 if (errorFaces.
found(cFaces[i]))
466 mastersToRestore.
append(masterFacei);
472 mastersToRestore.
shrink();
476 mastersToRestore.
size(),
480 Info<<
"Masters that need to be restored:"
485 faceSet restoreSet(mesh_,
"mastersToRestore", mastersToRestore);
487 Pout<<
"Writing all " << mastersToRestore.
size()
488 <<
" masterfaces to be restored to set "
534 if (map().hasMotionPoints())
563 retestFaces.
insert(iter.key());
579 Pout<<
"Checking sync after restoring " << retestFaces.
size()
580 <<
" faces." <<
endl;
583 Pout<<
"Writing merged-faces mesh to time "
593 Info<<
"No faces merged ..." <<
endl;
616 mesh_.topoChange(map);
619 if (map().hasMotionPoints())
621 mesh_.movePoints(map().preMotionPoints());
630 mesh_.setInstance(
name());
642 retestFaces.
insert(facei);
645 topoChange(map, growFaceCellFace(retestFaces));
650 Pout<<
"Checking sync after removing points." <<
endl;
688 mesh_.topoChange(map);
691 if (map().hasMotionPoints())
693 mesh_.movePoints(map().preMotionPoints());
702 mesh_.setInstance(
name());
709 const label facei = map().reverseFaceMap()[facesToRestore[i]];
712 retestFaces.
insert(facei);
715 topoChange(map, growFaceCellFace(retestFaces));
720 Pout<<
"Checking sync after restoring points on "
721 << facesToRestore.
size() <<
" faces." <<
endl;
738 boolList selected(mesh_.nFaces(),
false);
742 const label facei = candidateFaces[i];
744 if (set.
found(facei))
746 selected[facei] =
true;
758 return selectedFaces;
768 boolList selected(mesh_.nFaces(),
false);
772 const label facei = iter.key();
773 const label own = mesh_.faceOwner()[facei];
775 const cell& ownFaces = mesh_.cells()[own];
776 forAll(ownFaces, ownFacei)
778 selected[ownFaces[ownFacei]] =
true;
781 if (mesh_.isInternalFace(facei))
783 const label nbr = mesh_.faceNeighbour()[facei];
785 const cell& nbrFaces = mesh_.cells()[nbr];
786 forAll(nbrFaces, nbrFacei)
788 selected[nbrFaces[nbrFacei]] =
true;
811 <<
"Merging all points on surface that" <<
nl
812 <<
"- are used by only two boundary faces and" <<
nl
813 <<
"- make an angle with a cosine of more than " << minCos
825 Info<<
"Removing " << nRemove
826 <<
" straight edge points ..." <<
nl <<
endl;
831 doRemovePoints(pointRemover, pointCanBeDeleted);
834 for (
label iteration = 0; iteration < 100; iteration++)
837 <<
"Undo iteration " << iteration <<
nl
838 <<
"----------------" <<
endl;
848 mesh_.nFaces()-mesh_.nInternalFaces()
886 Pout<<
"**Writing all faces in error to faceSet "
902 masterErrorFaces.
size(),
906 Info<<
"Detected " <<
n
907 <<
" error faces on boundaries that have been merged."
908 <<
" These will be restored to their original faces." <<
nl
917 <<
" error faces in mesh."
918 <<
" Restoring neighbours of faces in error." <<
nl
929 doRestorePoints(pointRemover, expandedErrorFaces);
935 doRestorePoints(pointRemover, masterErrorFaces);
940 const_cast<Time&
>(mesh_.time())++;
941 Pout<<
"Writing merged-edges mesh to time "
948 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 tmp< scalarField > movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
virtual void topoChange(const polyTopoChangeMap &map)
Update mesh corresponding to the given map.
void clearOut()
Clear all geometry and addressing.
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
static bool checkMesh(const bool report, const polyMesh &mesh, const dictionary &dict, labelHashSet &wrongFaces)
Check mesh with mesh settings in dict. Collects incorrect faces.
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 inflate, 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.
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.
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")
word name(const complex &)
Return a string representation of a complex.