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[])
468 const Switch writeCyclicMatch
476 patches.checkParallelSync(
true);
479 if (writeCyclicMatch)
481 writeCyclicMatchObjs(
"initial_",
mesh);
509 addedPatchNames.
insert(iter().keyword());
516 if (patchesDict.size())
528 if (!isA<processorPolyPatch>(pp))
540 startFacei += pp.
size();
546 const word& patchName = iter().keyword();
551 if (destPatchi == -1)
555 destPatchi = allPatches.size();
557 Info<<
"Adding new patch " << patchName
558 <<
" as patch " << destPatchi
559 <<
" from " << patchDict <<
endl;
561 patchDict.set(
"nFaces", 0);
562 patchDict.set(
"startFace", startFacei);
578 Info<<
"Patch '" << patchName <<
"' already exists. Only "
579 <<
"moving patch faces - type will remain the same" <<
endl;
588 if (isA<processorPolyPatch>(pp))
600 startFacei += pp.
size();
620 const word& patchName = iter().keyword();
625 if (destPatchi == -1)
628 <<
"patch " << patchName <<
" not added. Problem."
634 if (sourceType ==
"patches")
649 Info<<
"Moving faces from patch " << pp.
name()
650 <<
" to patch " << destPatchi <<
endl;
664 else if (sourceType ==
"zone")
681 patchFaces = zg->generate().fZone();
685 <<
" faces from zoneGenerator " << zg->name()
686 <<
" of type " << zg->type() <<
endl;
696 <<
" faces from faceZone " << zoneName <<
endl;
703 label facei = patchFaces[i];
708 <<
"Face " << facei <<
" specified in faceZone "
709 <<
" is not an external face of the mesh." <<
endl
710 <<
"This application can only repatch existing boundary"
723 else if (sourceType ==
"set")
730 <<
" faces from faceSet " << faces.name() <<
endl;
739 label facei = patchFaces[i];
744 <<
"Face " << facei <<
" specified in set "
746 <<
" is not an external face of the mesh." <<
endl
747 <<
"This application can only repatch existing boundary"
763 <<
"Invalid source type " << sourceType <<
endl
772 Info<<
"Doing topology modification to order faces." <<
nl <<
endl;
778 Info<<
"Removing patches with no faces in them." <<
nl<<
endl;
779 filterPatches(
mesh, addedPatchNames);
782 if (writeCyclicMatch)
784 writeCyclicMatchObjs(
"final_",
mesh);
801 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.
void sort()
(stable) sort the list (if changed after construction time)
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 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 keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
bool isDict(const word &) const
Check if entry is a sub-dictionary.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
bool add(entry *, bool mergeEntry=false)
Add a new entry.
T lookupOrDefault(const word &, const T &, const bool writeDefault=writeOptionalEntries > 0) const
Find and return a T, if not found return the given default.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A class for handling file names.
virtual bool write(const bool write=true) const
Write mesh using IO settings from time.
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 faceZoneList & faceZones() const
Return face zones.
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.
A class for handling words, derived from string.
static autoPtr< zoneGenerator > New(const word &name, const polyMesh &mesh, const dictionary &dict)
Select constructed from name, mesh and dictionary.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
int main(int argc, char *argv[])
const fvPatchList & patches
const volScalarField & psi
#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.
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")
IOdictionary systemDict(const word &dictName, const argList &args, const objectRegistry &ob, const word ®ionName=polyMesh::defaultRegion, const fileName &path=fileName::null)
Foam::argList args(argc, argv)