Go to the documentation of this file.
78 const scalar concaveSin,
88 labelListList allFaceSets(faceCombiner.getMergeSets(minCos, concaveSin));
92 Info<<
"Merging " << nFaceSets <<
" sets of faces." <<
endl;
113 faceCombiner.setRefinement(allFaceSets, meshMod);
116 map = meshMod.changeMesh(
mesh,
false,
true);
122 if (map().hasMotionPoints())
140 if (qualDictPtr.
valid())
154 label newMasterI = map().reverseFaceMap()[allFaceSets[seti][0]];
156 if (errorFaces.
found(newMasterI))
163 Info<<
"Detected " << nErrorSets
164 <<
" error faces on boundaries that have been merged."
165 <<
" These will be restored to their original faces."
171 for (
const label seti : errorSets)
173 faceList& setFaceVerts = allFaceSetsFaces[seti];
180 forAll(setFaceVerts[i], j)
182 label newVertI = setFaceVerts[i][j];
187 <<
"In set:" << seti <<
" old face labels:"
188 << allFaceSets[seti] <<
" new face vertices:"
189 << setFaceVerts[i] <<
" are unmapped vertices!"
202 for (
const label seti : errorSets)
204 const labelList& setFaces = allFaceSets[seti];
205 const faceList& setFaceVerts = allFaceSetsFaces[seti];
207 label newMasterI = map().reverseFaceMap()[setFaces[0]];
213 bool zoneFlip =
false;
221 Pout<<
"Restoring new master face " << newMasterI
222 <<
" to vertices " << setFaceVerts[0] <<
endl;
243 for (label i = 1; i < setFaces.size(); ++i)
245 Pout<<
"Restoring removed face " << setFaces[i]
246 <<
" with vertices " << setFaceVerts[i] <<
endl;
268 map = meshMod.changeMesh(
mesh,
false,
true);
274 if (map().hasMotionPoints())
287 Info<<
"No faces merged ..." <<
endl;
298 Info<<
"Merging all points on surface that" <<
nl
299 <<
"- are used by only two boundary faces and" <<
nl
300 <<
"- make an angle with a cosine of more than " << minCos
308 label nRemove = pointRemover.countPointUsage(minCos, pointCanBeDeleted);
312 Info<<
"Removing " << nRemove
313 <<
" straight edge points ..." <<
endl;
318 pointRemover.setRefinement(pointCanBeDeleted, meshMod);
327 if (map().hasMotionPoints())
339 Info<<
"No straight edges simplified and no points removed ..." <<
endl;
347 int main(
int argc,
char *argv[])
351 "Checks for multiple patch faces on the same cell and combines them."
365 "Specify concave angle [0..180] (default: 30 degrees)"
370 "Read user-defined mesh quality criteria from system/meshQualityDict"
381 const scalar featureAngle =
args.
get<scalar>(1);
390 const bool overwrite =
args.
found(
"overwrite");
391 const bool meshQuality =
args.
found(
"meshQuality");
393 Info<<
"Merging all faces of a cell" <<
nl
394 <<
" - which are on the same patch" <<
nl
395 <<
" - which make an angle < " << featureAngle <<
" degrees"
397 <<
" (cos:" << minCos <<
')' <<
nl
398 <<
" - even when resulting face becomes concave by more than "
399 << concaveAngle <<
" degrees" <<
nl
400 <<
" (sin:" << concaveSin <<
')' <<
nl
406 Info<<
"Enabling user-defined geometry checks." <<
nl <<
endl;
433 label nChanged = mergePatchFaces
443 if (qualDict.
valid())
445 Info<<
"Merging all 'loose' points on surface edges, "
446 <<
"regardless of the angle they make." <<
endl;
449 nChanged += mergeEdges(-1,
mesh);
453 nChanged += mergeEdges(minCos,
mesh);
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
label size() const noexcept
The number of elements in table.
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
bool checkFacePyramids(const pointField &points, const vectorField &ctrs, const bool report, const bool detailedReport, const scalar minPyrVol, labelHashSet *setPtr) const
Check face pyramid volume.
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')
A class for handling words, derived from Foam::string.
virtual bool write(const bool valid=true) const
Write mesh using IO settings from time.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
Removes selected points from mesh and updates faces using these points.
dimensionedScalar sin(const dimensionedScalar &ds)
static word timeName(const scalar t, const int precision=precision_)
Direct mesh changes based on v1.3 polyTopoChange syntax.
static void addNote(const string ¬e)
Add extra notes for the usage information.
Unit conversion functions.
Class describing modification of a face.
bool valid() const noexcept
True if the managed pointer is non-null.
virtual tmp< scalarField > movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
static bool checkMesh(const bool report, const polyMesh &mesh, const dictionary &dict, labelHashSet &wrongFaces, const bool dryRun=false)
Check mesh with mesh settings in dict. Collects incorrect faces.
Ostream & endl(Ostream &os)
Add newline and flush stream.
prefixOSstream Pout
An Ostream wrapper for parallel output to std::cout.
T get(const label index) const
Get a value from the argument at index.
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Inplace renumber the values (not the indices) of a list.
Mesh consisting of general polyhedral cells.
#define forAll(list, i)
Loop across all elements in list.
const faceZoneMesh & faceZones() const
Return face zone mesh.
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
const fileName & pointsInstance() const
Return the current instance directory for points.
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
A subset of mesh faces organised as a primitive patch.
messageStream Info
Information stream (uses stdout - output is on the master only)
virtual const labelList & faceOwner() const
Return face owner.
virtual void updateMesh(const mapPolyMesh &mpm)
Update mesh corresponding to the given map.
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
const labelIOList & zoneID
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
errorManip< error > abort(error &err)
Inter-processor communication reduction functions.
constexpr scalar degToRad(const scalar deg) noexcept
Conversion from degrees to radians.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
const word & system() const
Return system name.
virtual const faceList & faces() const
Return raw faces.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static void removeFiles(const polyMesh &mesh)
Helper: remove all procAddressing files from mesh instance.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
const Time & time() const
Return the top-level database.
A face addition data class. A face can be inflated either from a point or from another face and can e...
A List with indirect addressing.
bool found(const Key &key) const
Return true if hashed entry is found in table.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
Foam::argList args(argc, argv)
const boolList & flipMap() const
Return face flip map.
static void removeFiles(const polyMesh &)
Helper: remove all sets files from mesh instance.
void setInstance(const fileName &instance, const IOobject::writeOption wOpt=IOobject::AUTO_WRITE)
Set the instance for mesh files.
void clearOut()
Clear all geometry and addressing.
bool found(const word &optName) const
Return true if the named option is found.
dimensionedScalar cos(const dimensionedScalar &ds)