72 bool zoneFlip =
false;
115 if (!isA<processorPolyPatch>(pp))
128 || isA<coupledPolyPatch>(pp)
144 Info<<
"Removing zero-sized patch " << pp.
name()
145 <<
" type " << pp.type()
146 <<
" at position " << patchi <<
endl;
155 if (isA<processorPolyPatch>(pp))
172 Info<<
"Removing empty processor patch " << pp.
name()
173 <<
" at position " << patchi <<
endl;
179 if (nAllPatches != nOldPatches)
188 Info<<
"No patches removed." <<
endl;
191 delete allPatches[i];
206 isA<cyclicPolyPatch>(patches[patchi])
207 && refCast<const cyclicPolyPatch>(patches[patchi]).owner()
211 refCast<const cyclicPolyPatch>(patches[
patchi]);
216 Pout<<
"Dumping " << cycPatch.
name()
217 <<
" faces to " << str.name() <<
endl;
229 Pout<<
"Dumping " << nbrPatch.
name()
230 <<
" faces to " << str.
name() <<
endl;
241 OFstream str(prefix+cycPatch.
name()+nbrPatch.name()+
"_match.obj");
244 Pout<<
"Dumping cyclic match as lines between face centres to " 256 str<<
"l " << vertI-1 <<
' ' << vertI <<
nl;
269 if (separation.
size() == 1)
275 field[i] += separation[0];
278 else if (separation.
size() == field.
size())
282 field[i] += separation[i];
288 <<
"Sizes of field and transformation not equal. field:" 289 << field.
size() <<
" transformation:" << separation.
size()
296 template<
class CombineOp>
301 const CombineOp& cop,
302 const point& nullValue
308 <<
"Number of values " << points.
size()
309 <<
" is not equal to the number of points in the mesh " 316 bool hasTransformation =
false;
328 isA<processorPolyPatch>(pp)
330 && refCast<const processorPolyPatch>(pp).owner()
334 refCast<const processorPolyPatch>(pp);
344 label nbrPointi = nbrPts[pointi];
345 if (nbrPointi >= 0 && nbrPointi < patchInfo.size())
347 patchInfo[nbrPointi] = points[meshPts[pointi]];
365 isA<processorPolyPatch>(pp)
367 && !refCast<const processorPolyPatch>(pp).owner()
371 refCast<const processorPolyPatch>(pp);
382 fromNbr >> nbrPatchInfo;
385 nbrPatchInfo.setSize(procPatch.
nPoints(), nullValue);
389 hasTransformation =
true;
394 hasTransformation =
true;
395 separateList(-procPatch.
separation(), nbrPatchInfo);
402 label meshPointi = meshPts[pointi];
403 points[meshPointi] = nbrPatchInfo[pointi];
416 isA<cyclicPolyPatch>(pp)
417 && refCast<const cyclicPolyPatch>(pp).owner()
421 refCast<const cyclicPolyPatch>(pp);
432 const edge&
e = coupledPoints[i];
433 label point0 = meshPts[e[0]];
434 half0Values[i] = points[point0];
439 hasTransformation =
true;
444 hasTransformation =
true;
445 separateList(cycPatch.
separation(), half0Values);
450 const edge&
e = coupledPoints[i];
451 label point1 = nbrMeshPts[e[1]];
452 points[point1] = half0Values[i];
466 if (hasTransformation)
469 <<
"There are decomposed cyclics in this mesh with" 470 <<
" transformations." << endl
471 <<
"This is not supported. The result will be incorrect" 502 int main(
int argc,
char *argv[])
509 runTime.functionObjects().off();
537 dumpCyclicMatch(
"initial_", mesh);
543 forAll(patchSources, addedI)
545 const dictionary& dict = patchSources[addedI];
546 addedPatchNames.insert(dict.
lookup(
"name"));
553 if (patchSources.size())
565 if (!isA<processorPolyPatch>(pp))
577 startFacei += pp.size();
581 forAll(patchSources, addedI)
583 const dictionary& dict = patchSources[addedI];
587 label destPatchi = patches.findPatchID(patchName);
589 if (destPatchi == -1)
593 destPatchi = allPatches.
size();
595 Info<<
"Adding new patch " << patchName
596 <<
" as patch " << destPatchi
597 <<
" from " << patchDict <<
endl;
599 patchDict.set(
"nFaces", 0);
600 patchDict.set(
"startFace", startFacei);
616 Info<<
"Patch '" << patchName <<
"' already exists. Only " 617 <<
"moving patch faces - type will remain the same" <<
endl;
626 if (isA<processorPolyPatch>(pp))
638 startFacei += pp.size();
657 forAll(patchSources, addedI)
659 const dictionary& dict = patchSources[addedI];
662 label destPatchi = patches.findPatchID(patchName);
664 if (destPatchi == -1)
667 <<
"patch " << patchName <<
" not added. Problem." 671 const word sourceType(dict.
lookup(
"constructFrom"));
673 if (sourceType ==
"patches")
686 const polyPatch& pp = patches[iter.key()];
688 Info<<
"Moving faces from patch " << pp.
name()
689 <<
" to patch " << destPatchi <<
endl;
703 else if (sourceType ==
"set")
710 <<
" faces from faceSet " << faces.name() <<
endl;
719 label facei = patchFaces[i];
724 <<
"Face " << facei <<
" specified in set " 726 <<
" is not an external face of the mesh." << endl
727 <<
"This application can only repatch existing boundary" 743 <<
"Invalid source type " << sourceType << endl
752 Info<<
"Doing topology modification to order faces." <<
nl <<
endl;
756 dumpCyclicMatch(
"coupled_", mesh);
761 Info<<
"Not synchronising points." <<
nl <<
endl;
778 if (pp.size() && isA<coupledPolyPatch>(pp))
781 refCast<const coupledPolyPatch>(pp);
785 Info<<
"On coupled patch " << pp.
name()
786 <<
" separation[0] was " 789 if (isA<cyclicPolyPatch>(pp) && pp.size())
792 refCast<const cyclicPolyPatch>(pp);
797 Info<<
"On cyclic translation patch " << pp.
name()
798 <<
" forcing uniform separation of " 810 nbr[0].centre(mesh.
points())
811 - cycpp[0].centre(mesh.
points())
815 Info<<
"On coupled patch " << pp.
name()
816 <<
" forcing uniform separation of " 821 Info<<
"On coupled patch " << pp.
name()
822 <<
" forcing uniform rotation of " 834 Info<<
"On coupled patch " << pp.
name()
835 <<
" forcing uniform rotation of " 841 Info<<
"Synchronising points." <<
endl;
850 point(GREAT, GREAT, GREAT)
863 Info<<
"Removing patches with no faces in them." <<
nl<<
endl;
864 filterPatches(mesh, addedPatchNames);
867 dumpCyclicMatch(
"final_", mesh);
883 Info<<
"Writing repatched mesh to " << runTime.timeName() <<
nl <<
endl;
const cyclicPolyPatch & neighbPatch() const
label nPoints() const
Return number of points supporting patch faces.
scalar diff(const triad &A, const triad &B)
Return a quantity of the difference between two triads.
A HashTable with keys but without contents.
void append(T *)
Append an element at the end of the list.
const labelList & sharedPointAddr() const
Return addressing into the complete globally shared points.
virtual tmp< scalarField > movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
#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.
A class for handling file names.
bool checkParallelSync(const bool report=false) const
Check whether all procs have all patches and in same order. Return.
virtual autoPtr< polyPatch > clone(const polyBoundaryMesh &bm) const
Construct and return a clone, resetting the boundary mesh.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const boolList & flipMap() const
Return face flip map.
Class describing modification of a face.
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
const double e
Elementary charge.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
A list of keyword definitions, which are a keyword followed by any number of values (e...
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
virtual const vectorField & separation() const
If the planes are separated the separation vector.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A list that is sorted upon construction or when explicitly requested with the sort() method...
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
int neighbProcNo() const
Return neigbour processor number.
static unsigned int defaultPrecision()
Return the default precision.
void size(const label)
Override size to be inconsistent with allocated storage.
bool optionReadIfPresent(const word &opt, T &) const
Read a value from the named option if present.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
static word defaultRegion
Return the default region name.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Field< PointType > & points() const
Return reference to global points.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none.
The coupledPolyPatch is an abstract base class for patches that couple regions of the computational d...
const edgeList & coupledPoints() const
Return connected points (from patch local to neighbour patch local)
const vectorField & faceCentres() const
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
label size() const
Return number of elements in list.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual transformType transform() const
Type of transform.
void transformList(const tensor &, UList< T > &)
Apply transformation to list. Either single transformation tensor.
virtual const pointField & points() const
Return raw points.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Neighbour processor patch.
Input inter-processor communications stream.
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
points setSize(newPointi)
virtual bool separated() const
Are the planes separated.
word name() const
Return file name (part beyond last /)
vectorField pointField
pointField is a vectorField.
label start() const
Return start label of this patch in the polyMesh face list.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
bool optionFound(const word &opt) const
Return true if the named option is found.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A class for handling words, derived from string.
virtual const fileName & name() const
Return the name of the stream.
virtual bool parallel() const
Are the cyclic planes parallel.
const word & name() const
Return name.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
errorManip< error > abort(error &err)
defineTemplateTypeNameAndDebug(IOPtrList< ensightPart >, 0)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
bool found(const Key &) const
Return true if hashedEntry is found in table.
const globalMeshData & globalData() const
Return parallel info.
void removeBoundary()
Remove boundary patches.
prefixOSstream Pout(cout,"Pout")
Type gMax(const FieldField< Field, Type > &f)
Output inter-processor communications stream.
IOobject dictIO(dictName, runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE)
void setInstance(const fileName &)
Set the instance for mesh files.
void addPatches(const List< polyPatch * > &, const bool validBoundary=true)
Add boundary patches.
label size() const
Return the number of elements in the UList.
A PtrList of objects of type <T> with automated input and output.
static bool & parRun()
Is this a parallel run?
vector point
Point is a vector.
#define WarningInFunction
Report a warning using Foam::Warning.
word dictName("noiseDict")
Type gAverage(const FieldField< Field, Type > &f)
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
const fileName & pointsInstance() const
Return the current instance directory for points.
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
Direct mesh changes based on v1.3 polyTopoChange syntax.
virtual bool write() const
Write using setting from DB.
const labelList & neighbPoints() const
Return neighbour point labels. WIP.
const vector & separationVector() const
Translation vector for translational cyclics.
virtual const tensorField & forwardT() const
Return face transformation tensor.
dimensioned< scalar > mag(const dimensioned< Type > &)
const faceZoneMesh & faceZones() const
Return face zone mesh.
static autoPtr< polyPatch > New(const word &patchType, const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Return a pointer to a new patch created on freestore from.
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...
Mesh consisting of general polyhedral cells.
A subset of mesh faces organised as a primitive patch.
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.
const labelList & sharedPointLabels() const
Return indices of local points that are globally shared.
virtual const labelList & faceOwner() const
Return face owner.
A patch is a list of labels that address the faces in the global face list.
virtual const faceList & faces() const
Return raw faces.
Foam::argList args(argc, argv)
label nGlobalPoints() const
Return number of globally shared points.
label nInternalFaces() const
label size() const
Return the number of elements in the UPtrList.
label setAction(const topoAction &action)
For compatibility with polyTopoChange: set topological action.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.