TimePaths.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 | Copyright (C) 2011-2013 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::TimePaths
26 
27 Description
28  A class for addressing time paths without using the Time class.
29 
30 SourceFiles
31  TimePaths.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef TimePaths_H
36 #define TimePaths_H
37 
38 #include "fileName.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class TimePaths Declaration
47 \*---------------------------------------------------------------------------*/
48 
49 
50 class TimePaths
51 {
52  // Private data
53 
54  bool processorCase_;
55  const fileName rootPath_;
56  fileName globalCaseName_;
57  const fileName case_;
58  const word system_;
59  const word constant_;
60 
61 
62 public:
63 
64  // Constructors
65 
66  //- Construct given database name, rootPath and casePath
67  TimePaths
68  (
69  const fileName& rootPath,
70  const fileName& caseName,
71  const word& systemName,
72  const word& constantName
73  );
74 
75 
76  //- Construct given database name, rootPath and casePath
77  TimePaths
78  (
79  const bool processorCase,
80  const fileName& rootPath,
81  const fileName& globalCaseName,
82  const fileName& caseName,
83  const word& systemName,
84  const word& constantName
85  );
86 
87 
88  // Member functions
89 
90  //- Return true if this is a processor case
91  bool processorCase() const
92  {
93  return processorCase_;
94  }
95 
96  //- Return root path
97  const fileName& rootPath() const
98  {
99  return rootPath_;
100  }
101 
102  //- Return global case name
103  const fileName& globalCaseName() const
104  {
105  return globalCaseName_;
106  }
107 
108  //- Return case name
109  const fileName& caseName() const
110  {
111  return case_;
112  }
113 
114  //- Return system name
115  const word& system() const
116  {
117  return system_;
118  }
119 
120  //- Return system name for the case
121  // which for parallel runs returns ../system()
122  fileName caseSystem() const;
123 
124  //- Return constant name
125  const word& constant() const
126  {
127  return constant_;
128  }
129 
130  //- Return constant name for the case
131  // which for parallel runs returns ../constant()
132  fileName caseConstant() const;
133 
134  //- Return path
135  fileName path() const
136  {
137  return rootPath()/caseName();
138  }
139 
140  //- Return system path
141  fileName systemPath() const
142  {
143  return path()/system();
144  }
145 
146  //- Return constant path
147  fileName constantPath() const
148  {
149  return path()/constant();
150  }
151 };
152 
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 } // End namespace Foam
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 #endif
161 
162 // ************************************************************************* //
fileName systemPath() const
Return system path.
Definition: TimePaths.H:140
A class for addressing time paths without using the Time class.
Definition: TimePaths.H:49
A class for handling file names.
Definition: fileName.H:69
bool processorCase() const
Return true if this is a processor case.
Definition: TimePaths.H:90
TimePaths(const fileName &rootPath, const fileName &caseName, const word &systemName, const word &constantName)
Construct given database name, rootPath and casePath.
Definition: TimePaths.C:32
fileName constantPath() const
Return constant path.
Definition: TimePaths.H:146
fileName caseSystem() const
Return system name for the case.
Definition: TimePaths.C:110
fileName caseConstant() const
Return constant name for the case.
Definition: TimePaths.C:123
const fileName & rootPath() const
Return root path.
Definition: TimePaths.H:96
A class for handling words, derived from string.
Definition: word.H:59
fileName path() const
Return path.
Definition: TimePaths.H:134
const word & constant() const
Return constant name.
Definition: TimePaths.H:124
const fileName & globalCaseName() const
Return global case name.
Definition: TimePaths.H:102
const fileName & caseName() const
Return case name.
Definition: TimePaths.H:108
const word & system() const
Return system name.
Definition: TimePaths.H:114
Namespace for OpenFOAM.