faMeshRegistry.C
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) 2024 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "faMesh.H"
30 #include "Time.H"
31 #include "polyMesh.H"
32 
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 
36 (
37  const word& areaRegion,
38  const polyMesh& mesh
39 )
40 :
42  (
43  IOobject
44  (
45  areaRegion,
46  faMeshesRegistry::New(mesh).thisDb(),
47  IOobjectOption::NO_READ,
48  IOobjectOption::AUTO_WRITE,
49  IOobjectOption::REGISTER
50  )
51  )
52 {}
53 
54 
55 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
56 
58 {
59  // In the usual case, the objectRegistry::dbDir() will be something
60  // like finite-area/{region0,film} etc with the "finite-area/"
61  // prefix coming from the enclosing registry of registries.
62  //
63  // So always check the name() portion, not the dbDir() itself
64  // - either, objectRegistry::dbDir().name()
65  // - or (same), objectRegistry::name()
66 
68  {
69  return objectRegistry::parent().dbDir();
70  }
71 
72  return objectRegistry::dbDir();
73 }
74 
75 
76 // ************************************************************************* //
A class for handling file names.
Definition: fileName.H:72
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:195
virtual const fileName & dbDir() const
Local directory path of the objectRegistry relative to Time with override for the single-region case...
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
dynamicFvMesh & mesh
A class for handling words, derived from Foam::string.
Definition: word.H:63
static word defaultRegion
Return the default region name.
Definition: polyMesh.H:406
faMeshRegistry(const word &areaRegion, const polyMesh &mesh)
Construct an objectRegistry for given area region name.
const objectRegistry & parent() const noexcept
Return the parent objectRegistry.
A simple container of IOobject preferences. Can also be used for general handling of read/no-read/rea...
A MeshObject registry on top of a polyMesh that provides an objectRegistry for holding multiple faMes...
virtual const fileName & dbDir() const
Local directory path of this objectRegistry relative to the time.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:75
Registry of regIOobjects.
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:180