setSet.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-2018 OpenFOAM Foundation
9  Copyright (C) 2017-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  setSet
29 
30 Group
31  grpMeshManipulationUtilities
32 
33 Description
34  Manipulate a cell/face/point Set or Zone interactively.
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #include "argList.H"
39 #include "Time.H"
40 #include "polyMesh.H"
41 #include "globalMeshData.H"
42 #include "StringStream.H"
43 #include "cellSet.H"
44 #include "faceSet.H"
45 #include "pointSet.H"
46 #include "topoSetSource.H"
47 #include "Fstream.H"
48 #include "foamVtkWriteTopoSet.H"
49 #include "IOobjectList.H"
50 #include "cellZoneSet.H"
51 #include "faceZoneSet.H"
52 #include "pointZoneSet.H"
53 #include "timeSelector.H"
54 
55 #include <stdio.h>
56 
57 #ifdef HAVE_LIBREADLINE
58  #include <readline/readline.h>
59  #include <readline/history.h>
60 
61  static const char* historyFile = ".setSet";
62 #endif
63 
64 using namespace Foam;
65 
66 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
67 
68 
69 // Write set to VTK readable files
70 void writeVTK
71 (
72  const polyMesh& mesh,
73  const topoSet& currSet,
74  const fileName& outputName
75 )
76 {
77  if
78  (
80  (
81  mesh,
82  currSet,
83  vtk::formatType::INLINE_BASE64, // XML-binary
84  // vtk::formatType::LEGACY_BINARY,
85  outputName,
86  false // Not parallel
87  )
88  )
89  {
91  << "Don't know how to handle set of type "
92  << currSet.type() << nl;
93  }
94 }
95 
96 
97 void printHelp(Ostream& os)
98 {
99  os << "Please type 'help', 'list', 'quit', 'time ddd'"
100  << " or a set command after prompt." << nl
101  << "'list' will show all current cell/face/point sets." << nl
102  << "'time ddd' will change the current time." << nl
103  << nl
104  << "A set command should be of the following form" << nl
105  << nl
106  << " cellSet|faceSet|pointSet <setName> <action> <source>"
107  << nl
108  << nl
109  << "The <action> is one of" << nl
110  << " list - prints the contents of the set" << nl
111  << " clear - clears the set" << nl
112  << " invert - inverts the set" << nl
113  << " remove - remove the set" << nl
114  << " new <source> - use all elements from the source set" << nl
115  << " add <source> - adds all elements from the source set" << nl
116  << " subtract <source> - subtract the source set elements" << nl
117  << " subset <source> - combines current set with the source set"
118  << nl
119  << nl
120  << "The sources come in various forms. Type a wrong source"
121  << " to see all the types available." << nl
122  << nl
123  << "Example: pick up all cells connected by point or face to patch"
124  << " movingWall" << nl
125  << nl
126  << "Pick up all faces of patch:" << nl
127  << " faceSet f0 new patchToFace movingWall" << nl
128  << "Add faces 0,1,2:" << nl
129  << " faceSet f0 add labelToFace (0 1 2)" << nl
130  << "Pick up all points used by faces in faceSet f0:" << nl
131  << " pointSet p0 new faceToPoint f0 all" << nl
132  << "Pick up cell which has any face in f0:" << nl
133  << " cellSet c0 new faceToCell f0 any" << nl
134  << "Add cells which have any point in p0:" << nl
135  << " cellSet c0 add pointToCell p0 any" << nl
136  << "List set:" << nl
137  << " cellSet c0 list" << nl
138  << nl
139  << "Zones can be set using zoneSets from corresponding sets:" << nl
140  << " cellZoneSet c0Zone new setToCellZone c0" << nl
141  << " faceZoneSet f0Zone new setToFaceZone f0" << nl
142  << nl
143  << "or if orientation is important:" << nl
144  << " faceZoneSet f0Zone new setsToFaceZone f0 c0" << nl
145  << nl
146  << "ZoneSets can be manipulated using the general actions:" << nl
147  << " list - prints the contents of the set" << nl
148  << " clear - clears the set" << nl
149  << " invert - inverts the set (undefined orientation)"
150  << nl
151  << " remove - remove the set" << nl
152  << endl;
153 }
154 
155 
156 void printAllSets(const polyMesh& mesh, Ostream& os)
157 {
158  IOobjectList objects
159  (
160  mesh,
162  (
163  polyMesh::meshSubDir/"sets",
164  word::null,
167  ),
168  polyMesh::meshSubDir/"sets"
169  );
170  IOobjectList cellSets(objects.lookupClass(cellSet::typeName));
171  if (cellSets.size())
172  {
173  os << "cellSets:" << endl;
174  forAllConstIters(cellSets, iter)
175  {
176  cellSet set(*iter());
177  os << '\t' << set.name() << "\tsize:" << set.size() << endl;
178  }
179  }
180  IOobjectList faceSets(objects.lookupClass(faceSet::typeName));
181  if (faceSets.size())
182  {
183  os << "faceSets:" << endl;
184  forAllConstIters(faceSets, iter)
185  {
186  faceSet set(*iter());
187  os << '\t' << set.name() << "\tsize:" << set.size() << endl;
188  }
189  }
190  IOobjectList pointSets(objects.lookupClass(pointSet::typeName));
191  if (pointSets.size())
192  {
193  os << "pointSets:" << endl;
194  forAllConstIters(pointSets, iter)
195  {
196  pointSet set(*iter());
197  os << '\t' << set.name() << "\tsize:" << set.size() << endl;
198  }
199  }
200 
201  const cellZoneMesh& cellZones = mesh.cellZones();
202  if (cellZones.size())
203  {
204  os << "cellZones:" << endl;
205  for (const cellZone& zone : cellZones)
206  {
207  os << '\t' << zone.name() << "\tsize:" << zone.size() << endl;
208  }
209  }
210  const faceZoneMesh& faceZones = mesh.faceZones();
211  if (faceZones.size())
212  {
213  os << "faceZones:" << endl;
214  for (const faceZone& zone : faceZones)
215  {
216  os << '\t' << zone.name() << "\tsize:" << zone.size() << endl;
217  }
218  }
219  const pointZoneMesh& pointZones = mesh.pointZones();
220  if (pointZones.size())
221  {
222  os << "pointZones:" << endl;
223  for (const pointZone& zone : pointZones)
224  {
225  os << '\t' << zone.name() << "\tsize:" << zone.size() << endl;
226  }
227  }
228 
229  os << endl;
230 }
231 
232 
233 template<class ZoneType>
234 void removeZone
235 (
237  const word& setName
238 )
239 {
240  label zoneID = zones.findZoneID(setName);
241 
242  if (zoneID != -1)
243  {
244  Info<< "Removing zone " << setName << " at index " << zoneID << endl;
245  // Shuffle to last position
246  labelList oldToNew(zones.size());
247  label newI = 0;
248  forAll(oldToNew, i)
249  {
250  if (i != zoneID)
251  {
252  oldToNew[i] = newI++;
253  }
254  }
255  oldToNew[zoneID] = newI;
256  zones.reorder(oldToNew);
257  // Remove last element
258  zones.setSize(zones.size()-1);
259  zones.clearAddressing();
260  if (!zones.write())
261  {
262  WarningInFunction << "Failed writing zone " << setName << endl;
263  }
264  zones.write();
265  // Force flushing so we know it has finished writing
266  fileHandler().flush();
267  }
268 }
269 
270 
271 // Physically remove a set
272 void removeSet
273 (
274  const polyMesh& mesh,
275  const word& setType,
276  const word& setName
277 )
278 {
279  // Remove the file
280  IOobjectList objects
281  (
282  mesh,
284  (
285  polyMesh::meshSubDir/"sets",
286  word::null,
289  ),
290  polyMesh::meshSubDir/"sets"
291  );
292 
293  if (objects.found(setName))
294  {
295  // Remove file
296  fileName object = objects[setName]->objectPath();
297  Info<< "Removing file " << object << endl;
298  rm(object);
299  }
300 
301  // See if zone
302  if (setType == cellZoneSet::typeName)
303  {
304  removeZone
305  (
306  const_cast<cellZoneMesh&>(mesh.cellZones()),
307  setName
308  );
309  }
310  else if (setType == faceZoneSet::typeName)
311  {
312  removeZone
313  (
314  const_cast<faceZoneMesh&>(mesh.faceZones()),
315  setName
316  );
317  }
318  else if (setType == pointZoneSet::typeName)
319  {
320  removeZone
321  (
322  const_cast<pointZoneMesh&>(mesh.pointZones()),
323  setName
324  );
325  }
326 }
327 
328 
329 // Read command and execute. Return true if ok, false otherwise.
330 bool doCommand
331 (
332  const polyMesh& mesh,
333  const word& setType,
334  const word& setName,
335  const word& actionName,
336  const bool writeVTKFile,
337  const bool writeCurrentTime,
338  const bool noSync,
339  Istream& is
340 )
341 {
342  // Get some size estimate for set.
343  const globalMeshData& parData = mesh.globalData();
344 
345  label typSize =
346  max
347  (
348  parData.nTotalCells(),
349  max
350  (
351  parData.nTotalFaces(),
352  parData.nTotalPoints()
353  )
354  )
355  / (10*Pstream::nProcs());
356 
357 
358  bool ok = true;
359 
360  // Set to work on
361  autoPtr<topoSet> currentSetPtr;
362 
363  word sourceType;
364 
365  try
366  {
367  topoSetSource::setAction action =
368  topoSetSource::actionNames[actionName];
369 
370 
372 
373  if (action == topoSetSource::REMOVE)
374  {
375  removeSet(mesh, setType, setName);
376  }
377  else if
378  (
379  (action == topoSetSource::NEW)
380  || (action == topoSetSource::CLEAR)
381  )
382  {
383  r = IOobject::NO_READ;
384  currentSetPtr = topoSet::New(setType, mesh, setName, typSize);
385  }
386  else
387  {
389  currentSetPtr = topoSet::New(setType, mesh, setName, r);
390  topoSet& currentSet = currentSetPtr();
391  // Presize it according to current mesh data.
392  currentSet.resize(max(currentSet.size(), typSize));
393  }
394 
395  if (currentSetPtr)
396  {
397  topoSet& currentSet = *currentSetPtr;
398 
399  Info<< " Set:" << currentSet.name()
400  << " Size:" << returnReduce(currentSet.size(), sumOp<label>())
401  << " Action:" << actionName
402  << endl;
403 
404  switch (action)
405  {
407  {
408  // Already handled above by not reading
409  break;
410  }
412  {
413  currentSet.invert(currentSet.maxSize(mesh));
414  break;
415  }
416  case topoSetSource::LIST:
417  {
418  currentSet.writeDebug(Pout, mesh, 100);
419  Pout<< endl;
420  break;
421  }
423  {
424  if (is >> sourceType)
425  {
426  autoPtr<topoSetSource> setSource
427  (
429  (
430  sourceType,
431  mesh,
432  is
433  )
434  );
435 
436  // Backup current set.
437  autoPtr<topoSet> oldSet
438  (
440  (
441  setType,
442  mesh,
443  currentSet.name() + "_old2",
444  currentSet
445  )
446  );
447 
448  currentSet.clear();
449  setSource().applyToSet(topoSetSource::NEW, currentSet);
450 
451  // Combine new value of currentSet with old one.
452  currentSet.subset(oldSet());
453  }
454  break;
455  }
456  default:
457  {
458  if (is >> sourceType)
459  {
460  autoPtr<topoSetSource> setSource
461  (
463  (
464  sourceType,
465  mesh,
466  is
467  )
468  );
469 
470  setSource().applyToSet(action, currentSet);
471  }
472  }
473  }
474 
475 
476  if (action != topoSetSource::LIST)
477  {
478  // Set will have been modified.
479 
480  // Synchronize for coupled patches.
481  if (!noSync) currentSet.sync(mesh);
482 
483  // Write
484  Info<< " Writing " << currentSet.name()
485  << " (size "
486  << returnReduce(currentSet.size(), sumOp<label>())
487  << ") to "
488  << (
489  currentSet.instance()/currentSet.local()
490  / currentSet.name()
491  );
492 
493 
494  if (writeVTKFile)
495  {
497  (
498  mesh.time().path()/"VTK"/currentSet.name()
499  / currentSet.name() + "_"
501  );
502  mkDir(outputName.path());
503 
504  Info<< " and to vtk file "
505  << outputName.relative(mesh.time().path())
506  << nl << nl;
507 
508  writeVTK(mesh, currentSet, outputName);
509  }
510  else
511  {
512  Info<< nl << nl;
513  }
514 
515  if (writeCurrentTime)
516  {
517  currentSet.instance() = mesh.time().timeName();
518  }
519  if (!currentSet.write())
520  {
522  << "Failed writing set "
523  << currentSet.objectPath() << endl;
524  }
525  // Make sure writing is finished
526  fileHandler().flush();
527  }
528  }
529  }
530  catch (const Foam::IOerror& fIOErr)
531  {
532  ok = false;
533 
534  Pout<< fIOErr.message().c_str() << endl;
535 
536  if (sourceType.size())
537  {
538  Pout<< topoSetSource::usage(sourceType).c_str();
539  }
540  }
541  catch (const Foam::error& fErr)
542  {
543  ok = false;
544 
545  Pout<< fErr.message().c_str() << endl;
546 
547  if (sourceType.size())
548  {
549  Pout<< topoSetSource::usage(sourceType).c_str();
550  }
551  }
552 
553  return ok;
554 }
555 
556 
557 // Status returned from parsing the first token of the line
558 enum commandStatus
559 {
560  QUIT, // quit program
561  INVALID, // token is not a valid set manipulation command
562  VALIDSETCMD, // ,, is a valid ,,
563  VALIDZONECMD // ,, is a valid zone ,,
564 };
565 
566 
567 void printMesh(const Time& runTime, const polyMesh& mesh)
568 {
569  Info<< "Time:" << runTime.timeName()
570  << " cells:" << mesh.globalData().nTotalCells()
571  << " faces:" << mesh.globalData().nTotalFaces()
572  << " points:" << mesh.globalData().nTotalPoints()
573  << " patches:" << mesh.boundaryMesh().size()
574  << " bb:" << mesh.bounds() << nl;
575 }
576 
577 
578 polyMesh::readUpdateState meshReadUpdate(polyMesh& mesh)
579 {
581 
582  switch(stat)
583  {
584  case polyMesh::UNCHANGED:
585  {
586  Info<< " mesh not changed." << endl;
587  break;
588  }
590  {
591  Info<< " points moved; topology unchanged." << endl;
592  break;
593  }
595  {
596  Info<< " topology changed; patches unchanged." << nl
597  << " ";
598  printMesh(mesh.time(), mesh);
599  break;
600  }
602  {
603  Info<< " topology changed and patches changed." << nl
604  << " ";
605  printMesh(mesh.time(), mesh);
606 
607  break;
608  }
609  default:
610  {
612  << "Illegal mesh update state "
613  << stat << abort(FatalError);
614  break;
615  }
616  }
617  return stat;
618 }
619 
620 
621 commandStatus parseType
622 (
623  Time& runTime,
624  polyMesh& mesh,
625  const word& setType,
626  IStringStream& is
627 )
628 {
629  if (setType.empty())
630  {
631  Info<< "Type 'help' for usage information" << endl;
632 
633  return INVALID;
634  }
635  else if (setType == "help")
636  {
637  printHelp(Info);
638 
639  return INVALID;
640  }
641  else if (setType == "list")
642  {
643  printAllSets(mesh, Info);
644 
645  return INVALID;
646  }
647  else if (setType == "time")
648  {
649  scalar requestedTime = readScalar(is);
650  instantList Times = runTime.times();
651 
652  label nearestIndex = Time::findClosestTimeIndex(Times, requestedTime);
653 
654  Info<< "Changing time from " << runTime.timeName()
655  << " to " << Times[nearestIndex].name()
656  << endl;
657 
658  // Set time
659  runTime.setTime(Times[nearestIndex], nearestIndex);
660  // Optionally re-read mesh
661  meshReadUpdate(mesh);
662 
663  return INVALID;
664  }
665  else if (setType == "quit")
666  {
667  Info<< "Quitting ..." << endl;
668 
669  return QUIT;
670  }
671  else if
672  (
673  setType == "cellSet"
674  || setType == "faceSet"
675  || setType == "pointSet"
676  )
677  {
678  return VALIDSETCMD;
679  }
680  else if
681  (
682  setType == "cellZoneSet"
683  || setType == "faceZoneSet"
684  || setType == "pointZoneSet"
685  )
686  {
687  return VALIDZONECMD;
688  }
689  else
690  {
692  << "Illegal command " << setType << endl
693  << "Should be one of 'help', 'list', 'time' or a set type :"
694  << " 'cellSet', 'faceSet', 'pointSet', 'faceZoneSet'"
695  << endl;
696 
697  return INVALID;
698  }
699 }
700 
701 
702 commandStatus parseAction(const word& actionName)
703 {
704  return
705  (
706  actionName.size() && topoSetSource::actionNames.found(actionName)
707  ? VALIDSETCMD : INVALID
708  );
709 }
710 
711 
712 
713 int main(int argc, char *argv[])
714 {
716  (
717  "Manipulate a cell/face/point Set or Zone interactively."
718  );
719 
720  // Specific to topoSet/setSet: quite often we want to block upon writing
721  // a set so we can immediately re-read it. So avoid use of threading
722  // for set writing.
723 
724  timeSelector::addOptions(true, false); // constant(true), zero(false)
725 
726  #include "addRegionOption.H"
727  argList::addBoolOption("noVTK", "Do not write VTK files");
728  argList::addBoolOption("loop", "Execute batch commands for all timesteps");
730  (
731  "batch",
732  "file",
733  "Process in batch mode, using input from specified file"
734  );
736  (
737  "noSync",
738  "Do not synchronise selection across coupled patches"
739  );
740 
741  #include "setRootCase.H"
742  #include "createTime.H"
744 
745  const bool writeVTK = !args.found("noVTK");
746  const bool loop = args.found("loop");
747  const bool batch = args.found("batch");
748  const bool noSync = args.found("noSync");
749 
750  if (loop && !batch)
751  {
753  << "Can only loop in batch mode."
754  << exit(FatalError);
755  }
756 
757 
758  #include "createNamedPolyMesh.H"
759 
760  // Print some mesh info
761  printMesh(runTime, mesh);
762 
763  // Print current sets
764  printAllSets(mesh, Info);
765 
766  // Read history if interactive
767  #ifdef HAVE_LIBREADLINE
768  if (!batch && !read_history((runTime.path()/historyFile).c_str()))
769  {
770  Info<< "Successfully read history from " << historyFile << endl;
771  }
772  #endif
773 
774 
775  // Exit status
776  int status = 0;
777 
778 
779  forAll(timeDirs, timeI)
780  {
781  runTime.setTime(timeDirs[timeI], timeI);
782  Info<< "Time = " << runTime.timeName() << endl;
783 
784  // Handle geometry/topology changes
785  meshReadUpdate(mesh);
786 
787 
788  // Main command read & execute loop
789  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
790 
791  autoPtr<IFstream> fileStreamPtr;
792 
793  if (batch)
794  {
795  const auto batchFile = args.get<fileName>("batch");
796 
797  Info<< "Reading commands from file " << batchFile << endl;
798 
799  // we cannot handle .gz files
800  if (!isFile(batchFile, false))
801  {
803  << "Cannot open file " << batchFile << exit(FatalError);
804  }
805 
806  fileStreamPtr.reset(new IFstream(batchFile));
807  }
808 
809  Info<< "Please type 'help', 'quit' or a set command after prompt."
810  << endl;
811 
812  // Whether to quit
813  bool quit = false;
814 
815  FatalError.throwing(true);
816  FatalIOError.throwing(true);
817 
818  do
819  {
820  string rawLine;
821 
822  // Type: cellSet, faceSet, pointSet
823  word setType;
824  // Name of destination set.
825  word setName;
826  // Action (new, invert etc.)
827  word actionName;
828 
829  commandStatus stat = INVALID;
830 
831  if (fileStreamPtr)
832  {
833  if (!fileStreamPtr->good())
834  {
835  Info<< "End of batch file" << endl;
836  // No error.
837  break;
838  }
839 
840  fileStreamPtr().getLine(rawLine);
841 
842  if (rawLine.size())
843  {
844  Info<< "Doing:" << rawLine << endl;
845  }
846  }
847  else
848  {
849  #ifdef HAVE_LIBREADLINE
850  {
851  char* linePtr = readline("readline>");
852 
853  if (linePtr)
854  {
855  rawLine = string(linePtr);
856 
857  if (*linePtr)
858  {
859  add_history(linePtr);
860  write_history(historyFile);
861  }
862 
863  free(linePtr); // readline uses malloc, not new.
864  }
865  else
866  {
867  break;
868  }
869  }
870  #else
871  {
872  if (!std::cin.good())
873  {
874  Info<< "End of cin" << endl;
875  // No error.
876  break;
877  }
878  Info<< "Command>" << flush;
879  std::getline(std::cin, rawLine);
880  }
881  #endif
882  }
883 
884  // Strip off anything after #
885  string::size_type i = rawLine.find('#');
886  if (i != string::npos)
887  {
888  rawLine.resize(i);
889  }
890 
891  if (rawLine.empty())
892  {
893  continue;
894  }
895 
896  IStringStream is(rawLine + ' ');
897 
898  // Type: cellSet, faceSet, pointSet, faceZoneSet
899  is >> setType;
900 
901  stat = parseType(runTime, mesh, setType, is);
902 
903  if (stat == VALIDSETCMD || stat == VALIDZONECMD)
904  {
905  if (is >> setName)
906  {
907  if (is >> actionName)
908  {
909  stat = parseAction(actionName);
910  }
911  }
912  }
913 
914  if (stat == QUIT)
915  {
916  // Make sure to quit
917  quit = true;
918  }
919  else if (stat == VALIDSETCMD || stat == VALIDZONECMD)
920  {
921  bool ok = doCommand
922  (
923  mesh,
924  setType,
925  setName,
926  actionName,
927  writeVTK,
928  loop, // if in looping mode dump sets to time directory
929  noSync,
930  is
931  );
932 
933  if (!ok && batch)
934  {
935  // Exit with error.
936  quit = true;
937  status = 1;
938  }
939  }
940 
941  } while (!quit);
942 
943  if (quit)
944  {
945  break;
946  }
947  }
948 
949  Info<< "End\n" << endl;
950 
951  return status;
952 }
953 
954 
955 // ************************************************************************* //
Foam::topoSet::writeDebug
void writeDebug(Ostream &os, const label maxElem, topoSet::const_iterator &iter, label &elemI) const
Definition: topoSet.C:217
Foam::TimePaths::findClosestTimeIndex
static label findClosestTimeIndex(const instantList &timeDirs, const scalar t, const word &constantName="constant")
Definition: TimePaths.C:149
runTime
engineTime & runTime
Definition: createEngineTime.H:13
Foam::expressions::valueTypeCode::INVALID
@ INVALID
Invalid/unknown/error type.
Foam::BitOps::set
void set(List< bool > &bools, const labelRange &range)
Definition: BitOps.C:30
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:69
Foam::topoSetSource::CLEAR
@ CLEAR
Clear the set, possibly creating it.
Definition: topoSetSource.H:106
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::Enum::found
bool found(const word &enumName) const
Definition: EnumI.H:96
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::polyMesh::POINTS_MOVED
@ POINTS_MOVED
Definition: polyMesh.H:89
Foam::IFstream
Input from file stream, using an ISstream.
Definition: IFstream.H:49
faceZoneSet.H
globalMeshData.H
Foam::pointZone
A subset of mesh points.
Definition: pointZone.H:61
Foam::topoSetSource::usage
static const string & usage(const word &name)
Definition: topoSetSource.H:284
Foam::polyMesh::meshSubDir
static word meshSubDir
Definition: polyMesh.H:317
Foam::Time::timeName
static word timeName(const scalar t, const int precision=precision_)
Definition: Time.C:773
Foam::fileOperation::flush
virtual void flush() const
Definition: fileOperation.C:1233
Foam::zone
Base class for mesh zones.
Definition: zone.H:59
Foam::error::throwing
bool throwing() const noexcept
Definition: error.H:165
Foam::argList::addNote
static void addNote(const string &note)
Definition: argList.C:405
Foam::polyMesh::facesInstance
const fileName & facesInstance() const
Definition: polyMesh.C:845
Foam::faceSet
A list of face labels.
Definition: faceSet.H:47
Foam::topoSet::subset
virtual void subset(const topoSet &set)
Definition: topoSet.C:552
Foam::isFile
bool isFile(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Definition: POSIX.C:792
StringStream.H
Input/output from string buffers.
Foam::rm
bool rm(const fileName &file)
Definition: POSIX.C:1282
Foam::fileHandler
const fileOperation & fileHandler()
Definition: fileOperation.C:1478
Foam::FatalIOError
IOerror FatalIOError
IOobjectList.H
Foam::polyMesh::boundaryMesh
const polyBoundaryMesh & boundaryMesh() const
Definition: polyMesh.H:440
Foam::endl
Ostream & endl(Ostream &os)
Definition: Ostream.H:381
Foam::topoSetSource::setAction
setAction
Definition: topoSetSource.H:96
Foam::string
A class for handling character strings derived from std::string.
Definition: string.H:72
Foam::topoSet::New
static autoPtr< topoSet > New(const word &setType, const polyMesh &mesh, const word &name, readOption r=MUST_READ, writeOption w=NO_WRITE)
Definition: topoSet.C:48
Foam::topoSetSource::NEW
@ NEW
Create a new set and ADD elements to it.
Definition: topoSetSource.H:100
Foam::Pout
prefixOSstream Pout
polyMesh.H
Foam::argList::get
T get(const label index) const
Definition: argListI.H:271
Foam::topoSet::invert
virtual void invert(const label maxLen)
Definition: topoSet.C:531
createNamedPolyMesh.H
Required Variables.
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:73
Foam::sumOp
Definition: ops.H:207
forAll
#define forAll(list, i)
Definition: stdFoam.H:349
Foam::writeVTK
void writeVTK(OFstream &os, const Type &value)
Foam::cellZone
A subset of mesh cells.
Definition: cellZone.H:58
Foam::fvMesh::readUpdate
virtual readUpdateState readUpdate()
Definition: fvMesh.C:641
outputName
word outputName("finiteArea-edges.obj")
Foam::polyMesh::TOPO_PATCH_CHANGE
@ TOPO_PATCH_CHANGE
Definition: polyMesh.H:91
Foam::flush
Ostream & flush(Ostream &os)
Definition: Ostream.H:371
Foam::TimeState::timeIndex
label timeIndex() const noexcept
Definition: TimeStateI.H:30
Foam::vtk::writeTopoSet
bool writeTopoSet(const polyMesh &mesh, const topoSet &set, const vtk::outputOptions opts, const fileName &file, bool parallel=Pstream::parRun())
Definition: foamVtkWriteTopoSet.C:31
Foam::regIOobject::write
virtual bool write(const bool valid=true) const
Definition: regIOobjectWrite.C:125
Foam::faceZone
A subset of mesh faces organised as a primitive patch.
Definition: faceZone.H:60
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::Info
messageStream Info
Foam::IOobject::local
const fileName & local() const noexcept
Definition: IOobjectI.H:201
Foam::polyMesh::cellZones
const cellZoneMesh & cellZones() const noexcept
Definition: polyMesh.H:488
argList.H
faceSet.H
Foam::IOobject::READ_IF_PRESENT
@ READ_IF_PRESENT
Definition: IOobject.H:183
Foam::TimePaths::times
instantList times() const
Definition: TimePaths.C:142
SeriousErrorInFunction
#define SeriousErrorInFunction
Definition: messageStream.H:319
addRegionOption.H
Foam::ZoneMesh< cellZone, polyMesh >
Foam::polyMesh::UNCHANGED
@ UNCHANGED
Definition: polyMesh.H:88
Foam::polyMesh::faceZones
const faceZoneMesh & faceZones() const noexcept
Definition: polyMesh.H:482
Foam::autoPtr::good
bool good() const noexcept
Definition: autoPtr.H:141
size_type
graph_traits< Graph >::vertices_size_type size_type
Definition: SloanRenumber.C:69
Foam::polyMesh::TOPO_CHANGE
@ TOPO_CHANGE
Definition: polyMesh.H:90
Foam::topoSet
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:59
Foam::topoSet::maxSize
virtual label maxSize(const polyMesh &mesh) const =0
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Definition: hashSets.C:40
Foam::topoSetSource::SUBSET
@ SUBSET
Union of elements with current set.
Definition: topoSetSource.H:104
Foam::FatalError
error FatalError
Foam::globalMeshData
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
Definition: globalMeshData.H:103
os
OBJstream os(runTime.globalPath()/outputName)
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::vtk::formatType::INLINE_BASE64
@ INLINE_BASE64
XML inline base64, base64Formatter.
zoneID
const labelIOList & zoneID
Definition: interpolatedFaces.H:22
Foam::globalMeshData::nTotalPoints
label nTotalPoints() const noexcept
Definition: globalMeshData.H:354
Foam::topoSetSource::New
static autoPtr< topoSetSource > New(const word &topoSetSourceType, const polyMesh &mesh, const dictionary &dict)
Definition: topoSetSource.C:103
Foam::error::message
string message() const
Definition: error.C:312
Foam::IStringStream
Definition: StringStream.H:108
Foam
Definition: atmBoundaryLayer.C:26
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:139
Foam::cellSet
A collection of cell labels.
Definition: cellSet.H:47
Foam::ZoneMesh::findZoneID
label findZoneID(const word &zoneName) const
Definition: ZoneMesh.C:512
Foam::IOobjectList
List of IOobjects with searching and retrieving facilities.
Definition: IOobjectList.H:51
Foam::Time::findInstance
word findInstance(const fileName &dir, const word &name=word::null, const IOobject::readOption rOpt=IOobject::MUST_READ, const word &stopInstance=word::null) const
Definition: Time.C:790
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
Foam::polyMesh::readUpdateState
readUpdateState
Definition: polyMesh.H:86
Foam::polyMesh::bounds
const boundBox & bounds() const
Definition: polyMesh.H:446
Foam::autoPtr::reset
void reset(autoPtr< T > &&other) noexcept
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
Time.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:49
setRootCase.H
FatalErrorInFunction
#define FatalErrorInFunction
Definition: error.H:465
Foam::topoSetSource::LIST
@ LIST
Print contents of the set.
Definition: topoSetSource.H:108
Foam::nl
constexpr char nl
Definition: Ostream.H:424
Foam::Time::path
fileName path() const
Definition: Time.H:354
forAllConstIters
forAllConstIters(mixture.phases(), phase)
Definition: pEqn.H:28
Foam::pointSet
A set of point labels.
Definition: pointSet.H:47
Fstream.H
Foam::zoneIdentifier::name
const word & name() const noexcept
Definition: zoneIdentifier.H:119
Foam::timeSelector::addOptions
static void addOptions(const bool constant=true, const bool withZero=false)
Definition: timeSelector.C:95
cellZoneSet.H
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::Time::setTime
virtual void setTime(const Time &t)
Definition: Time.C:996
topoSetSource.H
Foam::topoSetSource::REMOVE
@ REMOVE
Remove the set (from the file system)
Definition: topoSetSource.H:107
Foam::word::null
static const word null
Definition: word.H:78
timeSelector.H
Foam::polyMesh::pointZones
const pointZoneMesh & pointZones() const noexcept
Definition: polyMesh.H:476
createTime.H
Foam::IOobject::instance
const fileName & instance() const noexcept
Definition: IOobjectI.H:189
Foam::topoSetSource::INVERT
@ INVERT
Invert the elements in the current set.
Definition: topoSetSource.H:105
Foam::name
word name(const expressions::valueTypeCode typeCode)
Definition: exprTraits.C:52
Foam::fvMesh::time
const Time & time() const
Definition: fvMesh.H:276
Foam::IOerror
Definition: error.H:277
Foam::globalMeshData::nTotalCells
label nTotalCells() const noexcept
Definition: globalMeshData.H:367
foamVtkWriteTopoSet.H
Write topoSet in VTK format.
cellSet.H
Foam::IOobject::readOption
readOption
Definition: IOobject.H:179
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:52
Foam::ZoneMesh::clearAddressing
void clearAddressing()
Definition: ZoneMesh.C:702
Foam::polyMesh::globalData
const globalMeshData & globalData() const
Definition: polyMesh.C:1288
Foam::topoSet::sync
virtual void sync(const polyMesh &mesh)
Definition: topoSet.C:579
Foam::IOobject::objectPath
fileName objectPath() const
Definition: IOobjectI.H:207
Foam::timeSelector::select0
static instantList select0(Time &runTime, const argList &args)
Definition: timeSelector.C:228
Foam::argList::addOption
static void addOption(const word &optName, const string &param="", const string &usage="", bool advanced=false)
Definition: argList.C:328
Foam::IOobject::NO_READ
@ NO_READ
Definition: IOobject.H:184
args
Foam::argList args(argc, argv)
Foam::mkDir
bool mkDir(const fileName &pathName, mode_t mode=0777)
Definition: POSIX.C:533
WarningInFunction
#define WarningInFunction
Definition: messageStream.H:353
Foam::error
Class to handle errors and exceptions in a simple, consistent stream-based manner.
Definition: error.H:69
Foam::UPstream::nProcs
static label nProcs(const label communicator=worldComm)
Definition: UPstream.H:441
pointZoneSet.H
Foam::globalMeshData::nTotalFaces
label nTotalFaces() const noexcept
Definition: globalMeshData.H:361
Foam::argList::found
bool found(const word &optName) const
Definition: argListI.H:171
Foam::IOobject::MUST_READ
@ MUST_READ
Definition: IOobject.H:181
Foam::topoSetSource::actionNames
static const Enum< setAction > actionNames
Definition: topoSetSource.H:114
pointSet.H