createPatch.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2016-2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Application
28  createPatch
29 
30 Group
31  grpMeshManipulationUtilities
32 
33 Description
34  Create patches out of selected boundary faces, which are either
35  from existing patches or from a faceSet.
36 
37  More specifically it:
38  - creates new patches (from selected boundary faces).
39  Synchronise faces on coupled patches.
40  - synchronises points on coupled boundaries
41  - remove patches with 0 faces in them
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #include "cyclicPolyPatch.H"
46 #include "syncTools.H"
47 #include "argList.H"
48 #include "polyMesh.H"
49 #include "Time.H"
50 #include "OFstream.H"
51 #include "meshTools.H"
52 #include "faceSet.H"
53 #include "IOPtrList.H"
54 #include "polyTopoChange.H"
55 #include "polyModifyFace.H"
56 #include "wordRes.H"
57 #include "processorMeshes.H"
58 #include "IOdictionary.H"
59 
60 using namespace Foam;
61 
62 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
63 
64 namespace Foam
65 {
67 }
68 
69 void changePatchID
70 (
71  const polyMesh& mesh,
72  const label faceID,
73  const label patchID,
74  polyTopoChange& meshMod
75 )
76 {
77  const label zoneID = mesh.faceZones().whichZone(faceID);
78 
79  bool zoneFlip = false;
80 
81  if (zoneID >= 0)
82  {
83  const faceZone& fZone = mesh.faceZones()[zoneID];
84 
85  zoneFlip = fZone.flipMap()[fZone.whichFace(faceID)];
86  }
87 
88  meshMod.setAction
89  (
91  (
92  mesh.faces()[faceID], // face
93  faceID, // face ID
94  mesh.faceOwner()[faceID], // owner
95  -1, // neighbour
96  false, // flip flux
97  patchID, // patch ID
98  false, // remove from zone
99  zoneID, // zone ID
100  zoneFlip // zone flip
101  )
102  );
103 }
104 
105 
106 // Filter out the empty patches.
107 void filterPatches(polyMesh& mesh, const wordHashSet& addedPatchNames)
108 {
110 
111  // Patches to keep
112  DynamicList<polyPatch*> allPatches(patches.size());
113 
114  label nOldPatches = returnReduce(patches.size(), sumOp<label>());
115 
116  // Copy old patches.
117  forAll(patches, patchi)
118  {
119  const polyPatch& pp = patches[patchi];
120 
121  // Note: reduce possible since non-proc patches guaranteed in same order
122  if (!isA<processorPolyPatch>(pp))
123  {
124 
125  // Add if
126  // - non zero size
127  // - or added from the createPatchDict
128  // - or cyclic (since referred to by other cyclic half or
129  // proccyclic)
130 
131  if
132  (
133  addedPatchNames.found(pp.name())
134  || returnReduce(pp.size(), sumOp<label>()) > 0
135  || isA<coupledPolyPatch>(pp)
136  )
137  {
138  allPatches.append
139  (
140  pp.clone
141  (
142  patches,
143  allPatches.size(),
144  pp.size(),
145  pp.start()
146  ).ptr()
147  );
148  }
149  else
150  {
151  Info<< "Removing zero-sized patch " << pp.name()
152  << " type " << pp.type()
153  << " at position " << patchi << endl;
154  }
155  }
156  }
157  // Copy non-empty processor patches
158  forAll(patches, patchi)
159  {
160  const polyPatch& pp = patches[patchi];
161 
162  if (isA<processorPolyPatch>(pp))
163  {
164  if (pp.size())
165  {
166  allPatches.append
167  (
168  pp.clone
169  (
170  patches,
171  allPatches.size(),
172  pp.size(),
173  pp.start()
174  ).ptr()
175  );
176  }
177  else
178  {
179  Info<< "Removing empty processor patch " << pp.name()
180  << " at position " << patchi << endl;
181  }
182  }
183  }
184 
185  label nAllPatches = returnReduce(allPatches.size(), sumOp<label>());
186  if (nAllPatches != nOldPatches)
187  {
188  Info<< "Removing patches." << endl;
189  allPatches.shrink();
191  mesh.addPatches(allPatches);
192  }
193  else
194  {
195  Info<< "No patches removed." << endl;
196  forAll(allPatches, i)
197  {
198  delete allPatches[i];
199  }
200  }
201 }
202 
203 
204 // Dump for all patches the current match
205 void dumpCyclicMatch(const fileName& prefix, const polyMesh& mesh)
206 {
207  for (const polyPatch& pp : mesh.boundaryMesh())
208  {
209  const cyclicPolyPatch* cpp = isA<cyclicPolyPatch>(pp);
210 
211  if (cpp && cpp->owner())
212  {
213  const auto& cycPatch = *cpp;
214  const auto& nbrPatch = cycPatch.neighbPatch();
215 
216  // Dump patches
217  {
218  OFstream str(prefix+cycPatch.name()+".obj");
219  Pout<< "Dumping " << cycPatch.name()
220  << " faces to " << str.name() << endl;
222  (
223  str,
224  cycPatch,
225  cycPatch.points()
226  );
227  }
228 
229  {
230  OFstream str(prefix+nbrPatch.name()+".obj");
231  Pout<< "Dumping " << nbrPatch.name()
232  << " faces to " << str.name() << endl;
234  (
235  str,
236  nbrPatch,
237  nbrPatch.points()
238  );
239  }
240 
241 
242  // Lines between corresponding face centres
243  OFstream str(prefix+cycPatch.name()+nbrPatch.name()+"_match.obj");
244  label vertI = 0;
245 
246  Pout<< "Dumping cyclic match as lines between face centres to "
247  << str.name() << endl;
248 
249  forAll(cycPatch, facei)
250  {
251  const point& fc0 = mesh.faceCentres()[cycPatch.start()+facei];
252  meshTools::writeOBJ(str, fc0);
253  vertI++;
254  const point& fc1 = mesh.faceCentres()[nbrPatch.start()+facei];
255  meshTools::writeOBJ(str, fc1);
256  vertI++;
257 
258  str<< "l " << vertI-1 << ' ' << vertI << nl;
259  }
260  }
261  }
262 }
263 
264 
265 void separateList
266 (
267  const vectorField& separation,
269 )
270 {
271  if (separation.size() == 1)
272  {
273  // Single value for all.
274 
275  forAll(field, i)
276  {
277  field[i] += separation[0];
278  }
279  }
280  else if (separation.size() == field.size())
281  {
282  forAll(field, i)
283  {
284  field[i] += separation[i];
285  }
286  }
287  else
288  {
290  << "Sizes of field and transformation not equal. field:"
291  << field.size() << " transformation:" << separation.size()
292  << abort(FatalError);
293  }
294 }
295 
296 
297 // Synchronise points on both sides of coupled boundaries.
298 template<class CombineOp>
299 void syncPoints
300 (
301  const polyMesh& mesh,
303  const CombineOp& cop,
304  const point& nullValue
305 )
306 {
307  if (points.size() != mesh.nPoints())
308  {
310  << "Number of values " << points.size()
311  << " is not equal to the number of points in the mesh "
312  << mesh.nPoints() << abort(FatalError);
313  }
314 
316 
317  // Is there any coupled patch with transformation?
318  bool hasTransformation = false;
319 
320  if (Pstream::parRun())
321  {
322  const labelList& procPatches = mesh.globalData().processorPatches();
323 
324  // Send
325  for (const label patchi : procPatches)
326  {
327  const polyPatch& pp = patches[patchi];
328  const auto& procPatch = refCast<const processorPolyPatch>(pp);
329 
330  if (pp.nPoints() && procPatch.owner())
331  {
332  // Get data per patchPoint in neighbouring point numbers.
333  pointField patchInfo(procPatch.nPoints(), nullValue);
334 
335  const labelList& meshPts = procPatch.meshPoints();
336  const labelList& nbrPts = procPatch.neighbPoints();
337 
338  forAll(nbrPts, pointi)
339  {
340  label nbrPointi = nbrPts[pointi];
341  if (nbrPointi >= 0 && nbrPointi < patchInfo.size())
342  {
343  patchInfo[nbrPointi] = points[meshPts[pointi]];
344  }
345  }
346 
347  OPstream toNbr
348  (
350  procPatch.neighbProcNo()
351  );
352  toNbr << patchInfo;
353  }
354  }
355 
356 
357  // Receive and set.
358 
359  for (const label patchi : procPatches)
360  {
361  const polyPatch& pp = patches[patchi];
362  const auto& procPatch = refCast<const processorPolyPatch>(pp);
363 
364  if (pp.nPoints() && !procPatch.owner())
365  {
366  pointField nbrPatchInfo(procPatch.nPoints());
367  {
368  // We do not know the number of points on the other side
369  // so cannot use Pstream::read.
370  IPstream fromNbr
371  (
373  procPatch.neighbProcNo()
374  );
375  fromNbr >> nbrPatchInfo;
376  }
377  // Null any value which is not on neighbouring processor
378  nbrPatchInfo.setSize(procPatch.nPoints(), nullValue);
379 
380  if (!procPatch.parallel())
381  {
382  hasTransformation = true;
383  transformList(procPatch.forwardT(), nbrPatchInfo);
384  }
385  else if (procPatch.separated())
386  {
387  hasTransformation = true;
388  separateList(-procPatch.separation(), nbrPatchInfo);
389  }
390 
391  const labelList& meshPts = procPatch.meshPoints();
392 
393  forAll(meshPts, pointi)
394  {
395  label meshPointi = meshPts[pointi];
396  points[meshPointi] = nbrPatchInfo[pointi];
397  }
398  }
399  }
400  }
401 
402  // Do the cyclics.
403  for (const polyPatch& pp : patches)
404  {
405  const cyclicPolyPatch* cpp = isA<cyclicPolyPatch>(pp);
406 
407  if (cpp && cpp->owner())
408  {
409  // Owner does all.
410 
411  const auto& cycPatch = *cpp;
412  const auto& nbrPatch = cycPatch.neighbPatch();
413 
414  const edgeList& coupledPoints = cycPatch.coupledPoints();
415  const labelList& meshPts = cycPatch.meshPoints();
416  const labelList& nbrMeshPts = nbrPatch.meshPoints();
417 
418  pointField half0Values(coupledPoints.size());
419 
420  forAll(coupledPoints, i)
421  {
422  const edge& e = coupledPoints[i];
423  label point0 = meshPts[e[0]];
424  half0Values[i] = points[point0];
425  }
426 
427  if (!cycPatch.parallel())
428  {
429  hasTransformation = true;
430  transformList(cycPatch.reverseT(), half0Values);
431  }
432  else if (cycPatch.separated())
433  {
434  hasTransformation = true;
435  separateList(cycPatch.separation(), half0Values);
436  }
437 
438  forAll(coupledPoints, i)
439  {
440  const edge& e = coupledPoints[i];
441  label point1 = nbrMeshPts[e[1]];
442  points[point1] = half0Values[i];
443  }
444  }
445  }
446 
447  //- Note: hasTransformation is only used for warning messages so
448  // reduction not strictly necessary.
449  //reduce(hasTransformation, orOp<bool>());
450 
451  // Synchronize multiple shared points.
452  const globalMeshData& pd = mesh.globalData();
453 
454  if (pd.nGlobalPoints() > 0)
455  {
456  if (hasTransformation)
457  {
459  << "There are decomposed cyclics in this mesh with"
460  << " transformations." << endl
461  << "This is not supported. The result will be incorrect"
462  << endl;
463  }
464 
465 
466  // Values on shared points.
467  pointField sharedPts(pd.nGlobalPoints(), nullValue);
468 
469  forAll(pd.sharedPointLabels(), i)
470  {
471  label meshPointi = pd.sharedPointLabels()[i];
472  // Fill my entries in the shared points
473  sharedPts[pd.sharedPointAddr()[i]] = points[meshPointi];
474  }
475 
476  // Combine on master.
477  Pstream::listCombineGather(sharedPts, cop);
478  Pstream::listCombineScatter(sharedPts);
479 
480  // Now we will all have the same information. Merge it back with
481  // my local information.
482  forAll(pd.sharedPointLabels(), i)
483  {
484  label meshPointi = pd.sharedPointLabels()[i];
485  points[meshPointi] = sharedPts[pd.sharedPointAddr()[i]];
486  }
487  }
488 }
489 
490 
491 
492 int main(int argc, char *argv[])
493 {
495  (
496  "Create patches out of selected boundary faces, which are either"
497  " from existing patches or from a faceSet"
498  );
499 
500  #include "addOverwriteOption.H"
501  #include "addRegionOption.H"
502  argList::addOption("dict", "file", "Alternative createPatchDict");
504  (
505  "writeObj",
506  "Write obj files showing the cyclic matching process"
507  );
508 
509  argList::noFunctionObjects(); // Never use function objects
510 
511  #include "setRootCase.H"
512  #include "createTime.H"
513 
514  const word meshRegionName =
516 
517  const bool overwrite = args.found("overwrite");
518 
519  #include "createNamedPolyMesh.H"
520 
521  const bool writeObj = args.found("writeObj");
522 
523  const word oldInstance = mesh.pointsInstance();
524 
525  const word dictName("createPatchDict");
526  #include "setSystemMeshDictionaryIO.H"
527  Info<< "Reading " << dictIO.instance()/dictIO.name() << nl << endl;
528 
530 
531  // Whether to synchronise points
532  const bool pointSync(dict.get<bool>("pointSync"));
533 
535 
536  // If running parallel check same patches everywhere
538 
539 
540  if (writeObj)
541  {
542  dumpCyclicMatch("initial_", mesh);
543  }
544 
545  // Read patch construct info from dictionary
546  PtrList<dictionary> patchSources(dict.lookup("patches"));
547 
548  wordHashSet addedPatchNames;
549  for (const dictionary& dict : patchSources)
550  {
551  addedPatchNames.insert(dict.get<word>("name"));
552  }
553 
554 
555  // 1. Add all new patches
556  // ~~~~~~~~~~~~~~~~~~~~~~
557 
558  if (patchSources.size())
559  {
560  // Old and new patches.
561  DynamicList<polyPatch*> allPatches(patches.size()+patchSources.size());
562 
563  label startFacei = mesh.nInternalFaces();
564 
565  // Copy old patches.
566  forAll(patches, patchi)
567  {
568  const polyPatch& pp = patches[patchi];
569 
570  if (!isA<processorPolyPatch>(pp))
571  {
572  allPatches.append
573  (
574  pp.clone
575  (
576  patches,
577  patchi,
578  pp.size(),
579  startFacei
580  ).ptr()
581  );
582  startFacei += pp.size();
583  }
584  }
585 
586  for (const dictionary& dict : patchSources)
587  {
588  const word patchName(dict.get<word>("name"));
589 
590  label destPatchi = patches.findPatchID(patchName);
591 
592  if (destPatchi == -1)
593  {
594  dictionary patchDict(dict.subDict("patchInfo"));
595 
596  destPatchi = allPatches.size();
597 
598  Info<< "Adding new patch " << patchName
599  << " as patch " << destPatchi
600  << " from " << patchDict << endl;
601 
602  patchDict.set("nFaces", 0);
603  patchDict.set("startFace", startFacei);
604 
605  // Add an empty patch.
606  allPatches.append
607  (
609  (
610  patchName,
611  patchDict,
612  destPatchi,
613  patches
614  ).ptr()
615  );
616  }
617  else
618  {
619  Info<< "Patch '" << patchName << "' already exists. Only "
620  << "moving patch faces - type will remain the same" << endl;
621  }
622  }
623 
624  // Copy old patches.
625  forAll(patches, patchi)
626  {
627  const polyPatch& pp = patches[patchi];
628 
629  if (isA<processorPolyPatch>(pp))
630  {
631  allPatches.append
632  (
633  pp.clone
634  (
635  patches,
636  patchi,
637  pp.size(),
638  startFacei
639  ).ptr()
640  );
641  startFacei += pp.size();
642  }
643  }
644 
645  allPatches.shrink();
647  mesh.addPatches(allPatches);
648 
649  Info<< endl;
650  }
651 
652 
653 
654  // 2. Repatch faces
655  // ~~~~~~~~~~~~~~~~
656 
657  polyTopoChange meshMod(mesh);
658 
659  // Mark all repatched faces. This makes sure that the faces to repatch
660  // do not overlap
661  bitSet isRepatchedBoundary(mesh.nBoundaryFaces());
662 
663  for (const dictionary& dict : patchSources)
664  {
665  const word patchName(dict.get<word>("name"));
666  label destPatchi = patches.findPatchID(patchName);
667 
668  if (destPatchi == -1)
669  {
671  << "patch " << patchName << " not added. Problem."
672  << abort(FatalError);
673  }
674 
675  const word sourceType(dict.get<word>("constructFrom"));
676 
677  if (sourceType == "patches")
678  {
679  labelHashSet patchSources
680  (
681  patches.patchSet(dict.get<wordRes>("patches"))
682  );
683 
684  // Repatch faces of the patches.
685  for (const label patchi : patchSources)
686  {
687  const polyPatch& pp = patches[patchi];
688 
689  Info<< "Moving faces from patch " << pp.name()
690  << " to patch " << destPatchi << endl;
691 
692  forAll(pp, i)
693  {
694  changePatchID
695  (
696  mesh,
697  pp.start() + i,
698  destPatchi,
699  meshMod
700  );
701 
702  if (!isRepatchedBoundary.set(pp.offset()+i))
703  {
705  << "Face " << pp.start() + i << " from patch "
706  << pp.name() << " is already marked to be moved"
707  << " to patch " << meshMod.region()[pp.start() + i]
708  << exit(FatalError);
709  }
710  }
711  }
712  }
713  else if (sourceType == "set")
714  {
715  const word setName(dict.get<word>("set"));
716 
717  faceSet set(mesh, setName);
718 
719  Info<< "Read " << returnReduce(set.size(), sumOp<label>())
720  << " faces from faceSet " << set.name() << endl;
721 
722  // Sort (since faceSet contains faces in arbitrary order)
723  labelList faceLabels(set.sortedToc());
724 
725  for (const label facei : faceLabels)
726  {
727  if (mesh.isInternalFace(facei))
728  {
730  << "Face " << facei << " specified in set "
731  << set.name()
732  << " is not an external face of the mesh." << endl
733  << "This application can only repatch existing boundary"
734  << " faces." << exit(FatalError);
735  }
736 
737  if (!isRepatchedBoundary.set(facei-mesh.nInternalFaces()))
738  {
740  << "Face " << facei << " from set "
741  << set.name() << " is already marked to be moved"
742  << " to patch " << meshMod.region()[facei]
743  << exit(FatalError);
744  }
745 
746  changePatchID
747  (
748  mesh,
749  facei,
750  destPatchi,
751  meshMod
752  );
753  }
754  }
755  else
756  {
758  << "Invalid source type " << sourceType << endl
759  << "Valid source types are 'patches' 'set'" << exit(FatalError);
760  }
761  }
762  Info<< endl;
763 
764 
765  // Change mesh, use inflation to reforce calculation of transformation
766  // tensors.
767  Info<< "Doing topology modification to order faces." << nl << endl;
768  autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, true);
769  mesh.movePoints(map().preMotionPoints());
770 
771  if (writeObj)
772  {
773  dumpCyclicMatch("coupled_", mesh);
774  }
775 
776  // Synchronise points.
777  if (!pointSync)
778  {
779  Info<< "Not synchronising points." << nl << endl;
780  }
781  else
782  {
783  Info<< "Synchronising points." << nl << endl;
784 
785  // This is a bit tricky. Both normal and position might be out and
786  // current separation also includes the normal
787  // ( separation_ = (nf&(Cr - Cf))*nf ).
788 
789  // For cyclic patches:
790  // - for separated ones use user specified offset vector
791 
792  forAll(mesh.boundaryMesh(), patchi)
793  {
794  const polyPatch& pp = mesh.boundaryMesh()[patchi];
795 
796  if (pp.size() && isA<coupledPolyPatch>(pp))
797  {
798  const coupledPolyPatch& cpp =
799  refCast<const coupledPolyPatch>(pp);
800 
801  if (cpp.separated())
802  {
803  Info<< "On coupled patch " << pp.name()
804  << " separation[0] was "
805  << cpp.separation()[0] << endl;
806 
807  if (isA<cyclicPolyPatch>(pp) && pp.size())
808  {
809  const cyclicPolyPatch& cycpp =
810  refCast<const cyclicPolyPatch>(pp);
811 
813  {
814  // Force to wanted separation
815  Info<< "On cyclic translation patch " << pp.name()
816  << " forcing uniform separation of "
817  << cycpp.separationVector() << endl;
818  const_cast<vectorField&>(cpp.separation()) =
819  pointField(1, cycpp.separationVector());
820  }
821  else
822  {
823  const cyclicPolyPatch& nbr = cycpp.neighbPatch();
824  const_cast<vectorField&>(cpp.separation()) =
825  pointField
826  (
827  1,
828  nbr[0].centre(mesh.points())
829  - cycpp[0].centre(mesh.points())
830  );
831  }
832  }
833  Info<< "On coupled patch " << pp.name()
834  << " forcing uniform separation of "
835  << cpp.separation() << endl;
836  }
837  else if (!cpp.parallel())
838  {
839  Info<< "On coupled patch " << pp.name()
840  << " forcing uniform rotation of "
841  << cpp.forwardT()[0] << endl;
842 
843  const_cast<tensorField&>
844  (
845  cpp.forwardT()
846  ).setSize(1);
847  const_cast<tensorField&>
848  (
849  cpp.reverseT()
850  ).setSize(1);
851 
852  Info<< "On coupled patch " << pp.name()
853  << " forcing uniform rotation of "
854  << cpp.forwardT() << endl;
855  }
856  }
857  }
858 
859  Info<< "Synchronising points." << endl;
860 
861  pointField newPoints(mesh.points());
862 
863  syncPoints
864  (
865  mesh,
866  newPoints,
868  point(GREAT, GREAT, GREAT)
869  );
870 
871  scalarField diff(mag(newPoints-mesh.points()));
872  Info<< "Points changed by average:" << gAverage(diff)
873  << " max:" << gMax(diff) << nl << endl;
874 
875  mesh.movePoints(newPoints);
876  }
877 
878  // 3. Remove zeros-sized patches
879  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
880 
881  Info<< "Removing patches with no faces in them." << nl<< endl;
882  filterPatches(mesh, addedPatchNames);
883 
884 
885  if (writeObj)
886  {
887  dumpCyclicMatch("final_", mesh);
888  }
889 
890 
891  // Set the precision of the points data to 10
893 
894  if (!overwrite)
895  {
896  ++runTime;
897  }
898  else
899  {
900  mesh.setInstance(oldInstance);
901  }
902 
903  // Write resulting mesh
904  Info<< "Writing repatched mesh to " << runTime.timeName() << nl << endl;
905  mesh.write();
908 
909  Info<< "End\n" << endl;
910 
911  return 0;
912 }
913 
914 
915 // ************************************************************************* //
Foam::polyMesh::addPatches
void addPatches(PtrList< polyPatch > &plist, const bool validBoundary=true)
Definition: polyMesh.C:954
Foam::pointField
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:38
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:50
runTime
engineTime & runTime
Definition: createEngineTime.H:13
wordRes.H
Foam::polyMesh::points
virtual const pointField & points() const
Definition: polyMesh.C:1062
setSize
points setSize(newPointi)
meshTools.H
Foam::coupledPolyPatch::separation
virtual const vectorField & separation() const
Definition: coupledPolyPatch.H:285
Foam::BitOps::set
void set(List< bool > &bools, const labelRange &range)
Definition: BitOps.C:30
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:63
Foam::fileName
A class for handling file names.
Definition: fileName.H:71
Foam::faceZone::flipMap
const boolList & flipMap() const noexcept
Definition: faceZone.H:268
Foam::fvMesh::write
virtual bool write(const bool valid=true) const
Definition: fvMesh.C:1034
Foam::returnReduce
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Definition: PstreamReduceOps.H:88
Foam::bitSet
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:59
Foam::IOPtrList
A PtrList of objects of type <T> with automated input and output.
Definition: IOPtrList.H:49
Foam::polyBoundaryMesh
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
Definition: polyBoundaryMesh.H:59
Foam::polyMesh::defaultRegion
static word defaultRegion
Definition: polyMesh.H:314
cyclicPolyPatch.H
Foam::argList::getOrDefault
T getOrDefault(const word &optName, const T &deflt) const
Definition: argListI.H:300
Foam::cyclicPolyPatch
Cyclic plane patch.
Definition: cyclicPolyPatch.H:62
Foam::DynamicList
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:51
Foam::gAverage
Type gAverage(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:597
Foam::meshTools::writeOBJ
void writeOBJ(Ostream &os, const point &pt)
Definition: meshTools.C:196
Foam::OPstream
Output inter-processor communications stream.
Definition: OPstream.H:49
Foam::cyclicPolyPatch::neighbPatch
const cyclicPolyPatch & neighbPatch() const
Definition: cyclicPolyPatch.H:378
addOverwriteOption.H
Foam::coupledPolyPatch::forwardT
virtual const tensorField & forwardT() const
Definition: coupledPolyPatch.H:297
Foam::fileName::name
static std::string name(const std::string &str)
Definition: fileNameI.H:192
dictName
const word dictName("faMeshDefinition")
polyTopoChange.H
Foam::Time::timeName
static word timeName(const scalar t, const int precision=precision_)
Definition: Time.C:773
Foam::polyTopoChange
Direct mesh changes based on v1.3 polyTopoChange syntax.
Definition: polyTopoChange.H:95
Foam::edge
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:59
Foam::coupledPolyPatch::reverseT
virtual const tensorField & reverseT() const
Definition: coupledPolyPatch.H:303
Foam::argList::addNote
static void addNote(const string &note)
Definition: argList.C:405
Foam::faceSet
A list of face labels.
Definition: faceSet.H:47
Foam::polyPatch::offset
label offset() const
Definition: polyPatch.C:302
Foam::polyModifyFace
Class describing modification of a face.
Definition: polyModifyFace.H:44
Foam::fvMesh::movePoints
virtual tmp< scalarField > movePoints(const pointField &)
Definition: fvMesh.C:858
Foam::polyMesh::boundaryMesh
const polyBoundaryMesh & boundaryMesh() const
Definition: polyMesh.H:440
Foam::defineTemplateTypeNameAndDebug
defineTemplateTypeNameAndDebug(faScalarMatrix, 0)
Foam::endl
Ostream & endl(Ostream &os)
Definition: Ostream.H:381
Foam::coupledPolyPatch
The coupledPolyPatch is an abstract base class for patches that couple regions of the computational d...
Definition: coupledPolyPatch.H:50
Foam::dictionary::get
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:100
Foam::Pout
prefixOSstream Pout
polyMesh.H
Foam::HashSet
A HashTable with keys but without contents that is similar to std::unordered_set.
Definition: HashSet.H:73
processorMeshes.H
syncTools.H
setSystemMeshDictionaryIO.H
createNamedPolyMesh.H
Required Variables.
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:73
Foam::globalMeshData::processorPatches
const labelList & processorPatches() const noexcept
Definition: globalMeshData.H:377
Foam::sumOp
Definition: ops.H:207
Foam::primitiveMesh::nPoints
label nPoints() const noexcept
Definition: primitiveMeshI.H:30
forAll
#define forAll(list, i)
Definition: stdFoam.H:349
OFstream.H
Foam::coupledPolyPatch::parallel
virtual bool parallel() const
Definition: coupledPolyPatch.H:291
Foam::diff
scalar diff(const triad &A, const triad &B)
Definition: triad.C:371
Foam::polyMesh::pointsInstance
const fileName & pointsInstance() const
Definition: polyMesh.C:839
Foam::coupledPolyPatch::separated
virtual bool separated() const
Definition: coupledPolyPatch.H:279
Foam::polyBoundaryMesh::checkParallelSync
bool checkParallelSync(const bool report=false) const
Definition: polyBoundaryMesh.C:965
Foam::transformList
void transformList(const tensor &rotTensor, UList< T > &field)
Definition: transformList.C:45
Foam::argList::noFunctionObjects
static void noFunctionObjects(bool addWithOption=false)
Definition: argList.C:466
Foam::globalMeshData::nGlobalPoints
label nGlobalPoints() const
Definition: globalMeshData.C:1979
Foam::Field
Generic templated field type.
Definition: Field.H:59
Foam::faceZone
A subset of mesh faces organised as a primitive patch.
Definition: faceZone.H:60
IOPtrList.H
Foam::Info
messageStream Info
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:64
Foam::OSstream::name
virtual const fileName & name() const
Definition: OSstream.H:103
argList.H
patchID
label patchID
Definition: boundaryProcessorFaPatchPoints.H:5
Foam::polyMesh::faceOwner
virtual const labelList & faceOwner() const
Definition: polyMesh.C:1100
faceSet.H
Foam::dictionary::subDict
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionary.C:453
addRegionOption.H
Foam::primitiveMesh::nBoundaryFaces
label nBoundaryFaces() const noexcept
Definition: primitiveMeshI.H:77
Foam::polyMesh::faceZones
const faceZoneMesh & faceZones() const noexcept
Definition: polyMesh.H:482
field
rDeltaTY field()
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:55
Foam::polyBoundaryMesh::findPatchID
label findPatchID(const word &patchName, const bool allowNotFound=true) const
Definition: polyBoundaryMesh.C:758
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Definition: hashSets.C:40
Foam::PtrList::append
void append(T *ptr)
Definition: PtrListI.H:106
Foam::polyTopoChange::changeMesh
autoPtr< mapPolyMesh > changeMesh(polyMesh &mesh, const labelUList &patchMap, const bool inflate, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Definition: polyTopoChange.C:2973
Foam::dictionary::lookup
ITstream & lookup(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionary.C:379
Foam::ZoneMesh::whichZone
label whichZone(const label objectIndex) const
Definition: ZoneMesh.C:282
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::PrimitivePatch::nPoints
label nPoints() const
Definition: PrimitivePatch.H:312
Foam::cyclicPolyPatch::owner
virtual bool owner() const
Definition: cyclicPolyPatch.H:368
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:119
Foam::globalMeshData
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
Definition: globalMeshData.H:103
Foam::polyPatch::New
static autoPtr< polyPatch > New(const word &patchType, const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Definition: polyPatchNew.C:28
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
zoneID
const labelIOList & zoneID
Definition: interpolatedFaces.H:22
dictIO
IOobject dictIO
Definition: setConstantMeshDictionaryIO.H:1
Foam
Definition: atmBoundaryLayer.C:26
Foam::faceZone::whichFace
label whichFace(const label globalCellID) const
Definition: faceZone.C:365
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:139
Foam::polyPatch::start
label start() const
Definition: polyPatch.H:357
Foam::coupledPolyPatch::transform
virtual transformType transform() const
Definition: coupledPolyPatch.H:259
polyModifyFace.H
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
Foam::polyMesh::removeBoundary
void removeBoundary()
Definition: polyMeshClear.C:32
Foam::OFstream
Output to file stream, using an OSstream.
Definition: OFstream.H:49
Foam::Pstream::listCombineGather
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
Definition: combineGatherScatter.C:284
Foam::IOobject::name
const word & name() const noexcept
Definition: IOobjectI.H:58
Foam::argList::addBoolOption
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Definition: argList.C:317
Foam::IOstream::defaultPrecision
static unsigned int defaultPrecision() noexcept
Definition: IOstream.H:338
IOdictionary.H
Time.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:49
setRootCase.H
Foam::primitiveMesh::isInternalFace
bool isInternalFace(const label faceIndex) const noexcept
Definition: primitiveMeshI.H:96
Foam::polyMesh::faces
virtual const faceList & faces() const
Definition: polyMesh.C:1087
FatalErrorInFunction
#define FatalErrorInFunction
Definition: error.H:465
Foam::polyTopoChange::setAction
label setAction(const topoAction &action)
Definition: polyTopoChange.C:2474
Foam::nl
constexpr char nl
Definition: Ostream.H:424
Foam::Vector< scalar >
Foam::primitiveMesh::nInternalFaces
label nInternalFaces() const noexcept
Definition: primitiveMeshI.H:71
Foam::UPstream::parRun
static bool & parRun() noexcept
Definition: UPstream.H:429
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:58
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::primitiveMesh::faceCentres
const vectorField & faceCentres() const
Definition: primitiveMeshFaceCentresAndAreas.C:71
Foam::processorMeshes::removeFiles
static void removeFiles(const polyMesh &mesh)
Definition: processorMeshes.C:267
Foam::UList
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:99
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::constant::electromagnetic::e
const dimensionedScalar e
Definition: createFields.H:11
Foam::wordRes
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:47
Foam::polyBoundaryMesh::patchSet
labelHashSet patchSet(const UList< wordRe > &patchNames, const bool warnNotFound=true, const bool useGroups=true) const
Definition: polyBoundaryMesh.C:857
Foam::HashSet::insert
bool insert(const Key &key)
Definition: HashSet.H:191
createTime.H
patches
const polyBoundaryMesh & patches
Definition: convertProcessorPatches.H:59
Foam::IOobject::instance
const fileName & instance() const noexcept
Definition: IOobjectI.H:189
Foam::polyPatch::clone
virtual autoPtr< polyPatch > clone(const labelList &faceCells) const
Definition: polyPatch.H:231
Foam::globalMeshData::sharedPointLabels
const labelList & sharedPointLabels() const
Definition: globalMeshData.C:1989
Foam::globalMeshData::sharedPointAddr
const labelList & sharedPointAddr() const
Definition: globalMeshData.C:1999
Foam::IPstream
Input inter-processor communications stream.
Definition: IPstream.H:49
Foam::patchIdentifier::name
const word & name() const noexcept
Definition: patchIdentifier.H:131
Foam::polyTopoChange::region
const DynamicList< label > & region() const
Definition: polyTopoChange.H:456
Foam::polyMesh::globalData
const globalMeshData & globalData() const
Definition: polyMesh.C:1288
Foam::Pstream::listCombineScatter
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Definition: combineGatherScatter.C:426
Foam::point
vector point
Point is a vector.
Definition: point.H:37
Foam::coupledPolyPatch::TRANSLATIONAL
@ TRANSLATIONAL
Definition: coupledPolyPatch.H:60
Foam::argList::addOption
static void addOption(const word &optName, const string &param="", const string &usage="", bool advanced=false)
Definition: argList.C:328
args
Foam::argList args(argc, argv)
Foam::minMagSqrEqOp
Definition: ops.H:76
Foam::topoSet::removeFiles
static void removeFiles(const polyMesh &)
Definition: topoSet.C:628
WarningInFunction
#define WarningInFunction
Definition: messageStream.H:353
Foam::cyclicPolyPatch::separationVector
const vector & separationVector() const
Definition: cyclicPolyPatch.H:434
Foam::gMax
Type gMax(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:585
Foam::polyMesh::setInstance
void setInstance(const fileName &instance, const IOobject::writeOption wOpt=IOobject::AUTO_WRITE)
Definition: polyMeshIO.C:29
Foam::argList::found
bool found(const word &optName) const
Definition: argListI.H:171
Foam::UPstream::commsTypes::blocking
@ blocking