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
38  (
39  regionNames.size() > 1
41  )
42  {
43  Foam::Info<< ' ' << regionName;
44  }
45  Foam::Info<< " for time = " << runTime.timeName() << Foam::nl;
46 
47  meshes.set
48  (
49  regioni,
50  new Foam::fvMesh
51  (
53  (
54  regionName,
55  runTime.timeName(),
56  runTime,
58  ),
59  false // Do not initialise
60  )
61  );
62  }
63 
64  for (auto& mesh : meshes)
65  {
66  mesh.init(true); // Initialise all (lower levels and current)
67  }
68 
70 }
71 
72 
73 // ************************************************************************* //
runTime
engineTime & runTime
Definition: createEngineTime.H:13
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::polyMesh::defaultRegion
static word defaultRegion
Return the default region name.
Definition: polyMesh.H:318
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::PtrList::set
const T * set(const label i) const
Return const pointer to element (can be nullptr),.
Definition: PtrList.H:138
regionNames
wordList regionNames
Definition: getAllRegionOptions.H:37
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
regionName
Foam::word regionName
Definition: createNamedDynamicFvMesh.H:1
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
meshes
Foam::PtrList< Foam::fvMesh > meshes(regionNames.size())
Foam::PtrList< Foam::fvMesh >
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam::nl
constexpr char nl
Definition: Ostream.H:404
Foam::IOobject::MUST_READ
Definition: IOobject.H:185