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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2014-2016 OpenFOAM Foundation
9  Copyright (C) 2015-2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "decompositionModel.H"
30 #include "polyMesh.H"
31 #include "Time.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37  defineTypeNameAndDebug(decompositionModel, 0);
38 }
39 
40 const Foam::word Foam::decompositionModel::canonicalName("decomposeParDict");
41 
42 
43 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
44 
46 (
47  const polyMesh& mesh,
48  const fileName& decompDictFile,
49  const dictionary* fallback
50 )
51 :
53  <
54  polyMesh,
57  >(mesh),
59  (
60  IOobject::selectIO
61  (
62  IOobject
63  (
64  decompositionModel::canonicalName,
65  mesh.time().system(),
66  mesh.local(),
67  mesh.thisDb(),
68  (fallback ? IOobject::READ_IF_PRESENT : IOobject::MUST_READ),
69  IOobject::NO_WRITE,
70  IOobject::NO_REGISTER,
71  true //io.globalObject()
72  ),
73  decompDictFile
74  ),
75  fallback
76  )
77 {}
78 
79 
80 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
81 
83 (
84  const polyMesh& mesh,
85  const fileName& decompDictFile,
86  const dictionary* content
87 )
88 {
89  return
91  <
92  polyMesh,
95  >::New(mesh, decompDictFile, content);
96 }
97 
98 
99 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
100 
102 {
103  if (!decomposerPtr_)
104  {
105  decomposerPtr_ =
107  (
108  *this,
109  this->mesh().name() // Name of mesh region
110  );
111  }
112  return *decomposerPtr_;
113 }
114 
115 
116 // ************************************************************************* //
A class for handling file names.
Definition: fileName.H:72
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
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.
decompositionModel(const polyMesh &mesh, const fileName &decompDictFile="", const dictionary *fallback=nullptr)
Construct from typeName, optional decomposeParDict path/name or with fallback content.
static const decompositionModel & New(const polyMesh &mesh, const fileName &decompDictFile="", const dictionary *fallback=nullptr)
Read and register on mesh, optionally with alternative decomposeParDict path/name or with fallback co...
decompositionMethod & decomposer() const
Return demand-driven decomposition method.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:50
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
Definition: MeshObject.H:85
dynamicFvMesh & mesh
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
A class for handling words, derived from Foam::string.
Definition: word.H:63
Abstract base class for domain decomposition.
bool local
Definition: EEqn.H:20
MeshObject wrapper of decompositionMethod.
defineTypeNameAndDebug(combustionModel, 0)
static const word canonicalName
The canonical name ("decomposeParDict") under which the MeshObject is registered. ...
static autoPtr< decompositionMethod > New(const dictionary &decompDict, const word &regionName="")
Return a reference to the selected decomposition method, optionally region-specific.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
int system(const std::string &command, const bool bg=false)
Execute the specified command via the shell.
Definition: POSIX.C:1702
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:172
Namespace for OpenFOAM.