Go to the documentation of this file.
80 bool zoneFlip =
false;
123 if (!isA<processorPolyPatch>(pp))
136 || isA<coupledPolyPatch>(pp)
152 Info<<
"Removing zero-sized patch " << pp.
name()
153 <<
" type " << pp.type()
154 <<
" at position " << patchi <<
endl;
163 if (isA<processorPolyPatch>(pp))
180 Info<<
"Removing empty processor patch " << pp.
name()
181 <<
" at position " << patchi <<
endl;
187 if (nAllPatches != nOldPatches)
196 Info<<
"No patches removed." <<
endl;
199 delete allPatches[i];
214 isA<cyclicPolyPatch>(
patches[patchi])
215 && refCast<const cyclicPolyPatch>(
patches[patchi]).owner()
219 refCast<const cyclicPolyPatch>(
patches[patchi]);
224 Pout<<
"Dumping " << cycPatch.
name()
225 <<
" faces to " << str.name() <<
endl;
237 Pout<<
"Dumping " << nbrPatch.
name()
238 <<
" faces to " << str.name() <<
endl;
252 Pout<<
"Dumping cyclic match as lines between face centres to "
264 str<<
"l " << vertI-1 <<
' ' << vertI <<
nl;
277 if (separation.size() == 1)
283 field[i] += separation[0];
286 else if (separation.size() ==
field.size())
290 field[i] += separation[i];
296 <<
"Sizes of field and transformation not equal. field:"
297 <<
field.size() <<
" transformation:" << separation.size()
304 template<
class CombineOp>
309 const CombineOp& cop,
310 const point& nullValue
316 <<
"Number of values " <<
points.size()
317 <<
" is not equal to the number of points in the mesh "
324 bool hasTransformation =
false;
336 isA<processorPolyPatch>(pp)
338 && refCast<const processorPolyPatch>(pp).owner()
342 refCast<const processorPolyPatch>(pp);
352 label nbrPointi = nbrPts[pointi];
353 if (nbrPointi >= 0 && nbrPointi < patchInfo.size())
355 patchInfo[nbrPointi] =
points[meshPts[pointi]];
377 isA<processorPolyPatch>(pp)
379 && !refCast<const processorPolyPatch>(pp).owner()
383 refCast<const processorPolyPatch>(pp);
394 fromNbr >> nbrPatchInfo;
397 nbrPatchInfo.setSize(procPatch.
nPoints(), nullValue);
401 hasTransformation =
true;
406 hasTransformation =
true;
407 separateList(-procPatch.
separation(), nbrPatchInfo);
414 label meshPointi = meshPts[pointi];
415 points[meshPointi] = nbrPatchInfo[pointi];
428 isA<cyclicPolyPatch>(pp)
429 && refCast<const cyclicPolyPatch>(pp).owner()
433 refCast<const cyclicPolyPatch>(pp);
444 const edge&
e = coupledPoints[i];
445 label point0 = meshPts[
e[0]];
446 half0Values[i] =
points[point0];
451 hasTransformation =
true;
456 hasTransformation =
true;
457 separateList(cycPatch.
separation(), half0Values);
462 const edge&
e = coupledPoints[i];
463 label point1 = nbrMeshPts[
e[1]];
464 points[point1] = half0Values[i];
478 if (hasTransformation)
481 <<
"There are decomposed cyclics in this mesh with"
482 <<
" transformations." <<
endl
483 <<
"This is not supported. The result will be incorrect"
514 int main(
int argc,
char *argv[])
518 "Create patches out of selected boundary faces, which are either"
519 " from existing patches or from a faceSet"
528 "Write obj files showing the cyclic matching process"
536 const word meshRegionName =
539 const bool overwrite =
args.
found(
"overwrite");
543 const bool writeObj =
args.
found(
"writeObj");
554 const bool pointSync(
dict.
get<
bool>(
"pointSync"));
564 dumpCyclicMatch(
"initial_",
mesh);
580 if (patchSources.size())
592 if (!isA<processorPolyPatch>(pp))
604 startFacei += pp.size();
614 if (destPatchi == -1)
618 destPatchi = allPatches.size();
620 Info<<
"Adding new patch " << patchName
621 <<
" as patch " << destPatchi
622 <<
" from " << patchDict <<
endl;
624 patchDict.set(
"nFaces", 0);
625 patchDict.set(
"startFace", startFacei);
641 Info<<
"Patch '" << patchName <<
"' already exists. Only "
642 <<
"moving patch faces - type will remain the same" <<
endl;
651 if (isA<processorPolyPatch>(pp))
663 startFacei += pp.size();
687 if (destPatchi == -1)
690 <<
"patch " << patchName <<
" not added. Problem."
696 if (sourceType ==
"patches")
704 for (
const label patchi : patchSources)
708 Info<<
"Moving faces from patch " << pp.
name()
709 <<
" to patch " << destPatchi <<
endl;
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 dumpCyclicMatch(
"coupled_",
mesh);
784 Info<<
"Not synchronising points." <<
nl <<
endl;
801 if (pp.size() && isA<coupledPolyPatch>(pp))
804 refCast<const coupledPolyPatch>(pp);
808 Info<<
"On coupled patch " << pp.
name()
809 <<
" separation[0] was "
812 if (isA<cyclicPolyPatch>(pp) && pp.size())
815 refCast<const cyclicPolyPatch>(pp);
820 Info<<
"On cyclic translation patch " << pp.
name()
821 <<
" forcing uniform separation of "
838 Info<<
"On coupled patch " << pp.
name()
839 <<
" forcing uniform separation of "
844 Info<<
"On coupled patch " << pp.
name()
845 <<
" forcing uniform rotation of "
857 Info<<
"On coupled patch " << pp.
name()
858 <<
" forcing uniform rotation of "
864 Info<<
"Synchronising points." <<
endl;
873 point(GREAT, GREAT, GREAT)
886 Info<<
"Removing patches with no faces in them." <<
nl<<
endl;
887 filterPatches(
mesh, addedPatchNames);
892 dumpCyclicMatch(
"final_",
mesh);
void addPatches(PtrList< polyPatch > &plist, const bool validBoundary=true)
Add boundary patches.
vectorField pointField
pointField is a vectorField.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
virtual const pointField & points() const
Return raw points.
points setSize(newPointi)
virtual const vectorField & separation() const
If the planes are separated the separation vector.
const word & name() const
Return name.
A class for handling words, derived from Foam::string.
A class for handling file names.
virtual bool write(const bool valid=true) const
Write mesh using IO settings from time.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
A PtrList of objects of type <T> with automated input and output.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
static word defaultRegion
Return the default region name.
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
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.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Type gAverage(const FieldField< Field, Type > &f)
Output inter-processor communications stream.
label nInternalFaces() const
Number of internal faces.
const cyclicPolyPatch & neighbPatch() const
virtual const tensorField & forwardT() const
Return face transformation tensor.
const fileName & instance() const
static bool & parRun()
Is this a parallel run?
static word timeName(const scalar t, const int precision=precision_)
Direct mesh changes based on v1.3 polyTopoChange syntax.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
static void addNote(const string ¬e)
Add extra notes for the usage information.
const word dictName("blockMeshDict")
int neighbProcNo() const
Return neighbour processor number.
Class describing modification of a face.
virtual tmp< scalarField > movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
defineTemplateTypeNameAndDebug(faScalarMatrix, 0)
Ostream & endl(Ostream &os)
Add newline and flush stream.
The coupledPolyPatch is an abstract base class for patches that couple regions of the computational d...
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
prefixOSstream Pout
An Ostream wrapper for parallel output to std::cout.
Mesh consisting of general polyhedral cells.
#define forAll(list, i)
Loop across all elements in list.
const faceZoneMesh & faceZones() const
Return face zone mesh.
const edgeList & coupledPoints() const
Return connected points (from patch local to neighbour patch local)
virtual bool parallel() const
Are the cyclic planes parallel.
scalar diff(const triad &A, const triad &B)
Return a quantity of the difference between two triads.
const fileName & pointsInstance() const
Return the current instance directory for points.
virtual bool separated() const
Are the planes separated.
bool checkParallelSync(const bool report=false) const
Check whether all procs have all patches and in same order. Return.
void transformList(const tensor &rotTensor, UList< T > &field)
Inplace transform a list of elements.
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
label nGlobalPoints() const
Return number of globally shared points.
A subset of mesh faces organised as a primitive patch.
messageStream Info
Information stream (uses stdout - output is on the master only)
A patch is a list of labels that address the faces in the global face list.
virtual const fileName & name() const
Return the name of the stream.
virtual const labelList & faceOwner() const
Return face owner.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
Neighbour processor patch.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
label findPatchID(const word &patchName, const bool allowNotFound=true) const
Find patch index given a name, return -1 if not found.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
void append(T *ptr)
Append an element to the end of the list.
ITstream & lookup(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
label nPoints() const
Return number of points supporting patch faces.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
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.
const Field< point_type > & points() const
Return reference to global points.
A list that is sorted upon construction or when explicitly requested with the sort() method.
const labelIOList & zoneID
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
errorManip< error > abort(error &err)
label start() const
Return start label of this patch in the polyMesh face list.
virtual transformType transform() const
Type of transform.
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)
void removeBoundary()
Remove boundary patches.
Output to file stream, using an OSstream.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
virtual const faceList & faces() const
Return raw faces.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const labelList & neighbPoints() const
Return neighbour point labels. WIP.
label setAction(const topoAction &action)
For compatibility with polyTopoChange: set topological action.
static unsigned int defaultPrecision()
Return the default precision.
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const vectorField & faceCentres() const
static void removeFiles(const polyMesh &mesh)
Helper: remove all procAddressing files from mesh instance.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
const dimensionedScalar e
Elementary charge.
label nPoints() const
Number of mesh points.
A List of wordRe with additional matching capabilities.
labelHashSet patchSet(const UList< wordRe > &patchNames, const bool warnNotFound=true, const bool useGroups=true) const
Return the set of patch IDs corresponding to the given names.
const polyBoundaryMesh & patches
const labelList & sharedPointLabels() const
Return indices of local points that are globally shared.
const labelList & sharedPointAddr() const
Return addressing into the complete globally shared points.
Input inter-processor communications stream.
const globalMeshData & globalData() const
Return parallel info.
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
vector point
Point is a vector.
bool found(const Key &key) const
Return true if hashed entry is found in table.
const labelList & meshPoints() const
Return labelList of mesh points in patch.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
Foam::argList args(argc, argv)
const boolList & flipMap() const
Return face flip map.
static void removeFiles(const polyMesh &)
Helper: remove all sets files from mesh instance.
const word & name() const
The patch name.
#define WarningInFunction
Report a warning using Foam::Warning.
const vector & separationVector() const
Translation vector for translational cyclics.
Type gMax(const FieldField< Field, Type > &f)
void setInstance(const fileName &instance, const IOobject::writeOption wOpt=IOobject::AUTO_WRITE)
Set the instance for mesh files.
bool found(const word &optName) const
Return true if the named option is found.