multiDomainDecomposition.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) 2023-2025 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::multiDomainDecomposition
26 
27 Description
28  Engine for decomposing and reconstructing multi-region systems of
29  finite-volume meshes
30 
31 SourceFiles
32  multiDomainDecomposition.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef multiDomainDecomposition_H
37 #define multiDomainDecomposition_H
38 
39 #include "domainDecomposition.H"
40 #include "MultiRegionList.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class multiDomainDecomposition Declaration
49 \*---------------------------------------------------------------------------*/
50 
52 :
53  public MultiRegionList<domainDecomposition>
54 {
55  // Private Data
56 
57  //- Run times
58  const processorRunTimes& runTimes_;
59 
60 
61  // Private Member Functions
62 
63  //- Initialise and return the list of regions
65  (
66  const processorRunTimes& runTimes,
67  const fileName& meshPath,
68  const wordList& regionNames
69  );
70 
71 
72 public:
73 
74  //- Runtime type information
75  TypeName("multiDomainDecomposition");
76 
77 
78  // Constructors
79 
80  //- Construct from processor run times and region names
82  (
83  const processorRunTimes& procRunTimes,
84  const fileName& meshPath,
85  const wordList& regionNames
86  );
87 
88 
89  //- Destructor
90  virtual ~multiDomainDecomposition();
91 
92 
93  // Member Functions
94 
95  //- Return the number of processors in the decomposition
96  inline label nProcs() const
97  {
98  return runTimes_.nProcs();
99  }
100 
101  //- Read in the complete mesh. Read the processor meshes if they are
102  // available and up to date relative to the complete mesh, or
103  // decompose if not. Return whether or not decomposition happened.
104  bool readDecompose(const bool doSets);
105 
106  //- Read in the processor meshes. Read the complete mesh if it is
107  // available and up to date relative to the processor meshes, or
108  // reconstruct if not. Return whether or not reconstruction happened.
109  bool readReconstruct(const bool doSets);
110 
111  //- Read-update for decomposition
113 
114  //- Read-update for reconstruction
116 
117  //- Write the decomposed meshes and associated data
118  void writeComplete(const bool doSets) const;
119 
120  //- Write the decomposed meshes and associated data
121  void writeProcs(const bool doSets) const;
122 };
123 
124 
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 
127 } // End namespace Foam
128 
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 
131 #endif
132 
133 // ************************************************************************* //
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: PtrList.H:75
A class for handling file names.
Definition: fileName.H:82
readUpdateState
Enumeration defining the state of the mesh after a read update.
Definition: fvMesh.H:107
Engine for decomposing and reconstructing multi-region systems of finite-volume meshes.
virtual ~multiDomainDecomposition()
Destructor.
TypeName("multiDomainDecomposition")
Runtime type information.
label nProcs() const
Return the number of processors in the decomposition.
void writeProcs(const bool doSets) const
Write the decomposed meshes and associated data.
multiDomainDecomposition(const processorRunTimes &procRunTimes, const fileName &meshPath, const wordList &regionNames)
Construct from processor run times and region names.
bool readDecompose(const bool doSets)
Read in the complete mesh. Read the processor meshes if they are.
void writeComplete(const bool doSets) const
Write the decomposed meshes and associated data.
bool readReconstruct(const bool doSets)
Read in the processor meshes. Read the complete mesh if it is.
fvMesh::readUpdateState readUpdateReconstruct()
Read-update for reconstruction.
fvMesh::readUpdateState readUpdateDecompose()
Read-update for decomposition.
label nProcs() const
Return the number of processors.
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
word meshPath
Definition: setMeshPath.H:1
const Foam::wordList regionNames(args.optionFound("allRegions") ? runTime.regionNames() :wordList(1, args.optionFound("region") ? args.optionRead< word >("region") :polyMesh::defaultRegion))