73 bool zoneFlip =
false;
116 if (!isA<processorPolyPatch>(pp))
129 || isA<coupledPolyPatch>(pp)
145 Info<<
"Removing zero-sized patch " << pp.
name()
146 <<
" type " << pp.type()
147 <<
" at position " << patchi <<
endl;
156 if (isA<processorPolyPatch>(pp))
173 Info<<
"Removing empty processor patch " << pp.
name()
174 <<
" at position " << patchi <<
endl;
180 if (nAllPatches != nOldPatches)
189 Info<<
"No patches removed." <<
endl;
192 delete allPatches[i];
207 isA<cyclicPolyPatch>(patches[patchi])
208 && refCast<const cyclicPolyPatch>(patches[patchi]).owner()
212 refCast<const cyclicPolyPatch>(patches[
patchi]);
217 Pout<<
"Dumping " << cycPatch.
name()
218 <<
" faces to " << str.name() <<
endl;
230 Pout<<
"Dumping " << nbrPatch.
name()
231 <<
" faces to " << str.
name() <<
endl;
242 OFstream str(prefix+cycPatch.
name()+nbrPatch.name()+
"_match.obj");
245 Pout<<
"Dumping cyclic match as lines between face centres to " 257 str<<
"l " << vertI-1 <<
' ' << vertI <<
nl;
270 if (separation.
size() == 1)
276 field[i] += separation[0];
279 else if (separation.
size() == field.
size())
283 field[i] += separation[i];
289 <<
"Sizes of field and transformation not equal. field:" 290 << field.
size() <<
" transformation:" << separation.
size()
297 template<
class CombineOp>
302 const CombineOp& cop,
303 const point& nullValue
309 <<
"Number of values " << points.
size()
310 <<
" is not equal to the number of points in the mesh " 317 bool hasTransformation =
false;
329 isA<processorPolyPatch>(pp)
331 && refCast<const processorPolyPatch>(pp).owner()
335 refCast<const processorPolyPatch>(pp);
345 label nbrPointi = nbrPts[pointi];
346 if (nbrPointi >= 0 && nbrPointi < patchInfo.size())
348 patchInfo[nbrPointi] = points[meshPts[pointi]];
370 isA<processorPolyPatch>(pp)
372 && !refCast<const processorPolyPatch>(pp).owner()
376 refCast<const processorPolyPatch>(pp);
387 fromNbr >> nbrPatchInfo;
390 nbrPatchInfo.setSize(procPatch.
nPoints(), nullValue);
394 hasTransformation =
true;
399 hasTransformation =
true;
400 separateList(-procPatch.
separation(), nbrPatchInfo);
407 label meshPointi = meshPts[pointi];
408 points[meshPointi] = nbrPatchInfo[pointi];
421 isA<cyclicPolyPatch>(pp)
422 && refCast<const cyclicPolyPatch>(pp).owner()
426 refCast<const cyclicPolyPatch>(pp);
437 const edge&
e = coupledPoints[i];
438 label point0 = meshPts[e[0]];
439 half0Values[i] = points[point0];
444 hasTransformation =
true;
449 hasTransformation =
true;
450 separateList(cycPatch.
separation(), half0Values);
455 const edge&
e = coupledPoints[i];
456 label point1 = nbrMeshPts[e[1]];
457 points[point1] = half0Values[i];
471 if (hasTransformation)
474 <<
"There are decomposed cyclics in this mesh with" 475 <<
" transformations." << endl
476 <<
"This is not supported. The result will be incorrect" 507 int main(
int argc,
char *argv[])
514 runTime.functionObjects().off();
542 dumpCyclicMatch(
"initial_", mesh);
548 forAll(patchSources, addedI)
550 const dictionary& dict = patchSources[addedI];
551 addedPatchNames.insert(dict.
lookup(
"name"));
558 if (patchSources.size())
570 if (!isA<processorPolyPatch>(pp))
582 startFacei += pp.size();
586 forAll(patchSources, addedI)
588 const dictionary& dict = patchSources[addedI];
592 label destPatchi = patches.findPatchID(patchName);
594 if (destPatchi == -1)
598 destPatchi = allPatches.size();
600 Info<<
"Adding new patch " << patchName
601 <<
" as patch " << destPatchi
602 <<
" from " << patchDict <<
endl;
604 patchDict.set(
"nFaces", 0);
605 patchDict.set(
"startFace", startFacei);
621 Info<<
"Patch '" << patchName <<
"' already exists. Only " 622 <<
"moving patch faces - type will remain the same" <<
endl;
631 if (isA<processorPolyPatch>(pp))
643 startFacei += pp.size();
662 forAll(patchSources, addedI)
664 const dictionary& dict = patchSources[addedI];
667 label destPatchi = patches.findPatchID(patchName);
669 if (destPatchi == -1)
672 <<
"patch " << patchName <<
" not added. Problem." 676 const word sourceType(dict.
lookup(
"constructFrom"));
678 if (sourceType ==
"patches")
691 const polyPatch& pp = patches[iter.key()];
693 Info<<
"Moving faces from patch " << pp.
name()
694 <<
" to patch " << destPatchi <<
endl;
708 else if (sourceType ==
"set")
715 <<
" faces from faceSet " << faces.name() <<
endl;
724 label facei = patchFaces[i];
729 <<
"Face " << facei <<
" specified in set " 731 <<
" is not an external face of the mesh." << endl
732 <<
"This application can only repatch existing boundary" 748 <<
"Invalid source type " << sourceType << endl
757 Info<<
"Doing topology modification to order faces." <<
nl <<
endl;
761 dumpCyclicMatch(
"coupled_", mesh);
766 Info<<
"Not synchronising points." <<
nl <<
endl;
783 if (pp.size() && isA<coupledPolyPatch>(pp))
786 refCast<const coupledPolyPatch>(pp);
790 Info<<
"On coupled patch " << pp.
name()
791 <<
" separation[0] was " 794 if (isA<cyclicPolyPatch>(pp) && pp.size())
797 refCast<const cyclicPolyPatch>(pp);
802 Info<<
"On cyclic translation patch " << pp.
name()
803 <<
" forcing uniform separation of " 815 nbr[0].centre(mesh.
points())
816 - cycpp[0].centre(mesh.
points())
820 Info<<
"On coupled patch " << pp.
name()
821 <<
" forcing uniform separation of " 826 Info<<
"On coupled patch " << pp.
name()
827 <<
" forcing uniform rotation of " 839 Info<<
"On coupled patch " << pp.
name()
840 <<
" forcing uniform rotation of " 846 Info<<
"Synchronising points." <<
endl;
855 point(GREAT, GREAT, GREAT)
868 Info<<
"Removing patches with no faces in them." <<
nl<<
endl;
869 filterPatches(mesh, addedPatchNames);
872 dumpCyclicMatch(
"final_", mesh);
888 Info<<
"Writing repatched mesh to " << runTime.timeName() <<
nl <<
endl;
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
const labelList & sharedPointLabels() const
Return indices of local points that are globally shared.
virtual const fileName & name() const
Return the name of the stream.
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.
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.
const labelList & neighbPoints() const
Return neighbour point labels. WIP.
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 & name() const
Return name.
A class for handling file names.
virtual bool separated() const
Are the planes separated.
const faceZoneMesh & faceZones() const
Return face zone mesh.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const edgeList & coupledPoints() const
Return connected points (from patch local to neighbour patch local)
Class describing modification of a face.
const double e
Elementary charge.
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 > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label nInternalFaces() const
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...
static unsigned int defaultPrecision()
Return the default precision.
void size(const label)
Override size to be inconsistent with allocated storage.
const boolList & flipMap() const
Return face flip map.
static word defaultRegion
Return the default region name.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool optionFound(const word &opt) const
Return true if the named option is found.
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...
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
bool optionReadIfPresent(const word &opt, T &) const
Read a value from the named option if present.
virtual const vectorField & separation() const
If the planes are separated the separation vector.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
virtual const tensorField & forwardT() const
Return face transformation tensor.
void transformList(const tensor &, UList< T > &)
Apply transformation to list. Either single transformation tensor.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Neighbour processor patch.
virtual const pointField & points() const
Return raw points.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Input inter-processor communications stream.
points setSize(newPointi)
virtual bool parallel() const
Are the cyclic planes parallel.
virtual autoPtr< polyPatch > clone(const polyBoundaryMesh &bm) const
Construct and return a clone, resetting the boundary mesh.
label nGlobalPoints() const
Return number of globally shared points.
vectorField pointField
pointField is a vectorField.
const fileName & pointsInstance() const
Return the current instance directory for points.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
bool found(const Key &) const
Return true if hashedEntry is found in table.
A class for handling words, derived from string.
word name() const
Return file name (part beyond last /)
virtual const labelList & faceOwner() const
Return face owner.
const Field< PointType > & points() const
Return reference to global points.
const globalMeshData & globalData() const
Return parallel info.
const word dictName("particleTrackDict")
virtual const faceList & faces() const
Return raw faces.
int neighbProcNo() const
Return neigbour processor number.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
errorManip< error > abort(error &err)
void addPatches(const List< polyPatch *> &, const bool validBoundary=true)
Add boundary patches.
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 isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
void removeBoundary()
Remove boundary patches.
bool checkParallelSync(const bool report=false) const
Check whether all procs have all patches and in same order. Return.
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.
const vector & separationVector() const
Translation vector for translational cyclics.
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
label size() const
Return the number of elements in the UPtrList.
const vectorField & faceCentres() const
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
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.
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...
prefixOSstream Pout(cout, "Pout")
Direct mesh changes based on v1.3 polyTopoChange syntax.
label start() const
Return start label of this patch in the polyMesh face list.
dimensioned< scalar > mag(const dimensioned< Type > &)
virtual transformType transform() const
Type of transform.
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 cyclicPolyPatch & neighbPatch() const
A patch is a list of labels that address the faces in the global face list.
label size() const
Return the number of elements in the UList.
virtual bool write(const bool valid=true) const
Write using setting from DB.
Foam::argList args(argc, argv)
const labelList & sharedPointAddr() const
Return addressing into the complete globally shared points.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
label setAction(const topoAction &action)
For compatibility with polyTopoChange: set topological action.