decompositionModel.H
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) 2018-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 Class
28  Foam::decompositionModel
29 
30 Description
31  MeshObject wrapper of decompositionMethod
32 
33 SourceFiles
34  decompositionModel.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef Foam_decompositionModel_H
39 #define Foam_decompositionModel_H
40 
41 #include "IOdictionary.H"
42 #include "MeshObject.H"
43 #include "decompositionMethod.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // Forward Declarations
51 class mapPolyMesh;
52 class polyMesh;
53 
54 /*---------------------------------------------------------------------------*\
55  Class decompositionModel Declaration
56 \*---------------------------------------------------------------------------*/
57 
59 :
60  public MeshObject
61  <
62  polyMesh,
63  UpdateableMeshObject,
64  decompositionModel
65  >,
66  public IOdictionary
67 {
68  // Private Typedefs
69 
70  typedef MeshObject
71  <
72  polyMesh,
76 
77 
78  // Private Data
79 
80  mutable autoPtr<decompositionMethod> decomposerPtr_;
81 
82 
83 public:
84 
85  // Declare name of the class and its debug switch
86  ClassName("decompositionModel");
87 
88  //- The canonical name ("decomposeParDict") under which the
89  //- MeshObject is registered
90  static const word canonicalName;
91 
92 
93  // Constructors
94 
95  //- Construct from typeName, optional decomposeParDict path/name
96  //- or with fallback content
97  explicit decompositionModel
98  (
99  const polyMesh& mesh,
100  const fileName& decompDictFile = "",
101  const dictionary* fallback = nullptr
102  );
103 
104 
105  // Selectors
106 
107  //- Read and register on mesh,
108  //- optionally with alternative decomposeParDict path/name
109  //- or with fallback content
110  static const decompositionModel& New
111  (
112  const polyMesh& mesh,
113  const fileName& decompDictFile = "",
114  const dictionary* fallback = nullptr
115  );
116 
117 
118  // Member Functions
119 
120  //- Return demand-driven decomposition method
122 
123 
124  // UpdateableMeshObject Functions
125 
126  virtual bool movePoints()
127  {
128  return false;
129  }
130 
131  virtual void updateMesh(const mapPolyMesh&)
132  {}
133 
135  // Housekeeping
136 
137  //- Deprecated(2021-04) compatibility constructor
138  // \deprecated(2021-04)
139  FOAM_DEPRECATED_FOR(2021-04, "construct mesh/fileName/dictionary")
141  (
142  const polyMesh& mesh,
143  const dictionary& dict,
144  const fileName& decompDictFile = ""
145  )
146  :
147  decompositionModel(mesh, decompDictFile, &dict)
148  {}
149 
150  //- Deprecated(2021-04) compatibility selector
151  // \deprecated(2021-04)
152  FOAM_DEPRECATED_FOR(2021-04, "New mesh/fileName/dictionary")
153  static const decompositionModel& New
154  (
155  const polyMesh& mesh,
156  const dictionary& dict,
157  const fileName& decompDictFile = ""
158  )
159  {
160  return Foam::decompositionModel::New(mesh, decompDictFile, &dict);
161  }
162 
163  //- Deprecated(2018-08) compatibility method
164  // \deprecated(2018-08) - use IOobject::selectIO directly
165  FOAM_DEPRECATED_FOR(2018-08, "IOobject::selectIO")
166  static IOobject selectIO
167  (
168  const IOobject& io,
169  const fileName& file,
170  const word& name = ""
171  )
172  {
173  return IOobject::selectIO(io, file, name);
174  }
175 };
176 
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 } // End namespace Foam
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 #endif
185 
186 // ************************************************************************* //
virtual bool movePoints()
Update for mesh motion.
dictionary dict
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
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.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
Definition: NamedEnum.H:65
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:152
ClassName("decompositionModel")
const polyMesh & mesh() const noexcept
Reference to the mesh.
Definition: MeshObject.H:255
A class for handling words, derived from Foam::string.
Definition: word.H:63
Abstract base class for domain decomposition.
const word & name() const
Name function is needed to disambiguate those inherited from regIOobject and dictionary.
MeshObject wrapper of decompositionMethod.
static const word canonicalName
The canonical name ("decomposeParDict") under which the MeshObject is registered. ...
static IOobject selectIO(const IOobject &io, const fileName &file, const word &name="")
Deprecated(2018-08) compatibility method.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:75
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
virtual void updateMesh(const mapPolyMesh &)
Update topology using the given map.
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:180
Namespace for OpenFOAM.
UpdateableMeshObject(const word &objName, const objectRegistry &obr)
Construct from name and instance on registry.
Definition: MeshObject.H:352
static IOobject selectIO(const IOobject &io, const fileName &altFile, const word &ioName="")
Return the IOobject, but also consider an alternative file name.
Definition: IOobject.C:256