1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 A cluster of time instances, used with multiSolver. Catalogues all the
29 time directories within a superLoop, within a solverDomain. A single
30 time cluster describes what would be analogous to all the time directories
31 for a solver that does not use multiSolver.
39 \*---------------------------------------------------------------------------*/
46 #include "instantList.H"
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 // Forward declaration of friend functions and operators
57 // Friend IOstream Operators
59 Istream& operator>>(Istream&, timeCluster&);
60 Ostream& operator<<(Ostream&, const timeCluster&);
63 /*---------------------------------------------------------------------------*\
64 Class timeCluster Declaration
65 \*---------------------------------------------------------------------------*/
76 word solverDomainName_;
78 // PreConditioned file name - used only for pre and post conditioning
79 // a data set for parallel runs
86 //- Less function class used in sorting timeClusters
91 bool operator()(const timeCluster& one, const timeCluster& two) const
93 return one.globalMinValue() < two.globalMinValue();
98 // Static data members
100 static const char* const typeName;
108 //- Construct from components
111 const instantList& times,
112 const scalar globalOffset,
113 const label globalIndex,
114 const label superLoop,
115 const word& solverDomainName,
116 const word& preConName = word::null
119 //- Construct given a timeCluster and an index
120 // This creates a 'timeCluster' that holds a single instant
121 // in time, whose other values match those of tc.
124 const timeCluster& tc,
128 //- Construct a time cluster given a scalar value. This constructs
129 // a timeCluster with a single instant of time at value t, and whose
130 // other values are zero or empty.
131 explicit timeCluster(const scalar t);
138 inline const instantList& times() const;
140 inline instantList& times();
143 inline scalar globalOffset() const;
145 inline scalar& globalOffset();
148 inline label globalIndex() const;
150 inline label& globalIndex();
153 inline label superLoop() const;
155 inline label& superLoop();
157 //- Solver domain name
158 inline const word& solverDomainName() const;
160 inline word& solverDomainName();
162 //- Solver domain name
163 inline const word& preConName() const;
165 inline word& preConName();
169 //- Global value at index
170 scalar globalValue(const label& index) const;
172 //- Search for and return global min value. If empty,
174 scalar globalMinValue() const;
176 //- Search for and return global max value. If empty,
178 scalar globalMaxValue() const;
180 //- Search for and return index of global min value
181 label globalMinIndex() const;
183 //- Search for and return index of global max value
184 label globalMaxIndex() const;
186 //- Global closest time
187 scalar globalFindClosestTimeValue(const scalar) const;
189 //- Global closest time index
190 label globalFindClosestTimeIndex(const scalar) const;
192 //- Local value at index
193 scalar localValue(const label& index) const;
195 //- Search for and return local min value
196 scalar localMinValue() const;
198 //- Search for and return local max value
199 scalar localMaxValue() const;
201 //- Search for and return index of global min value. If empty,
203 label localMinIndex() const;
205 //- Search for and return index of global max value. If empty,
207 label localMaxIndex() const;
209 //-Local closest time
210 scalar localFindClosestTimeValue(const scalar) const;
212 //-Local closest time index
213 label localFindClosestTimeIndex(const scalar) const;
217 //- Chip off a single instant given an index, return as timeCluster
218 // This retains superLoop, solverDomain, etc.. with a timevalue
219 timeCluster operator()(const label index) const;
222 // Friend IOstream Operators
224 friend Istream& operator>>(Istream&, timeCluster&);
225 friend Ostream& operator<<(Ostream&, const timeCluster&);
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231 } // End namespace Foam
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 #include "timeClusterI.H"
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 // ************************************************************************* //