fvMeshDistributorsDistributor.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) 2021-2022 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::fvMeshDistributors::distributor
26 
27 Description
28  Dynamic mesh redistribution using the distributor specified in
29  decomposeParDict
30 
31 Usage
32  Example of single field based refinement in all cells:
33  \verbatim
34  distributor
35  {
36  type distributor;
37 
38  libs ("libfvMeshDistributors.so");
39 
40  // How often to redistribute
41  redistributionInterval 10;
42 
43  // Maximum fractional cell distribution imbalance
44  // before rebalancing
45  maxImbalance 0.1;
46  }
47  \endverbatim
48 
49 SourceFiles
50  fvMeshDistributorsDistributor.C
51 
52 \*---------------------------------------------------------------------------*/
53 
54 #ifndef fvMeshDistributorsDistributor_H
55 #define fvMeshDistributorsDistributor_H
56 
57 #include "fvMeshDistributor.H"
58 
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 
61 namespace Foam
62 {
63  class decompositionMethod;
64 
65 namespace fvMeshDistributors
66 {
67 
68 /*---------------------------------------------------------------------------*\
69  Class distributor Declaration
70 \*---------------------------------------------------------------------------*/
71 
72 class distributor
73 :
74  public fvMeshDistributor
75 {
76 protected:
77 
78  // Protected Member Data
79 
80  //- Cache the decomposer/distributor
82 
83  //- Time-step interval between redistribution calls
85 
86  //- Maximum imbalance between the ideal number of cells per processor
87  // and the maximum or minimum as a ratio mag(1 - nCells/idealNcells)
88  scalar maxImbalance_;
89 
90  //- The time index used for updating
92 
93 
94  // Protected Member Functions
95 
96  //- Read the projection parameters from dictionary
97  void readDict();
98 
99  //- Distribute the mesh and mesh data
100  void distribute(const labelList& distribution);
101 
102 
103 public:
104 
105  //- Runtime type information
106  TypeName("distributor");
107 
108 
109  // Constructors
110 
111  //- Construct from fvMesh
112  explicit distributor(fvMesh& mesh);
113 
114  //- Disallow default bitwise copy construction
115  distributor(const distributor&) = delete;
116 
117 
118  //- Destructor
119  virtual ~distributor();
120 
121 
122  // Member Functions
123 
124  //- Distribute the
125  virtual bool update();
126 
127  //- Update corresponding to the given map
128  virtual void topoChange(const polyTopoChangeMap&);
129 
130  //- Update from another mesh using the given map
131  virtual void mapMesh(const polyMeshMap&);
132 
133  //- Update corresponding to the given distribution map
134  virtual void distribute(const polyDistributionMap&);
135 
136 
137  // Writing
138 
139  //- Write using given format, version and compression
140  virtual bool write(const bool write = true) const;
141 
142 
143  // Member Operators
144 
145  //- Disallow default bitwise assignment
146  void operator=(const distributor&) = delete;
147 };
148 
149 
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 
152 } // End namespace fvMeshDistributors
153 } // End namespace Foam
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 #endif
158 
159 // ************************************************************************* //
scalar maxImbalance_
Maximum imbalance between the ideal number of cells per processor.
label redistributionInterval_
Time-step interval between redistribution calls.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
void readDict()
Read the projection parameters from dictionary.
void distribute(const labelList &distribution)
Distribute the mesh and mesh data.
virtual bool write(const bool write=true) const
Write using given format, version and compression.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
fvMesh & mesh()
Return the fvMesh.
Accumulating histogram of values. Specified bin resolution automatic generation of bins...
Definition: distribution.H:58
Dynamic mesh redistribution using the distributor specified in decomposeParDict.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
Abstract base class for fvMesh movers.
label timeIndex_
The time index used for updating.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
autoPtr< decompositionMethod > distributor_
Cache the decomposer/distributor.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
void operator=(const distributor &)=delete
Disallow default bitwise assignment.
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:50
distributor(fvMesh &mesh)
Construct from fvMesh.
virtual void topoChange(const polyTopoChangeMap &)
Update corresponding to the given map.
TypeName("distributor")
Runtime type information.
Namespace for OpenFOAM.