70 const scalar concaveSin,
80 labelListList allFaceSets(faceCombiner.getMergeSets(minCos, concaveSin));
84 Info<<
"Merging " << nFaceSets <<
" sets of faces." <<
endl;
105 faceCombiner.setRefinement(allFaceSets, meshMod);
108 map = meshMod.changeMesh(mesh,
false,
true);
114 if (map().hasMotionPoints())
132 if (qualDictPtr.
valid())
146 label newMasterI = map().reverseFaceMap()[allFaceSets[setI][0]];
148 if (errorFaces.
found(newMasterI))
155 Info<<
"Detected " << nErrorSets
156 <<
" error faces on boundaries that have been merged." 157 <<
" These will be restored to their original faces." 165 label setI = iter.key();
167 faceList& setFaceVerts = allFaceSetsFaces[setI];
174 forAll(setFaceVerts[i], j)
176 label newVertI = setFaceVerts[i][j];
181 <<
"In set:" << setI <<
" old face labels:" 182 << allFaceSets[setI] <<
" new face vertices:" 183 << setFaceVerts[i] <<
" are unmapped vertices!" 198 label setI = iter.key();
200 const labelList& setFaces = allFaceSets[setI];
201 const faceList& setFaceVerts = allFaceSetsFaces[setI];
203 label newMasterI = map().reverseFaceMap()[setFaces[0]];
209 bool zoneFlip =
false;
217 Pout<<
"Restoring new master face " << newMasterI
218 <<
" to vertices " << setFaceVerts[0] <<
endl;
239 for (
label i = 1; i < setFaces.
size(); i++)
241 Pout<<
"Restoring removed face " << setFaces[i]
242 <<
" with vertices " << setFaceVerts[i] <<
endl;
264 map = meshMod.changeMesh(mesh,
false,
true);
270 if (map().hasMotionPoints())
283 Info<<
"No faces merged ..." <<
endl;
294 Info<<
"Merging all points on surface that" <<
nl 295 <<
"- are used by only two boundary faces and" <<
nl 296 <<
"- make an angle with a cosine of more than " << minCos
304 label nRemove = pointRemover.countPointUsage(minCos, pointCanBeDeleted);
308 Info<<
"Removing " << nRemove
309 <<
" straight edge points ..." <<
endl;
314 pointRemover.setRefinement(pointCanBeDeleted, meshMod);
323 if (map().hasMotionPoints())
335 Info<<
"No straight edges simplified and no points removed ..." <<
endl;
343 int main(
int argc,
char *argv[])
352 "specify concave angle [0..180] (default: 30 degrees)" 357 "read user-defined mesh quality criterions from system/meshQualityDict" 366 const scalar featureAngle =
args.
argRead<scalar>(1);
377 Info<<
"Merging all faces of a cell" <<
nl 378 <<
" - which are on the same patch" <<
nl 379 <<
" - which make an angle < " << featureAngle <<
" degrees" 381 <<
" (cos:" << minCos <<
')' <<
nl 382 <<
" - even when resulting face becomes concave by more than " 383 << concaveAngle <<
" degrees" <<
nl 384 <<
" (sin:" << concaveSin <<
')' <<
nl 390 Info<<
"Enabling user-defined geometry checks." <<
nl <<
endl;
417 label nChanged = mergePatchFaces
427 if (qualDict.
valid())
429 Info<<
"Merging all 'loose' points on surface edges, " 430 <<
"regardless of the angle they make." <<
endl;
433 nChanged += mergeEdges(-1, mesh);
437 nChanged += mergeEdges(minCos, mesh);
static bool checkMesh(const bool report, const polyMesh &mesh, const dictionary &dict, labelHashSet &wrongFaces)
Check mesh with mesh settings in dict. Collects incorrect faces.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
#define forAll(list, i)
Loop across all elements in list.
Inter-processor communication reduction functions.
void inplaceRenumber(const labelUList &oldToNew, ListType &)
Inplace renumber the values of a list.
Class describing modification of a face.
void reset(T *=nullptr)
If object pointer already set, delete object and set to given.
void off()
Switch the function objects off.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Unit conversion functions.
void clearOut()
Clear all geometry and addressing unnecessary for CFD.
void size(const label)
Override size to be inconsistent with allocated storage.
const boolList & flipMap() const
Return face flip map.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool optionFound(const word &opt) const
Return true if the named option is found.
static SLList< string > validArgs
A list of valid (mandatory) arguments.
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
bool insert(const Key &key)
Insert a new entry.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
label size() const
Return number of elements in table.
A face addition data class. A face can be inflated either from a point or from another face and can e...
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
T optionLookupOrDefault(const word &opt, const T &deflt) const
Read a value from the named option if present.
bool checkFacePyramids(const pointField &points, const vectorField &ctrs, const bool report, const bool detailedReport, const scalar minPyrVol, labelHashSet *setPtr) const
Check face pyramid volume.
Combines boundary faces into single face. The faces get the patch of the first face ('the master') ...
const fileName & pointsInstance() const
Return the current instance directory for points.
dimensionedScalar cos(const dimensionedScalar &ds)
bool found(const Key &) const
Return true if hashedEntry is found in table.
static word timeName(const scalar, const int precision=curPrecision_)
Return time name of given scalar time.
A class for handling words, derived from string.
static void addOption(const word &opt, const string ¶m="", const string &usage="")
Add to an option to validOptions with usage information.
virtual const labelList & faceOwner() const
Return face owner.
virtual const faceList & faces() const
Return raw faces.
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set)
errorManip< error > abort(error &err)
const word & system() const
Return system name.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
dimensionedScalar sin(const dimensionedScalar &ds)
const Time & time() const
Return time.
void setInstance(const fileName &)
Set the instance for mesh files.
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
const functionObjectList & functionObjects() const
Return the list of function objects.
prefixOSstream Pout(cout, "Pout")
const meshFaceZones & faceZones() const
Return face zones.
T argRead(const label index) const
Read a value from the argument at index.
A List with indirect addressing.
Direct mesh changes based on v1.3 polyTopoChange syntax.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Removes selected points from mesh and updates faces using these points.
Mesh consisting of general polyhedral cells.
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
A subset of mesh faces organised as a primitive patch.
virtual bool write(const bool write=true) const
Write using setting from DB.
virtual void setPoints(const pointField &)
Reset the points.
Foam::argList args(argc, argv)
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
label whichPatch(const label faceIndex) const
Return patch index for a given face label.