Go to the documentation of this file.
72 bool zoneFlip =
false;
115 if (!isA<processorPolyPatch>(pp))
128 || isA<coupledPolyPatch>(pp)
144 Info<<
"Removing zero-sized patch " << pp.
name()
145 <<
" type " << pp.type()
146 <<
" at position " << patchI <<
endl;
155 if (isA<processorPolyPatch>(pp))
172 Info<<
"Removing empty processor patch " << pp.
name()
173 <<
" at position " << patchI <<
endl;
179 if (nAllPatches != nOldPatches)
188 Info<<
"No patches removed." <<
endl;
191 delete allPatches[i];
206 isA<cyclicPolyPatch>(
patches[patchI])
207 && refCast<const cyclicPolyPatch>(
patches[patchI]).owner()
211 refCast<const cyclicPolyPatch>(
patches[patchI]);
216 Pout<<
"Dumping " << cycPatch.
name()
217 <<
" faces to " << str.
name() <<
endl;
229 Pout<<
"Dumping " << nbrPatch.
name()
230 <<
" faces to " << str.
name() <<
endl;
244 Pout<<
"Dumping cyclic match as lines between face centres to "
256 str<<
"l " << vertI-1 <<
' ' << vertI <<
nl;
269 if (separation.size() == 1)
275 field[i] += separation[0];
278 else if (separation.size() == field.
size())
282 field[i] += separation[i];
288 <<
"Sizes of field and transformation not equal. field:"
289 << field.
size() <<
" transformation:" << separation.size()
296 template<
class CombineOp>
301 const CombineOp& cop,
302 const point& nullValue
308 <<
"Number of values " <<
points.size()
309 <<
" is not equal to the number of points in the mesh "
316 bool hasTransformation =
false;
328 isA<processorPolyPatch>(pp)
330 && refCast<const processorPolyPatch>(pp).owner()
334 refCast<const processorPolyPatch>(pp);
344 label nbrPointI = nbrPts[pointI];
345 if (nbrPointI >= 0 && nbrPointI < patchInfo.size())
347 patchInfo[nbrPointI] =
points[meshPts[pointI]];
365 isA<processorPolyPatch>(pp)
367 && !refCast<const processorPolyPatch>(pp).owner()
371 refCast<const processorPolyPatch>(pp);
382 fromNbr >> nbrPatchInfo;
385 nbrPatchInfo.setSize(procPatch.
nPoints(), nullValue);
389 hasTransformation =
true;
394 hasTransformation =
true;
402 label meshPointI = meshPts[pointI];
403 points[meshPointI] = nbrPatchInfo[pointI];
416 isA<cyclicPolyPatch>(pp)
417 && refCast<const cyclicPolyPatch>(pp).owner()
421 refCast<const cyclicPolyPatch>(pp);
432 const edge&
e = coupledPoints[i];
433 label point0 = meshPts[
e[0]];
434 half0Values[i] =
points[point0];
439 hasTransformation =
true;
444 hasTransformation =
true;
450 const edge&
e = coupledPoints[i];
451 label point1 = nbrMeshPts[
e[1]];
452 points[point1] = half0Values[i];
466 if (hasTransformation)
469 <<
"There are decomposed cyclics in this mesh with"
470 <<
" transformations." <<
endl
471 <<
"This is not supported. The result will be incorrect"
516 s.erase(0,
s.find_first_not_of(
" "));
517 s.erase(
s.find_last_not_of(
" ") + 1);
518 s.erase(0,
s.find_first_not_of(
"\t"));
519 s.erase(
s.find_last_not_of(
"\t") + 1);
523 std::vector<std::string>
splitstring (std::string SourceString, std::string strSplit =
" ",
int nSkip = 0 )
525 std::vector<std::string> vecStr;
532 std::string stringsource_new;
533 for (
int i = 0; i < (int)SourceString.length(); i++)
535 if (SourceString[i] == aa || SourceString[i] == bb || SourceString[i] == cc || SourceString[i] == dd)
539 stringsource_new.push_back(SourceString[i]);
544 while (ePos != std::string::npos)
546 if (sPos != ePos) vecStr.push_back(stringsource_new.substr(sPos, ePos - sPos).c_str());
547 sPos = ePos + strSplit.size();
548 ePos = stringsource_new.find(strSplit, sPos);
550 if (sPos < stringsource_new.size()) vecStr.push_back(
trim(stringsource_new.substr(sPos, stringsource_new.size() - sPos)).c_str());
561 int main(
int argc,
char *argv[])
569 "write obj files showing the cyclic matching process"
573 runTime.functionObjects().off();
588 std::string dictPara =
"";
593 dictPara =
args[
"dict"];
595 std::vector<std::string> paraList =
splitstring(dictPara);
597 dictA.
add(
"pointSync",(
word)paraList[0]);
598 dictA.
add(
"patches",jj);
600 subDict.
add(
"name",(
word)paraList[1]);
601 subDict.
add(
"patchInfo",subsubDict);
602 subsubDict.
add(
"type",(
word)paraList[2]);
603 subDict.
add(
"constructFrom",(
word)paraList[3]);
604 if (paraList[3]==
"set")
606 subDict.
add(
"set",(
word)paraList[4]);
617 patchestmp.
append(paraList[4]);
622 subDict.
add(
"patches",patchestmp);
662 patches.checkParallelSync(
true);
674 forAll(patchSources, addedI)
679 Info<<
"addedpatchNames = " << addedPatchNames <<
endl;
687 if (patchSources.
size())
695 Info <<
"patch size()=" <<
patches.size() <<
", patchSOurces.size=" << patchSources.
size() <<
endl;
703 if (!isA<processorPolyPatch>(pp))
715 startFaceI += pp.size();
719 forAll(patchSources, addedI)
727 if (destPatchI == -1)
731 destPatchI = allPatches.size();
733 Info<<
"Adding new patch " << patchName
734 <<
" as patch " << destPatchI
735 <<
" from " << patchDict <<
endl;
737 patchDict.
set(
"nFaces", 0);
738 patchDict.
set(
"startFace", startFaceI);
754 Info<<
"Patch '" << patchName <<
"' already exists. Only "
755 <<
"moving patch faces - type will remain the same" <<
endl;
764 if (isA<processorPolyPatch>(pp))
776 startFaceI += pp.size();
795 forAll(patchSources, addedI)
803 if (destPatchI == -1)
806 <<
"patch " << patchName <<
" not added. Problem."
810 const word sourceType(subDict.
lookup(
"constructFrom"));
812 if (sourceType ==
"patches")
827 Info<<
"Moving faces from patch " << pp.
name()
828 <<
" to patch " << destPatchI <<
endl;
842 else if (sourceType ==
"set")
849 <<
" faces from faceSet " << faces.
name() <<
endl;
863 <<
"Face " << faceI <<
" specified in set "
865 <<
" is not an external face of the mesh." <<
endl
866 <<
"This application can only repatch existing boundary"
882 <<
"Invalid source type " << sourceType <<
endl
891 Info<<
"Doing topology modification to order faces." <<
nl <<
endl;
903 Info<<
"Not synchronising points." <<
nl <<
endl;
920 if (pp.size() && isA<coupledPolyPatch>(pp))
923 refCast<const coupledPolyPatch>(pp);
927 Info<<
"On coupled patch " << pp.
name()
928 <<
" separation[0] was "
931 if (isA<cyclicPolyPatch>(pp) && pp.size())
934 refCast<const cyclicPolyPatch>(pp);
939 Info<<
"On cyclic translation patch " << pp.
name()
940 <<
" forcing uniform separation of "
957 Info<<
"On coupled patch " << pp.
name()
958 <<
" forcing uniform separation of "
963 Info<<
"On coupled patch " << pp.
name()
964 <<
" forcing uniform rotation of "
976 Info<<
"On coupled patch " << pp.
name()
977 <<
" forcing uniform rotation of "
983 Info<<
"Synchronising points." <<
endl;
992 point(GREAT, GREAT, GREAT)
1005 Info<<
"Removing patches with no faces in them." <<
nl<<
endl;
1028 Info<<
"Writing repatched mesh to " << runTime.timeName() <<
nl <<
endl;
vectorField pointField
pointField is a vectorField.
virtual const pointField & points() const
Return raw points.
void syncPoints(const polyMesh &mesh, pointField &points, const CombineOp &cop, const point &nullValue)
void dumpCyclicMatch(const fileName &prefix, const polyMesh &mesh)
points setSize(newPointi)
virtual const vectorField & separation() const
If the planes are separated the separation vector.
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
const Field< PointType > & points() const
Return reference to global points.
A class for handling words, derived from string.
A class for handling file names.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
void append(T *)
Append an element at the end of the list.
A PtrList of objects of type <T> with automated input and output.
List< Key > toc() const
Return the table of contents.
static word defaultRegion
Return the default region name.
#define forAll(list, i)
Loop across all elements in list.
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.
const cyclicPolyPatch & neighbPatch() const
virtual const tensorField & forwardT() const
Return face transformation tensor.
int main(int argc, char *argv[])
static bool & parRun()
Is this a parallel run?
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
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 addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
int neighbProcNo() const
Return neigbour 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.
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...
dimensioned< scalar > mag(const dimensioned< Type > &)
void separateList(const vectorField &separation, UList< vector > &field)
labelList patchFaces(const polyBoundaryMesh &patches, const wordList &names)
A HashTable with keys but without contents.
Mesh consisting of general polyhedral cells.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
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.
virtual bool write() const
Write mesh using IO settings from time.
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.
label nGlobalPoints() const
Return number of globally shared points.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
A subset of mesh faces organised as a primitive patch.
void append(const T &)
Append an element at the end of the list.
A patch is a list of labels that address the faces in the global face list.
virtual const labelList & faceOwner() const
Return face owner.
const word & name() const
Return name.
Neighbour processor patch.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
graph_traits< Graph >::vertices_size_type size_type
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
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 any number of values (e....
label size() const
Return number of elements in table.
label nInternalFaces() const
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.
A list that is sorted upon construction or when explicitly requested with the sort() method.
bool found(const Key &) const
Return true if hashedEntry is found in table.
void writeObj(Ostream &os, const pointField &points)
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
errorManip< error > abort(error &err)
const double e
Elementary charge.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
label start() const
Return start label of this patch in the polyMesh face list.
virtual transformType transform() const
Type of transform.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
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.
std::vector< std::string > splitstring(std::string SourceString, std::string strSplit=" ", int nSkip=0)
void setInstance(const fileName &)
Set the instance for mesh files.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
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.
prefixOSstream Pout(cout, "Pout")
void addPatches(const List< polyPatch * > &, const bool validBoundary=true)
Add boundary patches.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
std::string trim(std::string s)
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
const vectorField & faceCentres() const
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
label size() const
Return the number of elements in the PtrList.
bool insert(const Key &key)
Insert a new entry.
bool optionFound(const word &opt) const
Return true if the named option is found.
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 fileName & name() const
Return the name of the stream.
void changePatchID(const polyMesh &mesh, const label faceID, const label patchID, polyTopoChange &meshMod)
void size(const label)
Override size to be inconsistent with allocated storage.
void transformList(const tensor &, UList< T > &)
Apply transformation to list. Either single transformation tensor.
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.
label size() const
Return the number of elements in the UList.
const labelList & meshPoints() const
Return labelList of mesh points in patch.
defineTemplateTypeNameAndDebug(IOPtrList< ensightPart >, 0)
Foam::argList args(argc, argv)
void filterPatches(polyMesh &mesh, const HashSet< word > &addedPatchNames)
const boolList & flipMap() const
Return face flip map.
bool optionReadIfPresent(const word &opt, T &) const
Read a value from the named option if present.
const word & name() const
Return 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)
bool add(entry *, bool mergeEntry=false)
Add a new entry.
void set(entry *)
Assign a new entry, overwrite any existing entry.