distributor_fvMeshDistributor.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-2024 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  distributor_fvMeshDistributor.C
51 
52 \*---------------------------------------------------------------------------*/
53 
54 #ifndef distributor_fvMeshDistributor_H
55 #define distributor_fvMeshDistributor_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  //- Distribute the mesh and mesh data
97  void distribute(const labelList& distribution);
98 
99 
100 public:
101 
102  //- Runtime type information
103  TypeName("distributor");
104 
105 
106  // Constructors
107 
108  //- Construct from fvMesh and dictionary
110 
111  //- Disallow default bitwise copy construction
112  distributor(const distributor&) = delete;
113 
114 
115  //- Destructor
116  virtual ~distributor();
117 
118 
119  // Member Functions
120 
121  //- Distribute the
122  virtual bool update();
123 
124  //- Update corresponding to the given map
125  virtual void topoChange(const polyTopoChangeMap&);
126 
127  //- Update from another mesh using the given map
128  virtual void mapMesh(const polyMeshMap&);
129 
130  //- Update corresponding to the given distribution map
131  virtual void distribute(const polyDistributionMap&);
132 
133 
134  // Writing
135 
136  //- Write using given format, version and compression
137  virtual bool write(const bool write = true) const;
138 
139 
140  // Member Operators
141 
142  //- Disallow default bitwise assignment
143  void operator=(const distributor&) = delete;
144 };
145 
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 } // End namespace fvMeshDistributors
150 } // End namespace Foam
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 #endif
155 
156 // ************************************************************************* //
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Base class for statistical distributions.
Definition: distribution.H:76
Abstract base class for fvMesh movers.
fvMesh & mesh()
Return the fvMesh.
Dynamic mesh redistribution using the distributor specified in decomposeParDict.
scalar maxImbalance_
Maximum imbalance between the ideal number of cells per processor.
distributor(fvMesh &mesh, const dictionary &dict)
Construct from fvMesh and dictionary.
void operator=(const distributor &)=delete
Disallow default bitwise assignment.
void distribute(const labelList &distribution)
Distribute the mesh and mesh data.
TypeName("distributor")
Runtime type information.
virtual void topoChange(const polyTopoChangeMap &)
Update corresponding to the given map.
autoPtr< decompositionMethod > distributor_
Cache the decomposer/distributor.
label redistributionInterval_
Time-step interval between redistribution calls.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual bool write(const bool write=true) const
Write using given format, version and compression.
label timeIndex_
The time index used for updating.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:96
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
dictionary dict