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<<
"Writing " << cycPatch.
name()
218 <<
" faces to " << str.name() <<
endl;
230 Pout<<
"Writing " << nbrPatch.
name()
231 <<
" faces to " << str.
name() <<
endl;
242 OFstream str(prefix+cycPatch.
name()+nbrPatch.name()+
"_match.obj");
245 Pout<<
"Writing 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[])
536 const Switch writeCyclicMatch
548 if (writeCyclicMatch)
550 writeCyclicMatchObjs(
"initial_", mesh);
557 forAll(patchSources, addedI)
559 const dictionary& dict = patchSources[addedI];
560 addedPatchNames.insert(dict.
lookup(
"name"));
567 if (patchSources.size())
579 if (!isA<processorPolyPatch>(pp))
591 startFacei += pp.size();
595 forAll(patchSources, addedI)
597 const dictionary& dict = patchSources[addedI];
601 label destPatchi = patches.findPatchID(patchName);
603 if (destPatchi == -1)
607 destPatchi = allPatches.size();
609 Info<<
"Adding new patch " << patchName
610 <<
" as patch " << destPatchi
611 <<
" from " << patchDict <<
endl;
613 patchDict.set(
"nFaces", 0);
614 patchDict.set(
"startFace", startFacei);
630 Info<<
"Patch '" << patchName <<
"' already exists. Only " 631 <<
"moving patch faces - type will remain the same" <<
endl;
640 if (isA<processorPolyPatch>(pp))
652 startFacei += pp.size();
671 forAll(patchSources, addedI)
673 const dictionary& dict = patchSources[addedI];
676 label destPatchi = patches.findPatchID(patchName);
678 if (destPatchi == -1)
681 <<
"patch " << patchName <<
" not added. Problem." 685 const word sourceType(dict.
lookup(
"constructFrom"));
687 if (sourceType ==
"patches")
700 const polyPatch& pp = patches[iter.key()];
702 Info<<
"Moving faces from patch " << pp.
name()
703 <<
" to patch " << destPatchi <<
endl;
717 else if (sourceType ==
"set")
724 <<
" faces from faceSet " << faces.name() <<
endl;
733 label facei = patchFaces[i];
738 <<
"Face " << facei <<
" specified in set " 740 <<
" is not an external face of the mesh." << endl
741 <<
"This application can only repatch existing boundary" 757 <<
"Invalid source type " << sourceType << endl
766 Info<<
"Doing topology modification to order faces." <<
nl <<
endl;
770 if (writeCyclicMatch)
772 writeCyclicMatchObjs(
"coupled_", mesh);
778 Info<<
"Not synchronising points." <<
nl <<
endl;
795 if (pp.size() && isA<coupledPolyPatch>(pp))
798 refCast<const coupledPolyPatch>(pp);
802 Info<<
"On coupled patch " << pp.
name()
803 <<
" separation[0] was " 806 if (isA<cyclicPolyPatch>(pp) && pp.size())
809 refCast<const cyclicPolyPatch>(pp);
814 Info<<
"On cyclic translation patch " << pp.
name()
815 <<
" forcing uniform separation of " 827 nbr[0].centre(mesh.
points())
828 - cycpp[0].centre(mesh.
points())
832 Info<<
"On coupled patch " << pp.
name()
833 <<
" forcing uniform separation of " 838 Info<<
"On coupled patch " << pp.
name()
839 <<
" forcing uniform rotation of " 851 Info<<
"On coupled patch " << pp.
name()
852 <<
" forcing uniform rotation of " 858 Info<<
"Synchronising points." <<
endl;
867 point(great, great, great)
880 Info<<
"Removing patches with no faces in them." <<
nl<<
endl;
881 filterPatches(mesh, addedPatchNames);
884 if (writeCyclicMatch)
886 writeCyclicMatchObjs(
"final_", mesh);
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.
void off()
Switch the function objects off.
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 word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
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 neighbour 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.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
const functionObjectList & functionObjects() const
Return the list of function objects.
#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...
const doubleScalar e
Elementary charge.
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.