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 
55  (
56  IOobject::selectIO
57  (
58  IOobject
59  (
60  decompositionModel::canonicalName,
61  mesh.time().system(),
62  mesh.local(),
63  mesh.thisDb(),
64  (fallback ? IOobject::READ_IF_PRESENT : IOobject::MUST_READ),
65  IOobject::NO_WRITE,
66  IOobject::NO_REGISTER,
67  true //io.globalObject()
68  ),
69  decompDictFile
70  ),
71  fallback
72  )
73 {}
74 
75 
76 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
77 
79 (
80  const polyMesh& mesh,
81  const fileName& decompDictFile,
82  const dictionary* content
83 )
84 {
85  return MeshObject_type::New(mesh, decompDictFile, content);
86 }
87 
88 
89 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
90 
92 {
93  if (!decomposerPtr_)
94  {
95  decomposerPtr_ =
97  (
98  *this,
99  this->mesh().name() // Name of mesh region
100  );
101  }
102  return *decomposerPtr_;
103 }
104 
105 
106 // ************************************************************************* //
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
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:75
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:180
Namespace for OpenFOAM.