createNamedPolyMeshes.H
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) 2022-2023 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
12 
13 Description
14  Create single or multiple polyMesh regions based on the
15  wordList 'regionNames'
16 
17 Required Variables
18  - runTime [Time]
19  - regionNames [wordList]
20 
21 Provided Variables
22  - meshes [PtrList<polyMesh>]
23 
24 See Also
25  addAllRegionOptions.H
26  getAllRegionOptions.H
27 
28 \*---------------------------------------------------------------------------*/
29 
31 
32 {
33  forAll(regionNames, regioni)
34  {
35  const auto& regionName = regionNames[regioni];
36 
37  Foam::Info<< "Create polyMesh";
38  if
39  (
40  regionNames.size() > 1
42  )
43  {
44  Foam::Info<< ' ' << regionName;
45  }
46  Foam::Info<< " for time = " << runTime.timeName() << Foam::nl;
47 
48  meshes.set
49  (
50  regioni,
51  new Foam::polyMesh
52  (
54  (
55  regionName,
56  runTime.timeName(),
57  runTime,
59  )
60  )
61  );
62  }
63 
65 }
66 
67 
68 // ************************************************************************* //
const word & regionName() const
The mesh region name or word::null if polyMesh::defaultRegion.
Definition: polyMesh.C:847
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
wordList regionNames
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:421
Foam::PtrList< Foam::polyMesh > meshes(regionNames.size())
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Definition: List.H:55
messageStream Info
Information stream (stdout output on master, null elsewhere)
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:172