Go to the documentation of this file.
87 void insertDuplicateMerge
101 label otherFacei = duplicates[bFacei];
103 if (otherFacei != -1 && otherFacei > bFacei)
107 label face0 = boundaryFaces[bFacei];
108 label face1 = boundaryFaces[otherFacei];
110 label own0 = faceOwner[face0];
111 label own1 = faceOwner[face1];
117 bool zoneFlip =
false;
146 bool zoneFlip =
false;
202 faceIDs[sz++] = pp.
start()+ppi;
206 if (faceIDs.size() != sz)
228 forAll(duplicates, bFacei)
230 if (duplicates[bFacei] != -1)
232 label facei = boundaryFaces[bFacei];
235 if (isA<processorPolyPatch>(
patches[patchi]))
238 <<
"Duplicate face " << facei
239 <<
" is on a processorPolyPatch."
240 <<
"This is not allowed." <<
nl
258 forAll(duplicates, bFacei)
260 label otherFacei = duplicates[bFacei];
262 if (otherFacei != -1 && otherFacei > bFacei)
264 duplicateSet.insert(boundaryFaces[bFacei]);
265 duplicateSet.insert(boundaryFaces[otherFacei]);
270 <<
" duplicate faces to faceSet " << duplicateSet.objectPath()
272 duplicateSet.
write();
279 int main(
int argc,
char *argv[])
283 "Detect faces that share points (baffles).\n"
284 "Merge them or duplicate the points."
293 "Specify a dictionary to read actions from"
298 "Find baffles only, but do not merge or split them"
303 "Topologically split duplicate surfaces"
315 const bool readDict =
args.
found(
"dict");
317 const bool overwrite =
args.
found(
"overwrite");
318 const bool detectOnly =
args.
found(
"detectOnly");
320 if (readDict && (
split || detectOnly))
323 <<
"Use of dictionary for settings not compatible with"
324 <<
" using command line arguments for \"split\""
348 Info<<
"Detecting baffles on " << detectPatchIDs.size()
360 Info<<
"Detecting baffles on " << mergePatchIDs.size()
372 Info<<
"Detecting baffles on " << splitPatchIDs.size()
395 if (detectPatchIDs.size())
397 findBaffles(
mesh, patchFaces(
mesh, detectPatchIDs));
446 if (mergePatchIDs.size())
448 Info<<
"Merging duplicate faces" <<
nl <<
endl;
453 const labelList boundaryFaces(patchFaces(
mesh, mergePatchIDs));
459 insertDuplicateMerge(
mesh, boundaryFaces, duplicates, meshMod);
473 if (map().hasMotionPoints())
487 if (splitPatchIDs.size())
489 Info<<
"Topologically splitting duplicate surfaces"
490 <<
", i.e. duplicating points internal to duplicate surfaces"
499 sz +=
patches[splitPatchIDs[i]].nPoints();
509 label pointi =
mp[mpi];
510 if (isCandidate.set(pointi))
512 candidates.
append(pointi);
529 pointDuplicator.setRefinement(
regionSide, meshMod);
543 if (map().hasMotionPoints())
559 const labelList& pointMap = map().pointMap();
567 label oldPointi = pointMap[pointi];
569 nDupPerPoint[oldPointi]++;
571 if (nDupPerPoint[oldPointi] > 1)
573 dupPoints.insert(map().reversePointMap()[oldPointi]);
574 dupPoints.insert(pointi);
579 <<
" duplicated points to pointSet "
580 << dupPoints.objectPath() <<
nl <<
endl;
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
const dimensionedScalar mp
Proton mass.
Takes mesh with 'baffles' (= boundary faces sharing points). Determines for selected points on bounda...
const word & name() const
Return name.
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)
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
wordList ReadFields(const typename GeoMesh::Mesh &mesh, const IOobjectList &objects, PtrList< GeometricField< Type, PatchField, GeoMesh >> &fields, const bool syncPar=true, const bool readOldTime=false)
Read Geometric fields of templated type.
static constexpr const zero Zero
Global zero (0)
autoPtr< mapPolyMesh > changeMesh(polyMesh &mesh, const bool inflate, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Inplace changes mesh without change of patches.
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
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.
const word dictName("blockMeshDict")
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.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Mesh consisting of general polyhedral cells.
#define forAll(list, i)
Loop across all elements in list.
const faceZoneMesh & faceZones() const
Return face zone mesh.
const fileName & pointsInstance() const
Return the current instance directory for points.
Determines the 'side' for every face and connected to a singly-connected (through edges) region of fa...
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)
A patch is a list of labels that address the faces in the global face list.
DynamicList< T, SizeMin > & append(const T &val)
Append an element to the end of this list.
virtual const labelList & faceOwner() const
Return face owner.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
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.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
label nBoundaryFaces() const
Number of boundary faces (== nFaces - nInternalFaces)
static labelList findDuplicateFaces(const primitiveMesh &, const labelList &)
Helper routine to find baffles (two boundary faces using the.
const labelIOList & zoneID
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
errorManip< error > abort(error &err)
List< Key > sortedToc() const
The table of contents (the keys) in sorted order.
label start() const
Return start label of this patch in the polyMesh face list.
List of IOobjects with searching and retrieving facilities.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void setCapacity(const label nElem)
Alter the size of the underlying storage.
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.
virtual const faceList & faces() const
Return raw faces.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label setAction(const topoAction &action)
For compatibility with polyTopoChange: set topological action.
Field reading functions for post-processing utilities.
Class containing data for face removal.
static void removeFiles(const polyMesh &mesh)
Helper: remove all procAddressing files from mesh instance.
label nPoints() const
Number of mesh points.
labelList identity(const label len, label start=0)
Create identity map of the given length with (map[i] == i)
A List of wordRe with additional matching capabilities.
labelHashSet patchSet(const UList< wordRe > &patchNames, const bool warnNotFound=true, const bool useGroups=true) const
Return the set of patch IDs corresponding to the given names.
const polyBoundaryMesh & patches
static bool split(const std::string &line, std::string &key, std::string &val)
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.
bool found(const word &optName) const
Return true if the named option is found.