Go to the documentation of this file.
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;
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 SLList< string > validArgs
A list of valid (mandatory) arguments.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
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 string.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
static void addOption(const word &opt, const string ¶m="", const string &usage="")
Add to an option to validOptions with usage information.
#define forAll(list, i)
Loop across all elements in list.
Removes selected points from mesh and updates faces using these points.
dimensionedScalar sin(const dimensionedScalar &ds)
Direct mesh changes based on v1.3 polyTopoChange syntax.
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
const functionObjectList & functionObjects() const
Return the list of function objects.
Unit conversion functions.
Class describing modification of a face.
virtual tmp< scalarField > movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
faceList mergePatchFaces(const List< DynList< label > > &pfcs, const pointField &polyPoints)
Mesh consisting of general polyhedral cells.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
const faceZoneMesh & faceZones() const
Return face zone mesh.
void inplaceRenumber(const labelUList &oldToNew, ListType &)
Inplace renumber the values of a list.
virtual bool write() const
Write mesh using IO settings from time.
const fileName & pointsInstance() const
Return the current instance directory for points.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const word & system() const
Return system name.
virtual void off()
Switch the function objects off.
A subset of mesh faces organised as a primitive patch.
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.
int main(int argc, char *argv[])
T optionLookupOrDefault(const word &opt, const T &deflt) const
Read a value from the named option if present.
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
label size() const
Return number of elements in table.
bool found(const Key &) const
Return true if hashedEntry is found in table.
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
errorManip< error > abort(error &err)
void setInstance(const fileName &)
Set the instance for mesh files.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
virtual const faceList & faces() const
Return raw faces.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
prefixOSstream Pout(cout, "Pout")
static bool checkMesh(const bool report, const polyMesh &mesh, const dictionary &dict, labelHashSet &wrongFaces)
Check mesh with mesh settings in dict. Collects incorrect faces.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set).
bool insert(const Key &key)
Insert a new entry.
bool optionFound(const word &opt) const
Return true if the named option is found.
void reset(T *=0)
If object pointer already set, delete object and set to given.
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.
T argRead(const label index) const
Read a value from the argument at index.
void size(const label)
Override size to be inconsistent with allocated storage.
Foam::argList args(argc, argv)
const boolList & flipMap() const
Return face flip map.
bool checkFacePyramids(const bool report=false, const scalar minPyrVol=-SMALL, labelHashSet *setPtr=NULL) const
Check face pyramid volume.
void clearOut()
Clear all geometry and addressing.
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
dimensionedScalar cos(const dimensionedScalar &ds)