decompositionModel.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2014-2019 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 Class
25  Foam::decompositionModel
26 
27 Description
28  MeshObject wrapper of decompositionMethod
29 
30 SourceFiles
31 
32 \*---------------------------------------------------------------------------*/
33 
34 #ifndef decompositionModel_H
35 #define decompositionModel_H
36 
37 #include "IOdictionary.H"
38 #include "MeshObject.H"
39 #include "decompositionMethod.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 // Forward declaration of classes
47 class mapPolyMesh;
48 class polyMesh;
49 
50 /*---------------------------------------------------------------------------*\
51  Class decompositionModel Declaration
52 \*---------------------------------------------------------------------------*/
53 
55 :
56  public MeshObject
57  <
58  polyMesh,
59  UpdateableMeshObject,
60  decompositionModel
61  >,
62  public IOdictionary
63 {
64 
65  // Private Data
66 
67  mutable autoPtr<decompositionMethod> decomposerPtr_;
68 
69 
70 public:
71 
72  // Declare name of the class and its debug switch
73  ClassName("decompositionModel");
74 
75 
76  // Selectors
77 
78  //- Read (optionally from absolute path) & register on mesh
79  static const decompositionModel& New
80  (
81  const polyMesh& mesh,
82  const fileName& decompDictFile = ""
83  );
84 
85  //- Read (optionally from supplied dictionary) & register on mesh
86  static const decompositionModel& New
87  (
88  const polyMesh& mesh,
89  const dictionary& dict,
90  const fileName& decompDictFile = ""
91  );
92 
93 
94  // Constructors
95 
96  //- Construct from typeName or optional path to controlDictionary
97  decompositionModel(const polyMesh&, const fileName& = "");
98 
99 
100  //- Construct from typeName or optional path to controlDictionary
102  (
103  const polyMesh&,
104  const dictionary& dict,
105  const fileName& = ""
106  );
107 
108 
109  // Member Functions
112  {
113  if (!decomposerPtr_.valid())
114  {
115  decomposerPtr_ = decompositionMethod::New(*this);
116  }
117  return decomposerPtr_();
118  }
119 
120  //- Helper: return IOobject with optionally absolute path provided
121  static IOobject selectIO(const IOobject&, const fileName&);
122 
123 
124  // UpdateableMeshObject
126  virtual bool movePoints()
127  {
128  return false;
129  }
131  virtual void updateMesh(const mapPolyMesh&)
132  {}
133 
134 };
135 
136 
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 
139 } // End namespace Foam
140 
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 
143 #endif
144 
145 // ************************************************************************* //
dictionary dict
A class for handling file names.
Definition: fileName.H:79
static const decompositionModel & New(const polyMesh &mesh, const fileName &decompDictFile="")
Read (optionally from absolute path) & register on mesh.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
decompositionModel(const polyMesh &, const fileName &="")
Construct from typeName or optional path to controlDictionary.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:52
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
Definition: MeshObject.H:86
decompositionMethod & decomposer() const
ClassName("decompositionModel")
Abstract base class for decomposition.
MeshObject wrapper of decompositionMethod.
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set)
Definition: autoPtrI.H:83
static autoPtr< decompositionMethod > New(const dictionary &decompositionDict)
Return a reference to the selected decomposition method.
static IOobject selectIO(const IOobject &, const fileName &)
Helper: return IOobject with optionally absolute path provided.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
virtual void updateMesh(const mapPolyMesh &)
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
Namespace for OpenFOAM.