createNamedMeshes.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) 2021 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 regions based on the wordList 'regionNames'
15 
16 Required Variables
17  - runTime [Time]
18  - regionNames [wordList]
19 
20 Provided Variables
21  - meshes [PtrList<fvMesh>]
22 
23 See Also
24  addAllRegionOptions.H
25  getAllRegionOptions.H
26 
27 \*---------------------------------------------------------------------------*/
28 
30 
31 {
32  forAll(regionNames, regioni)
33  {
34  const Foam::word& regionName = regionNames[regioni];
35 
36  Foam::Info<< "Create mesh";
37  if (regionNames.size() > 1)
38  {
39  Foam::Info<< ' ' << regionName;
40  }
41  Foam::Info<< " for time = " << runTime.timeName() << Foam::nl;
42 
43  meshes.set
44  (
45  regioni,
46  new Foam::fvMesh
47  (
49  (
50  regionName,
51  runTime.timeName(),
52  runTime,
54  ),
55  false // Do not initialise
56  )
57  );
58  }
59 
60  for (auto& mesh : meshes)
61  {
62  mesh.init(true); // Initialise all (lower levels and current)
63  }
64 
66 }
67 
68 
69 // ************************************************************************* //
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
dynamicFvMesh & mesh
A class for handling words, derived from Foam::string.
Definition: word.H:63
Foam::PtrList< Foam::fvMesh > meshes(regionNames.size())
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
Definition: PtrList.H:159
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
messageStream Info
Information stream (stdout output on master, null elsewhere)
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:172