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())
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
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...
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
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.
const boolList & flipMap() const noexcept
virtual bool write(const bool valid=true) const
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
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)
Unit conversion functions.
Class describing modification of a face.
virtual tmp< scalarField > movePoints(const pointField &)
const polyBoundaryMesh & boundaryMesh() const
static bool checkMesh(const bool report, const polyMesh &mesh, const dictionary &dict, labelHashSet &wrongFaces, const bool dryRun=false)
Ostream & endl(Ostream &os)
A HashTable with keys but without contents that is similar to std::unordered_set.
T get(const label index) const
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Mesh consisting of general polyhedral cells.
static void addArgument(const string &argName, const string &usage="")
const fileName & pointsInstance() const
static void noFunctionObjects(bool addWithOption=false)
A subset of mesh faces organised as a primitive patch.
virtual const labelList & faceOwner() const
virtual void updateMesh(const mapPolyMesh &mpm)
const faceZoneMesh & faceZones() const noexcept
label whichPatch(const label faceIndex) const
label whichZone(const label objectIndex) const
const labelIOList & zoneID
label whichFace(const label globalCellID) const
errorManip< error > abort(error &err)
Inter-processor communication reduction functions.
constexpr scalar degToRad(const scalar deg) noexcept
void reset(autoPtr< T > &&other) noexcept
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
const word & system() const
virtual const faceList & faces() const
#define FatalErrorInFunction
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
static void removeFiles(const polyMesh &mesh)
bool insert(const Key &key)
const Time & time() const
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.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Foam::argList args(argc, argv)
static void removeFiles(const polyMesh &)
void setInstance(const fileName &instance, const IOobject::writeOption wOpt=IOobject::AUTO_WRITE)
bool found(const word &optName) const
dimensionedScalar cos(const dimensionedScalar &ds)