92 if (!isA<processorPolyPatch>(pp))
118 Info<<
"Removing zero-sized patch " << pp.
name()
119 <<
" type " << pp.type()
130 if (isA<processorPolyPatch>(pp))
147 Info<<
"Removing empty processor patch " << pp.
name()
154 if (nAllPatches != nOldPatches)
163 Info<<
"No patches removed." <<
endl;
166 delete allPatches[i];
191 Pout<<
"Writing " << cycPatch.
name()
192 <<
" faces to " << str.name() <<
endl;
204 Pout<<
"Writing " << nbrPatch.
name()
205 <<
" faces to " << str.name() <<
endl;
219 Pout<<
"Writing cyclic match as lines between face centres to "
231 str<<
"l " << vertI-1 <<
' ' << vertI <<
nl;
239 template<
class CombineOp>
244 const CombineOp& cop,
245 const point& nullValue
252 <<
" is not equal to the number of points in the mesh "
259 bool hasTransformation =
false;
271 isA<processorPolyPatch>(pp)
273 && refCast<const processorPolyPatch>(pp).owner()
277 refCast<const processorPolyPatch>(pp);
287 label nbrPointi = nbrPts[pointi];
288 if (nbrPointi >= 0 && nbrPointi < patchInfo.size())
290 patchInfo[nbrPointi] =
points[meshPts[pointi]];
312 isA<processorPolyPatch>(pp)
314 && !refCast<const processorPolyPatch>(pp).owner()
318 refCast<const processorPolyPatch>(pp);
329 fromNbr >> nbrPatchInfo;
332 nbrPatchInfo.setSize(procPatch.
nPoints(), nullValue);
336 hasTransformation =
true;
348 label meshPointi = meshPts[pointi];
349 points[meshPointi] = nbrPatchInfo[pointi];
362 isA<cyclicPolyPatch>(pp)
363 && refCast<const cyclicPolyPatch>(pp).owner()
367 refCast<const cyclicPolyPatch>(pp);
378 const edge&
e = coupledPoints[i];
379 label point0 = meshPts[
e[0]];
380 patchPoints[i] =
points[point0];
385 hasTransformation =
true;
395 const edge&
e = coupledPoints[i];
396 label point1 = nbrMeshPts[
e[1]];
397 points[point1] = patchPoints[i];
411 if (hasTransformation)
414 <<
"There are decomposed cyclics in this mesh with"
415 <<
" transformations." <<
endl
416 <<
"This is not supported. The result will be incorrect"
447 int main(
int argc,
char *argv[])
467 const Switch writeCyclicMatch
475 patches.checkParallelSync(
true);
478 if (writeCyclicMatch)
480 writeCyclicMatchObjs(
"initial_", mesh);
487 forAll(patchSources, addedI)
497 if (patchSources.size())
509 if (!isA<processorPolyPatch>(pp))
521 startFacei += pp.
size();
525 forAll(patchSources, addedI)
533 if (destPatchi == -1)
537 destPatchi = allPatches.size();
539 Info<<
"Adding new patch " << patchName
540 <<
" as patch " << destPatchi
541 <<
" from " << patchDict <<
endl;
543 patchDict.set(
"nFaces", 0);
544 patchDict.set(
"startFace", startFacei);
560 Info<<
"Patch '" << patchName <<
"' already exists. Only "
561 <<
"moving patch faces - type will remain the same" <<
endl;
570 if (isA<processorPolyPatch>(pp))
582 startFacei += pp.
size();
601 forAll(patchSources, addedI)
608 if (destPatchi == -1)
611 <<
"patch " << patchName <<
" not added. Problem."
617 if (sourceType ==
"patches")
632 Info<<
"Moving faces from patch " << pp.
name()
633 <<
" to patch " << destPatchi <<
endl;
647 else if (sourceType ==
"set")
654 <<
" faces from faceSet " << faces.name() <<
endl;
663 label facei = patchFaces[i];
668 <<
"Face " << facei <<
" specified in set "
670 <<
" is not an external face of the mesh." <<
endl
671 <<
"This application can only repatch existing boundary"
687 <<
"Invalid source type " << sourceType <<
endl
696 Info<<
"Doing topology modification to order faces." <<
nl <<
endl;
702 Info<<
"Removing patches with no faces in them." <<
nl<<
endl;
703 filterPatches(mesh, addedPatchNames);
706 if (writeCyclicMatch)
708 writeCyclicMatchObjs(
"final_", mesh);
725 Info<<
"Writing repatched mesh to " << runTime.name() <<
nl <<
endl;
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
A HashTable with keys but without contents.
bool insert(const Key &key)
Insert a new entry.
bool found(const Key &) const
Return true if hashedEntry is found in table.
static unsigned int defaultPrecision()
Return the default precision.
Input inter-processor communications stream.
void size(const label)
Override size to be inconsistent with allocated storage.
Output inter-processor communications stream.
virtual const fileName & name() const
Return the name of the stream.
label nPoints() const
Return number of points supporting patch faces.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
const Field< PointType > & points() const
Return reference to global points.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
void append(T *)
Append an element at the end of the list.
A list that is sorted upon construction or when explicitly requested with the sort() method.
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
label size() const
Return the number of elements in the UList.
static bool & parRun()
Is this a parallel run?
label size() const
Return the number of elements in the UPtrList.
bool optionFound(const word &opt) const
Return true if the named option is found.
bool optionReadIfPresent(const word &opt, T &) const
Read a value from the named option if present.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
const cyclicPolyPatch & nbrPatch() const
const edgeList & coupledPoints() const
Return connected points (from patch local to neighbour patch local)
virtual const transformer & transform() const
Return transformation between the coupled patches.
A list of keyword definitions, which are a keyword followed by any number of values (e....
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T, if not found return the given default.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A class for handling file names.
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
const labelList & sharedPointAddr() const
Return addressing into the complete globally shared points.
label nGlobalPoints() const
Return number of globally shared points.
const labelList & sharedPointLabels() const
Return indices of local points that are globally shared.
const word & name() const
Return name.
Mesh consisting of general polyhedral cells.
static word defaultRegion
Return the default region name.
virtual const faceList & faces() const
Return raw faces.
virtual const labelList & faceOwner() const
Return face owner.
const globalMeshData & globalData() const
Return parallel info.
const fileName & pointsInstance() const
Return the current instance directory for points.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
void addPatches(const List< polyPatch * > &, const bool validBoundary=true)
Add boundary patches.
void removeBoundary()
Remove boundary patches.
void setInstance(const fileName &)
Set the instance for mesh files.
A patch is a list of labels that address the faces in the global face list.
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.
label start() const
Return start label of this patch in the polyMesh face list.
static bool constraintType(const word &pt)
Return true if the given type is a constraint type.
virtual autoPtr< polyPatch > clone(const polyBoundaryMesh &bm) const
Construct and return a clone, resetting the boundary mesh.
Direct mesh changes based on v1.3 polyTopoChange syntax.
autoPtr< polyTopoChangeMap > changeMesh(polyMesh &mesh, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Inplace changes mesh without change of patches.
void modifyFace(const face &f, const label facei, const label own, const label nei, const bool flipFaceFlux, const label patchID)
Modify vertices or cell of face.
const vectorField & faceCentres() const
label nInternalFaces() const
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
Neighbour processor patch.
int neighbProcNo() const
Return neighbour processor number.
virtual const transformer & transform() const
Return null transform between processor patches.
const labelList & nbrPoints() const
Return neighbour point labels. WIP.
virtual bool write(const bool write=true) const
Write using setting from DB.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
int main(int argc, char *argv[])
const fvPatchList & patches
#define WarningInFunction
Report a warning using Foam::Warning.
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
IOdictionary systemDict(const word &dictName, const argList &args, const objectRegistry &ob, const word ®ionName=polyMesh::defaultRegion)
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
prefixOSstream Pout(cout, "Pout")
Foam::argList args(argc, argv)