decompositionModel.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 | Copyright (C) 2014-2016 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 "decompositionModel.H"
27 #include "polyMesh.H"
28 #include "Time.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34  defineTypeNameAndDebug(decompositionModel, 0);
35 }
36 
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38 
40 (
41  const polyMesh& mesh,
42  const fileName& decompDictFile
43 )
44 :
46  <
47  polyMesh,
48  Foam::UpdateableMeshObject,
50  >(mesh),
52  (
53  selectIO
54  (
55  IOobject
56  (
57  "decomposeParDict",
58  mesh.time().system(),
59  mesh.local(),
60  mesh,
63  false //io.registerObject()
64  ),
65  decompDictFile
66  )
67  )
68 {}
69 
70 
72 (
73  const polyMesh& mesh,
74  const dictionary& dict,
75  const fileName& decompDictFile
76 )
77 :
79  <
80  polyMesh,
81  Foam::UpdateableMeshObject,
83  >(mesh),
85  (
86  selectIO
87  (
88  IOobject
89  (
90  "decomposeParDict",
91  mesh.time().system(),
92  mesh.local(),
93  mesh,
96  false //io.registerObject()
97  ),
98  decompDictFile
99  ),
100  dict
101  )
102 {}
103 
104 
105 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
106 
108 (
109  const polyMesh& mesh,
110  const fileName& decompDictFile
111 )
112 {
113  return
114  MeshObject
115  <
116  polyMesh,
117  Foam::UpdateableMeshObject,
119  >::New(mesh, decompDictFile);
120 }
121 
122 
124 (
125  const polyMesh& mesh,
126  const dictionary& dict,
127  const fileName& decompDictFile
128 )
129 {
130  return
131  MeshObject
132  <
133  polyMesh,
134  Foam::UpdateableMeshObject,
136  >::New(mesh, dict, decompDictFile);
137 }
138 
139 
140 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
141 
143 (
144  const IOobject& io,
145  const fileName& f
146 )
147 {
148  return
149  (
150  f.size()
151  ? IOobject // construct from filePath instead
152  (
153  f,
154  io.db(),
155  io.readOpt(),
156  io.writeOpt(),
157  io.registerObject()
158  )
159  : io
160  );
161 }
162 
163 
164 // ************************************************************************* //
const Time & time() const
Return time.
A class for handling file names.
Definition: fileName.H:69
static const decompositionModel & New(const polyMesh &mesh, const fileName &decompDictFile="")
Read (optionallly from absolute path) & register on mesh.
const objectRegistry & db() const
Return the local objectRegistry.
Definition: IOobject.C:221
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
decompositionModel(const polyMesh &, const fileName &="")
Construct from typeName or optional path to controlDictionary.
label size() const
Return number of elements in list.
Definition: DLListBaseI.H:77
writeOption writeOpt() const
Definition: IOobject.H:314
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
Definition: MeshObject.H:85
dynamicFvMesh & mesh
const fileName & local() const
Definition: IOobject.H:347
MeshObject wrapper of decompositionMethod.
static IOobject selectIO(const IOobject &, const fileName &)
Helper: return IOobject with optionally absolute path provided.
defineTypeNameAndDebug(combustionModel, 0)
labelList f(nPoints)
readOption readOpt() const
Definition: IOobject.H:304
const word & system() const
Return system name.
Definition: TimePaths.H:114
bool & registerObject()
Register object created from this IOobject with registry if true.
Definition: IOobject.H:290
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Namespace for OpenFOAM.