foamToVTK.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-2016 OpenFOAM Foundation
9  Copyright (C) 2016-2023 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  foamToVTK
29 
30 Group
31  grpPostProcessingUtilities
32 
33 Description
34  General OpenFOAM to VTK file writer.
35 
36  Other bits
37  - Handles volFields, pointFields, surfaceScalarField, surfaceVectorField
38  fields.
39  - Mesh topo changes.
40  - Output legacy or xml VTK format in ascii or binary.
41  - Single time step writing.
42  - Write subset only.
43  - Optional decomposition of cells.
44 
45 Usage
46  \b foamToVTK [OPTION]
47 
48  Options:
49  - \par -ascii
50  Write VTK data in ASCII format instead of binary.
51 
52  - \par -legacy
53  Write VTK data in legacy format instead of XML format
54 
55  - \par -fields <fields>
56  Specify single or multiple fields to write (all by default)
57  For example,
58  \verbatim
59  -fields T
60  -fields '(p T U \"alpha.*\")'
61  \endverbatim
62  The quoting is required to avoid shell expansions and to pass the
63  information as a single argument.
64 
65  - \par -surfaceFields
66  Write surfaceScalarFields (e.g., phi)
67 
68  - \par -cellSet <name>
69  - \par -cellZone <name>
70  Restrict conversion to either the cellSet or the cellZone.
71 
72  - \par -faceSet <name>
73  - \par -pointSet <name>
74  Restrict conversion to the faceSet or pointSet.
75 
76  - \par -faceZones zone or zone list
77  Specify single faceZone or or multiple faceZones (name or regex)
78  to write
79 
80  - \par -nearCellValue
81  Output cell value on patches instead of patch value itself
82 
83  - \par -no-boundary
84  Suppress output for all boundary patches
85 
86  - \par -no-internal
87  Suppress output for internal (volume) mesh
88 
89  - \par -no-lagrangian
90  Suppress writing Lagrangian positions and fields.
91 
92  - \par -no-point-data
93  Suppress conversion of pointFields. No interpolated PointData.
94 
95  - \par -with-ids
96  Additional mesh id fields (cellID, procID, patchID)
97 
98  - \par -with-point-ids
99  Additional pointID field for internal mesh
100 
101  - \par -poly-decomp
102  Decompose polyhedral cells into tets/pyramids
103 
104  - \par -one-boundary
105  Combine all patches into a single boundary file
106 
107  - \par -patches NAME | LIST
108  Specify single patch or multiple patches (name or regex) to write
109  For example,
110  \verbatim
111  -patches top
112  -patches '( front \".*back\" )'
113  \endverbatim
114 
115  - \par -exclude-patches NAME | LIST
116  Exclude single or multiple patches (name or regex) from writing.
117  For example,
118  \verbatim
119  -exclude-patches '( inlet_1 inlet_2 "proc.*")'
120  \endverbatim
121 
122 Note
123  The mesh subset is handled by fvMeshSubsetProxy. Slight inconsistency in
124  interpolation: on the internal field it interpolates the whole volField
125  to the whole-mesh pointField and then selects only those values it
126  needs for the subMesh (using the fvMeshSubset cellMap(), pointMap()
127  functions). For the patches however it uses the
128  fvMeshSubset.interpolate function to directly interpolate the
129  whole-mesh values onto the subset patch.
130 
131 \*---------------------------------------------------------------------------*/
132 
133 #include "fvCFD.H"
134 #include "pointMesh.H"
135 #include "emptyPolyPatch.H"
136 #include "volPointInterpolation.H"
137 #include "faceZoneMesh.H"
138 #include "areaFields.H"
139 #include "fvMeshSubsetProxy.H"
140 #include "faceSet.H"
141 #include "pointSet.H"
142 #include "HashOps.H"
143 #include "regionProperties.H"
144 #include "stringListOps.H" // For stringListOps::findMatching()
145 
146 #include "Cloud.H"
147 #include "readFields.H"
148 #include "reportFields.H"
149 
150 #include "foamVtmWriter.H"
151 #include "foamVtkInternalWriter.H"
152 #include "foamVtkPatchWriter.H"
154 #include "foamVtkLagrangianWriter.H"
156 #include "foamVtkWriteTopoSet.H"
157 #include "foamVtkSeriesWriter.H"
158 
159 #include "writeAreaFields.H"
160 #include "writeDimFields.H"
161 #include "writeVolFields.H"
162 #include "writePointFields.H"
163 #include "writeSurfaceFields.H"
164 
165 #include "memInfo.H"
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 labelList getSelectedPatches
170 (
171  const polyBoundaryMesh& patches,
172  const autoPtr<wordRes::filter>& patchSelector
173 )
174 {
175  labelList indices;
176 
177  if (patchSelector && !patchSelector().empty())
178  {
179  // Name-based selection
180  indices =
181  (
183  (
184  patches,
185  patchSelector(),
186  nameOp<polyPatch>()
187  )
188  );
189  }
190  else
191  {
192  indices = identity(patches.size());
193  }
194 
195  // Remove undesirable patches
196 
197  label count = 0;
198  for (const label patchi : indices)
199  {
200  const polyPatch& pp = patches[patchi];
201 
202  if (isType<emptyPolyPatch>(pp))
203  {
204  continue;
205  }
206  else if (UPstream::parRun() && bool(isA<processorPolyPatch>(pp)))
207  {
208  break; // No processor patches for parallel output
209  }
210 
211  indices[count] = patchi;
212  ++count;
213  }
214 
215  indices.resize(count);
216 
217  return indices;
218 }
219 
220 
221 //
222 // Process args for output options (-ascii, -legacy)
223 //
224 vtk::outputOptions getOutputOptions(const argList& args)
225 {
226  // Default is inline ASCII xml
227  vtk::outputOptions opts;
228 
229  if (args.found("legacy"))
230  {
231  opts.legacy(true);
232 
233  if (!args.found("ascii"))
234  {
235  if (sizeof(float) != 4 || sizeof(label) != 4)
236  {
237  opts.ascii(true);
238 
240  << "Using ASCII rather than legacy binary VTK format since "
241  << "float and/or label are not 4 bytes in size."
242  << nl << endl;
243  }
244  else
245  {
246  opts.ascii(false);
247  }
248  }
249  }
250  else
251  {
252  opts.ascii(args.found("ascii"));
253  }
254 
255  return opts;
256 }
257 
258 
259 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
260 
261 int main(int argc, char *argv[])
262 {
263  argList::addNote
264  (
265  "General OpenFOAM to VTK file writer"
266  );
267  timeSelector::addOptions();
268 
269  // Less frequently used - reduce some clutter
270  argList::setAdvanced("decomposeParDict");
271 
272  argList::addVerboseOption();
273 
274  argList::addBoolOption
275  (
276  "ascii",
277  "Write in ASCII format instead of binary"
278  );
279  argList::addBoolOption
280  (
281  "legacy",
282  "Write legacy format instead of xml",
283  true // mark as an advanced option
284  );
285  argList::addBoolOption
286  (
287  "poly-decomp",
288  "Decompose polyhedral cells into tets/pyramids",
289  true // mark as an advanced option
290  );
291  argList::ignoreOptionCompat
292  (
293  {"xml", 1806}, // xml is now default, use -legacy to toggle
294  false // bool option, no argument
295  );
296  argList::ignoreOptionCompat
297  (
298  {"poly", 1806}, // poly is now default, use -poly-decomp to toggle
299  false // bool option, no argument
300  );
301 
302  argList::addOption
303  (
304  "cellSet",
305  "name",
306  "Convert mesh subset corresponding to specified cellSet",
307  true // mark as an advanced option
308  );
309  argList::addOption
310  (
311  "cellZone",
312  "name",
313  "Convert mesh subset corresponding to specified cellZone",
314  true // mark as an advanced option
315  );
316  argList::addOption
317  (
318  "faceSet",
319  "name",
320  "Convert specified faceSet only",
321  true // mark as an advanced option
322  );
323  argList::addOption
324  (
325  "pointSet",
326  "name",
327  "Convert specified pointSet only",
328  true // mark as an advanced option
329  );
330  argList::addOption
331  (
332  "faceZones",
333  "wordRes",
334  "Specify single or multiple faceZones to write\n"
335  "Eg, 'cells' or '( slice \"mfp-.*\" )'.",
336  true // mark as an advanced option
337  );
338  argList::addOption
339  (
340  "fields",
341  "wordRes",
342  "Specify single or multiple fields to write (all by default)\n"
343  "Eg, 'T' or '(p T U \"alpha.*\")'"
344  );
345  argList::addOption
346  (
347  "exclude-fields",
348  "wordRes",
349  "Exclude single or multiple fields",
350  true // mark as an advanced option
351  );
352  argList::addBoolOption
353  (
354  "no-fields",
355  "Suppress conversion of fields"
356  );
357 
358  argList::addBoolOption
359  (
360  "processor-fields",
361  "Write field values on processor boundaries only",
362  true // mark as an advanced option
363  );
364  argList::addBoolOption
365  (
366  "surfaceFields",
367  "Write surfaceScalarFields (eg, phi)",
368  true // mark as an advanced option
369  );
370  argList::addBoolOption
371  (
372  "no-finite-area",
373  "Suppress output of finite-area mesh/fields",
374  true // mark as an advanced option
375  );
376  argList::ignoreOptionCompat
377  (
378  {"finite-area", 2112}, // use -no-finite-area to disable
379  false // bool option, no argument
380  );
381  argList::ignoreOptionCompat
382  (
383  {"finiteAreaFields", 2012}, // use -no-finite-area to disable
384  false // bool option, no argument
385  );
386 
387  argList::addBoolOption
388  (
389  "nearCellValue",
390  "Use cell value on patches instead of patch value itself",
391  true // mark as an advanced option
392  );
393  argList::addBoolOption
394  (
395  "no-boundary",
396  "Suppress output for boundary patches"
397  );
398  argList::addBoolOption
399  (
400  "no-internal",
401  "Suppress output for internal volume mesh"
402  );
403  argList::addBoolOption
404  (
405  "no-lagrangian", // noLagrangian
406  "Suppress writing lagrangian positions and fields"
407  );
408  argList::addOptionCompat("no-lagrangian", {"noLagrangian", 1806});
409 
410  argList::addBoolOption
411  (
412  "no-point-data", // noPointValues
413  "Suppress conversion of pointFields. No interpolated PointData."
414  );
415  argList::addOptionCompat("no-point-data", {"noPointValues", 1806});
416 
417  argList::addBoolOption
418  (
419  "with-ids",
420  "Additional mesh id fields (cellID, procID, patchID)",
421  true // mark as an advanced option
422  );
423 
424  argList::addBoolOption
425  (
426  "with-point-ids",
427  "Additional pointID field for internal mesh",
428  true // mark as an advanced option
429  );
430 
431  argList::addBoolOption
432  (
433  "one-boundary", // allPatches
434  "Combine all patches into a single file"
435  );
436  argList::addOptionCompat("one-boundary", {"allPatches", 1806});
437 
438  #include "addAllRegionOptions.H"
439 
440  argList::addOption
441  (
442  "patches",
443  "wordRes",
444  "Specify single patch or multiple patches to write\n"
445  "Eg, 'top' or '( front \".*back\" )'"
446  );
447  argList::addOption
448  (
449  "exclude-patches",
450  "wordRes",
451  "Exclude single or multiple patches from writing\n"
452  "Eg, 'outlet' or '( inlet \".*Wall\" )'",
453  true // mark as an advanced option
454  );
455  argList::addOptionCompat("exclude-patches", {"excludePatches", 2112});
456 
457  argList::ignoreOptionCompat
458  (
459  {"noFaceZones", 1806}, // faceZones are only enabled on demand
460  false // bool option, no argument
461  );
462  argList::ignoreOptionCompat
463  (
464  {"noLinks", 1806}, // ignore never make any links
465  false // bool option, no argument
466  );
467  argList::ignoreOptionCompat
468  (
469  {"useTimeName", 1806}, // ignore - works poorly with VTM formats
470  false // bool option, no argument
471  );
472  argList::addBoolOption
473  (
474  "overwrite",
475  "Remove any existing VTK output directory"
476  );
477  argList::addOption
478  (
479  "name",
480  "subdir",
481  "Directory name for VTK output (default: 'VTK')"
482  );
483 
484  #include "setRootCase.H"
485 
487  const bool decomposePoly = args.found("poly-decomp");
488  const bool doBoundary = !args.found("no-boundary");
489  const bool doInternal = !args.found("no-internal");
490  const bool doLagrangian = !args.found("no-lagrangian");
491  const bool doFiniteArea = !args.found("no-finite-area");
492  const bool doSurfaceFields = args.found("surfaceFields");
493  const bool oneBoundary = args.found("one-boundary") && doBoundary;
494  const bool nearCellValue = args.found("nearCellValue") && doBoundary;
495 
496  const vtk::outputOptions writeOpts = getOutputOptions(args);
497 
498  bool processorFieldsOnly = false;
499 
500  if (args.found("processor-fields"))
501  {
502  if (!UPstream::parRun())
503  {
504  Info<< "Ignoring processor patch writing in serial"
505  << nl << endl;
506  }
507  else if (writeOpts.legacy())
508  {
509  Info<< "Ignoring processor patch writing in legacy format"
510  << nl << endl;
511  }
512  else
513  {
514  processorFieldsOnly = true;
515 
516  Info<< "Writing processor patch fields only"
517  << nl << endl;
518  }
519  }
520 
521  if (nearCellValue)
522  {
523  Info<< "Using neighbouring cell value instead of patch value"
524  << nl << endl;
525  }
526 
527  bool doPointValues = !args.found("no-point-data");
528  if (!doPointValues)
529  {
530  Info<< "Point fields and interpolated point data"
531  << " disabled with the '-no-point-data' option"
532  << nl;
533  }
534 
535  const bool withPointIds = args.found("with-point-ids");
536  if (withPointIds)
537  {
538  Info<< "Write point ids requested";
539 
540  if (!doPointValues)
541  {
542  Info<< ", but ignored due to the '-no-point-data' option";
543  }
544 
545  Info<< nl;
546  }
547 
548  const bool withMeshIds = args.found("with-ids");
549  if (withMeshIds)
550  {
551  Info<< "Writing mesh ids (cell, patch, proc) requested" << nl;
552  }
553 
554  // Patch selection/deselection
555  wordRes includedPatches, excludedPatches;
556  autoPtr<wordRes::filter> patchSelector(nullptr);
557  if (doBoundary)
558  {
559  bool resetFilter = false;
560  if (args.readListIfPresent<wordRe>("patches", includedPatches))
561  {
562  resetFilter = true;
563  Info<< "Including patches "
564  << flatOutput(includedPatches) << nl << endl;
565  }
566  if (args.readListIfPresent<wordRe>("exclude-patches", excludedPatches))
567  {
568  resetFilter = true;
569  Info<< "Excluding patches "
570  << flatOutput(excludedPatches) << nl << endl;
571  }
572 
573  if (resetFilter)
574  {
575  patchSelector =
576  autoPtr<wordRes::filter>::New(includedPatches, excludedPatches);
577  }
578  }
579 
580  // Field selection/deselection
581  wordRes includedFields, excludedFields;
582  autoPtr<wordRes::filter> fieldSelector(nullptr);
583  bool doConvertFields = !args.found("no-fields");
584  if (doConvertFields)
585  {
586  bool resetFilter = false;
587  if (args.readListIfPresent<wordRe>("fields", includedFields))
588  {
589  Info<< "Including fields "
590  << flatOutput(includedFields) << nl << endl;
591 
592  resetFilter = !includedFields.empty();
593 
594  if (includedFields.empty())
595  {
596  // Compat: Can be specified as empty (ie, no fields)
597  // Same as "block everything"
598 
599  doConvertFields = false;
600  Info<< "Field conversion disabled by '-fields ()' option" << nl
601  << "Should use -no-fields instead" << endl;
602  }
603  }
604  if (args.readListIfPresent<wordRe>("exclude-fields", excludedFields))
605  {
606  resetFilter = true;
607  Info<< "Excluding fields "
608  << flatOutput(excludedFields) << nl << endl;
609  }
610 
611  if (resetFilter && doConvertFields)
612  {
613  fieldSelector =
614  autoPtr<wordRes::filter>::New(includedFields, excludedFields);
615  }
616  }
617  else if (doConvertFields)
618  {
619  Info<< "Field conversion disabled with the '-no-fields' option" << nl;
620  }
621 
622 
623  // Non-mandatory
624  const wordRes selectedFaceZones(args.getList<wordRe>("faceZones", false));
625 
626  #include "createTime.H"
627 
628  instantList timeDirs = timeSelector::select0(runTime, args);
629 
630  // Information for file series
631  HashTable<vtk::seriesWriter, fileName> vtkSeries;
632 
633  // Handle -allRegions, -regions, -region
634  #include "getAllRegionOptions.H"
635 
636  // Names for sets and zones
637  word cellSelectionName;
638  word faceSetName;
639  word pointSetName;
640 
641  fvMeshSubsetProxy::subsetType cellSubsetType = fvMeshSubsetProxy::NONE;
642 
643  string vtkName = args.globalCaseName();
644 
645  if (regionNames.size() == 1)
646  {
647  if (args.readIfPresent("cellSet", cellSelectionName))
648  {
649  vtkName = cellSelectionName;
650  cellSubsetType = fvMeshSubsetProxy::SET;
651 
652  Info<< "Converting cellSet " << cellSelectionName
653  << " only. New outside faces as \"oldInternalFaces\"."
654  << nl;
655  }
656  else if (args.readIfPresent("cellZone", cellSelectionName))
657  {
658  vtkName = cellSelectionName;
659  cellSubsetType = fvMeshSubsetProxy::ZONE;
660 
661  Info<< "Converting cellZone " << cellSelectionName
662  << " only. New outside faces as \"oldInternalFaces\"."
663  << nl;
664  }
665 
666  args.readIfPresent("faceSet", faceSetName);
667  args.readIfPresent("pointSet", pointSetName);
668  }
669  else
670  {
671  for
672  (
673  const char * const opt
674  : { "cellSet", "cellZone", "faceSet", "pointSet" }
675  )
676  {
677  if (args.found(opt))
678  {
679  Info<< "Ignoring -" << opt << " for multi-regions" << nl;
680  }
681  }
682  }
683 
684  // ------------------------------------------------------------------------
685  // Directory management
686 
687  // Sub-directory for output
688  const word vtkDirName = args.getOrDefault<word>("name", "VTK");
689 
690  const fileName outputDir(args.globalPath()/vtkDirName);
691 
692  if (UPstream::master())
693  {
694  // Overwrite or create the VTK/regionName directories.
695  // For the default region, this is simply "VTK/"
696 
697  for (const word& regionName : regionNames)
698  {
699  fileName regionOutDir(outputDir/polyMesh::regionName(regionName));
700 
701  if (args.found("overwrite") && Foam::isDir(regionOutDir))
702  {
703  Info<< "Removing old directory "
704  << args.relativePath(regionOutDir)
705  << nl << endl;
706  Foam::rmDir(regionOutDir);
707  }
708  Foam::mkDir(regionOutDir);
709  }
710  }
711 
712  // ------------------------------------------------------------------------
713 
714  cpuTime timer;
715  Info<< "Initial memory " << Foam::memInfo{}.size() << " kB" << endl;
716 
717  #include "createNamedMeshes.H"
718  #include "createMeshAccounting.H"
719 
720  Info<< "VTK mesh topology: "
721  << timer.cpuTimeIncrement() << " s, "
722  << Foam::memInfo{}.size() << " kB" << endl;
723 
724 
725  // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
726 
727  forAll(timeDirs, timei)
728  {
729  runTime.setTime(timeDirs[timei], timei);
730 
731  const word timeDesc = "_" + Foam::name(runTime.timeIndex());
732  const scalar timeValue = runTime.value();
733 
734  Info<< "Time: " << runTime.timeName() << endl;
735 
736 
737  // Accumulate information for multi-region VTM
738  vtk::vtmWriter vtmMultiRegion;
739 
740  // vtmMultiRegion.set(vtkDir/vtkName + timeDesc)
741 
742  forAll(regionNames, regioni)
743  {
744  const word& regionName = regionNames[regioni];
746 
747  if (regionNames.size() > 1)
748  {
749  Info<< "region = " << regionName << nl;
750  }
751 
752  auto& meshProxy = meshProxies[regioni];
753  auto& vtuMeshCells = vtuMappings[regioni];
754 
755  // polyMesh::readUpdateState meshState = mesh.readUpdate();
756 
757  // Check for new polyMesh/ and update mesh, fvMeshSubset
758  // and cell decomposition.
759  polyMesh::readUpdateState meshState =
760  meshProxy.readUpdate();
761 
762  const fvMesh& mesh = meshProxy.mesh();
763 
764  if
765  (
766  meshState == polyMesh::TOPO_CHANGE
767  || meshState == polyMesh::TOPO_PATCH_CHANGE
768  )
769  {
770  // Trigger change for vtk cells too
771  vtuMeshCells.clear();
772  }
773 
774  // Write topoSets before attempting anything else
775  {
776  #include "convertTopoSet.H"
777  if (wroteTopoSet)
778  {
779  continue;
780  }
781  }
782 
783  IOobjectList objects;
784  IOobjectList faObjects;
785 
786  if (doConvertFields)
787  {
788  // List of volume mesh objects for this instance
789  objects =
790  IOobjectList(meshProxy.baseMesh(), runTime.timeName());
791 
792  // List of area mesh objects (assuming single region)
793  faObjects =
794  IOobjectList
795  (
796  runTime,
797  runTime.timeName(),
798  faMesh::dbDir(meshProxy.baseMesh(), word::null),
799  IOobjectOption::NO_REGISTER
800  );
801 
802  if (fieldSelector && !fieldSelector().empty())
803  {
804  objects.filterObjects(fieldSelector());
805  faObjects.filterObjects(fieldSelector());
806  }
807 
808  // Remove "*_0" restart fields
809  objects.prune_0();
810  faObjects.prune_0();
811 
812  if (!doPointValues)
813  {
814  // Prune point fields if disabled
815  objects.filterClasses
816  (
817  [](const word& clsName)
818  {
819  return fieldTypes::point.found(clsName);
820  },
821  true // prune
822  );
823  }
824  }
825 
826  if (processorFieldsOnly)
827  {
828  // Processor-patches only and continue
829  #include "convertProcessorPatches.H"
830  continue;
831  }
832 
833  // Volume, internal, point fields
834  #include "convertVolumeFields.H"
835 
836  // Surface fields
837  #include "convertSurfaceFields.H"
838 
839  // Finite-area mesh and fields - need not exist
840  #include "convertAreaFields.H"
841 
842  // Write lagrangian data
843  #include "convertLagrangian.H"
844  }
845 
846  // Emit multi-region vtm
847  if (UPstream::master() && regionNames.size() > 1)
848  {
849  fileName outputName
850  (
851  outputDir/vtkName + "-regions" + timeDesc + ".vtm"
852  );
853 
854  vtmMultiRegion.setTime(timeValue);
855  vtmMultiRegion.write(outputName);
856 
857  fileName seriesName(vtk::seriesWriter::base(outputName));
858 
859  vtk::seriesWriter& series = vtkSeries(seriesName);
860 
861  // First time?
862  // Load from file, verify against filesystem,
863  // prune time >= currentTime
864  if (series.empty())
865  {
866  series.load(seriesName, true, timeValue);
867  }
868 
869  series.append(timeValue, outputName);
870  series.write(seriesName);
871  }
872 
873  Info<< "Wrote in "
874  << timer.cpuTimeIncrement() << " s, "
875  << Foam::memInfo{}.size() << " kB" << endl;
876  }
877 
878 
879  Info<< "\nEnd: "
880  << timer.elapsedCpuTime() << " s, "
881  << Foam::memInfo{}.peak() << " kB (peak)\n" << endl;
882 
883  return 0;
884 }
885 
886 
887 // ************************************************************************* //
labelList findMatching(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
Extract list indices for all items with &#39;name()&#39; that matches.
constexpr char nl
The newline &#39;\n&#39; character (0x0a)
Definition: Ostream.H:50
engineTime & runTime
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
List< T > getList(const label index) const
Get a List of values from the argument at index.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
const fileName & globalCaseName() const noexcept
Return global case name.
Definition: argListI.H:68
wordList regionNames
Operations on lists of strings.
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
Definition: argListI.H:300
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:421
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
Definition: POSIX.C:860
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of &#39;true&#39; entries.
Definition: BitOps.H:73
word outputName("finiteArea-edges.obj")
dynamicFvMesh & mesh
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
Definition: POSIX.C:614
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
Definition: labelLists.C:44
int64_t peak() const noexcept
Peak memory at last update - (VmPeak in /proc/PID/status)
Definition: memInfo.H:113
Write topoSet in VTK format.
fileName relativePath(const fileName &input, const bool caseTag=false) const
Return the input relative to the globalPath by stripping off a leading value of the globalPath...
Definition: argListI.H:87
bool rmDir(const fileName &directory, const bool silent=false, const bool emptyOnly=false)
Remove a directory and its contents recursively,.
Definition: POSIX.C:1433
bool readListIfPresent(const word &optName, List< T > &list) const
If named option is present, get a List of values treating a single entry like a list of size 1...
Definition: argListI.H:387
Memory usage information for the current process, and the system memory that is free.
Definition: memInfo.H:58
PtrList< fvMeshSubsetProxy > meshProxies(meshes.size())
PtrList< vtk::vtuCells > vtuMappings(meshes.size())
vector point
Point is a vector.
Definition: point.H:37
cpuTimePosix cpuTime
Selection of preferred clock mechanism for the elapsed cpu time.
Definition: cpuTimeFwd.H:36
#define WarningInFunction
Report a warning using Foam::Warning.
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
const word & regionDir
const polyBoundaryMesh & patches
vtk::vtmWriter vtmWriter
Required Classes.
messageStream Info
Information stream (stdout output on master, null elsewhere)
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
Definition: argListI.H:316
List< label > labelList
A List of labels.
Definition: List.H:62
List< instant > instantList
List of instants.
Definition: instantList.H:41
Foam::argList args(argc, argv)
Foam::faceZoneMesh.
bool wroteTopoSet
bool found(const word &optName) const
Return true if the named option is found.
Definition: argListI.H:171
int64_t size() const noexcept
Memory size at last update - (VmSize in /proc/PID/status)
Definition: memInfo.H:118
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
fileName globalPath() const
Return the full path to the global case.
Definition: argListI.H:80
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
Definition: FlatOutput.H:225
Required Variables.