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  ...
29 
30 SourceFiles
31  multiDomainDecomposition.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef multiDomainDecomposition_H
36 #define multiDomainDecomposition_H
37 
38 #include "domainDecomposition.H"
39 #include "MultiRegionList.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class multiDomainDecomposition Declaration
48 \*---------------------------------------------------------------------------*/
49 
51 :
52  public MultiRegionList<domainDecomposition>
53 {
54  // Private Data
55 
56  //- Run times
57  const processorRunTimes& runTimes_;
58 
59 
60  // Private Member Functions
61 
62  //- Initialise and return the list of regions
64  (
65  const processorRunTimes& runTimes,
66  const fileName& meshPath,
67  const wordList& regionNames
68  );
69 
70 
71 public:
72 
73  //- Runtime type information
74  TypeName("multiDomainDecomposition");
75 
76 
77  // Constructors
78 
79  //- Construct from processor run times and region names
81  (
82  const processorRunTimes& procRunTimes,
83  const fileName& meshPath,
84  const wordList& regionNames
85  );
86 
87 
88  //- Destructor
89  virtual ~multiDomainDecomposition();
90 
91 
92  // Member Functions
93 
94  //- Return the number of processors in the decomposition
95  inline label nProcs() const
96  {
97  return runTimes_.nProcs();
98  }
99 
100  //- Read in the complete mesh. Read the processor meshes if they are
101  // available and up to date relative to the complete mesh, or
102  // decompose if not. Return whether or not decomposition happened.
103  bool readDecompose(const bool doSets);
104 
105  //- Read in the processor meshes. Read the complete mesh if it is
106  // available and up to date relative to the processor meshes, or
107  // reconstruct if not. Return whether or not reconstruction happened.
108  bool readReconstruct(const bool doSets);
109 
110  //- Read-update for decomposition
112 
113  //- Read-update for reconstruction
115 
116  //- Write the decomposed meshes and associated data
117  void writeComplete(const bool doSets) const;
118 
119  //- Write the decomposed meshes and associated data
120  void writeProcs(const bool doSets) const;
121 };
122 
123 
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 
126 } // End namespace Foam
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 #endif
131 
132 // ************************************************************************* //
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:105
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 .controlDict().subDict("regionSolvers").toc() :wordList(1, args.optionFound("region") ? args.optionRead< word >("region") :polyMesh::defaultRegion))