zonesGenerator.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2025-2026 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "zonesGenerator.H"
27 #include "polyMesh.H"
28 #include "Time.H"
29 #include "IOdictionary.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
36 }
37 
38 
39 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
40 
41 Foam::IOobject Foam::zonesGenerator::io(const polyMesh& mesh) const
42 {
43  typeIOobject<IOdictionary> result
44  (
45  typeName,
46  mesh.time().constant(),
47  mesh,
50  );
51 
52  if (!result.headerOk())
53  {
54  result.readOpt() = IOobject::NO_READ;
55  }
56  else
57  {
58  result.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
59  }
60 
61  return result;
62 }
63 
64 
65 void Foam::zonesGenerator::generate()
66 {
68 }
69 
70 
71 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
72 
74 (
75  const polyMesh& mesh
76 )
77 :
79  <
80  polyMesh,
84  >
85  (
86  io(mesh),
87  mesh
88  ),
90 {
91  zoneGeneratorList::read(*this, true);
92  generate();
93 }
94 
95 
96 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
97 
99 {
100  if (regIOobject::read())
101  {
102  zoneGeneratorList::read(*this, true);
103  generate();
104  }
105 
106  return true;
107 }
108 
109 
111 {
113  return true;
114 }
115 
116 
118 {
119  // Zones are automatically distributed
120 }
121 
122 
124 {
125  // Regenerate zones following topology change
126  generate();
127 }
128 
129 
131 {
132  // Zones are automatically mapped but should be regenerated
133  generate();
134 }
135 
136 
137 // ************************************************************************* //
Templated abstract base-class for demand-driven mesh objects used to automate their allocation to the...
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
@ MUST_READ_IF_MODIFIED
Definition: IOobject.H:119
static const word & constant()
Return constant name.
Definition: TimePaths.H:122
const Time & time() const
Return time.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:78
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
virtual bool read()
Read object.
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
List of zoneGenerators.
void read(const dictionary &dict, const bool topLevel=false)
void generate()
Generate and register the zones.
void movePoints()
Update the zones following mesh point movement.
MeshObject zoneGeneratorList instantiated by polyMesh.
virtual bool movePoints()
Update for mesh motion.
zonesGenerator(const polyMesh &mesh)
Read construct from polyMesh.
virtual void mapMesh(const polyMeshMap &map)
Update from another mesh using the given map.
virtual void distribute(const polyDistributionMap &map)
Redistribute or update using the given distribution map.
virtual void topoChange(const polyTopoChangeMap &map)
Update topology using the given map.
virtual bool read()
Read the zonesGenerator dictionary if it has changed.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
Namespace for OpenFOAM.
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)