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 Time & time() const
Return time.
const functionObjectList & functionObjects() const
Return the list of function objects.
virtual tmp< scalarField > movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Inter-processor communication reduction functions.
void inplaceRenumber(const labelUList &oldToNew, ListType &)
Inplace renumber the values of a list.
const boolList & flipMap() const
Return face flip map.
Class describing modification of a face.
void off()
Switch the function objects off.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
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.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static SLList< string > validArgs
A list of valid (mandatory) arguments.
label size() const
Return number of elements in table.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
bool insert(const Key &key)
Insert a new entry.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
A face addition data class. A face can be inflated either from a point or from another face and can e...
T optionLookupOrDefault(const word &opt, const T &deflt) const
Read a value from the named option if present.
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
Combines boundary faces into single face. The faces get the patch of the first face ('the master') ...
void reset(T *=0)
If object pointer already set, delete object and set to given.
dimensionedScalar cos(const dimensionedScalar &ds)
bool optionFound(const word &opt) const
Return true if the named option is found.
virtual void updateMesh(const mapPolyMesh &mpm)
Update the mesh corresponding to given map.
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.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
errorManip< error > abort(error &err)
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set).
bool found(const Key &) const
Return true if hashedEntry is found in table.
prefixOSstream Pout(cout,"Pout")
dimensionedScalar sin(const dimensionedScalar &ds)
T argRead(const label index) const
Read a value from the argument at index.
void setInstance(const fileName &)
Set the instance for mesh files.
const fileName & pointsInstance() const
Return the current instance directory for points.
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.
A List with indirect addressing.
Direct mesh changes based on v1.3 polyTopoChange syntax.
virtual bool write() const
Write using setting from DB.
const faceZoneMesh & faceZones() const
Return face zone mesh.
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.
const word & system() const
Return system name.
virtual const labelList & faceOwner() const
Return face owner.
virtual const faceList & faces() const
Return raw faces.
Foam::argList args(argc, argv)
bool checkFacePyramids(const pointField &points, const vectorField &ctrs, const bool report, const bool detailedReport, const scalar minPyrVol, labelHashSet *setPtr) const
Check face pyramid volume.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...