hostCollatedFileOperation.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2017-2018 OpenFOAM Foundation
9  Copyright (C) 2021-2022 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::fileOperations::hostCollatedFileOperation
29 
30 Description
31  Version of collatedFileOperation with multiple read/write ranks.
32 
33  In parallel it will assume ranks are sorted according to hostname
34  and the lowest rank per hostname will be the IO rank. The output directories
35  will get a unique name processors<N>_<low>-<high> where N is the
36  overall number of processors and low and high is the range of ranks
37  contained in the files. Each of these subsets uses its own communicator.
38 
39  Instead of using the hostnames the IO ranks can be assigned using the
40  FOAM_IORANKS environment variable (also when running non-parallel), e.g.
41  when decomposing into 4:
42 
43  FOAM_IORANKS='(0 2)' decomposePar -fileHandler hostCollated
44 
45  will generate
46 
47  processors4_0-1/
48  containing data for processors 0 to 1
49  processors4_2-3/
50  containing data for processors 2 to 3
51 
52 See also
53  collatedFileOperation
54 
55 SourceFiles
56  hostCollatedFileOperation.C
57 
58 \*---------------------------------------------------------------------------*/
59 
60 #ifndef fileOperations_hostCollatedFileOperation_H
61 #define fileOperations_hostCollatedFileOperation_H
62 
63 #include "collatedFileOperation.H"
64 
65 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66 
67 namespace Foam
68 {
69 namespace fileOperations
70 {
71 
72 /*---------------------------------------------------------------------------*\
73  Class hostCollatedFileOperation Declaration
74 \*---------------------------------------------------------------------------*/
75 
77 :
79 {
80  // Private Data
81 
82  //- Communicator allocated/managed by us
83  label managedComm_;
84 
85 
86  // Private Member Functions
87 
88  //- Any initialisation steps after constructing
89  void init(bool verbose);
90 
91  //- Get the list of processors part of this set
92  static labelList subRanks(const label n);
93 
94 public:
95 
96  //- Runtime type information
97  TypeName("hostCollated");
98 
99 
100  // Constructors
101 
102  //- Default construct
103  explicit hostCollatedFileOperation(const bool verbose);
104 
105 
106  //- Destructor
107  virtual ~hostCollatedFileOperation();
108 };
109 
110 
111 /*---------------------------------------------------------------------------*\
112  Class hostCollatedFileOperationInitialise Declaration
113 \*---------------------------------------------------------------------------*/
114 
116 :
118 {
119 public:
120 
121  // Constructors
123  //- Construct from components
124  hostCollatedFileOperationInitialise(int& argc, char**& argv)
125  :
127  {}
128 
129 
130  //- Destructor
131  virtual ~hostCollatedFileOperationInitialise() = default;
132 };
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 } // End namespace fileOperations
138 } // End namespace Foam
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 #endif
143 
144 // ************************************************************************* //
hostCollatedFileOperationInitialise(int &argc, char **&argv)
Construct from components.
virtual ~hostCollatedFileOperationInitialise()=default
Destructor.
Version of collatedFileOperation with multiple read/write ranks.
TypeName("hostCollated")
Runtime type information.
hostCollatedFileOperation(const bool verbose)
Default construct.
Version of masterUncollatedFileOperation that collates regIOobjects into a container in the processor...
label n
Namespace for OpenFOAM.