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-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
12
13Description
14 Create single or multiple regions based on the wordList 'regionNames'
15
16Required Variables
17 - runTime [Time]
18 - regionNames [wordList]
19
20Provided Variables
21 - meshes [PtrList<fvMesh>]
22
23See 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
44 (
45 regioni,
46 new Foam::fvMesh
47 (
49 (
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// ************************************************************************* //
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: PtrList.H:73
const T * set(const label i) const
Definition: PtrList.H:138
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
A class for handling words, derived from Foam::string.
Definition: word.H:68
dynamicFvMesh & mesh
engineTime & runTime
Foam::word regionName(Foam::polyMesh::defaultRegion)
Foam::PtrList< Foam::fvMesh > meshes(regionNames.size())
wordList regionNames
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
constexpr char nl
The newline '\n' character (0x0a)
Definition: Ostream.H:53
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333