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-2014 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 
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 case name
115  fileName& caseName()
116  {
117  return case_;
118  }
119 
120  //- Return system name
121  const word& system() const
122  {
123  return system_;
124  }
125 
126  //- Return system name for the case
127  // which for parallel runs returns ../system()
128  fileName caseSystem() const;
129 
130  //- Return constant name
131  const word& constant() const
132  {
133  return constant_;
134  }
135 
136  //- Return constant name for the case
137  // which for parallel runs returns ../constant()
138  fileName caseConstant() const;
139 
140  //- Return path
141  fileName path() const
142  {
143  return rootPath()/caseName();
144  }
145 
146  //- Return system path
147  fileName systemPath() const
148  {
149  return path()/system();
150  }
151 
152  //- Return constant path
153  fileName constantPath() const
154  {
155  return path()/constant();
156  }
157 };
158 
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 } // End namespace Foam
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 #endif
167 
168 // ************************************************************************* //
Foam::TimePaths::case_
fileName case_
Definition: TimePaths.H:56
Foam::TimePaths::constantPath
fileName constantPath() const
Return constant path.
Definition: TimePaths.H:152
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::TimePaths::path
fileName path() const
Return path.
Definition: TimePaths.H:140
Foam::TimePaths::globalCaseName_
fileName globalCaseName_
Definition: TimePaths.H:55
Foam::TimePaths::caseSystem
fileName caseSystem() const
Return system name for the case.
Definition: TimePaths.C:110
Foam::TimePaths::TimePaths
TimePaths(const fileName &rootPath, const fileName &caseName, const word &systemName, const word &constantName)
Construct given database name, rootPath and casePath.
Definition: TimePaths.C:32
Foam::TimePaths::processorCase_
bool processorCase_
Definition: TimePaths.H:53
Foam::TimePaths::system
const word & system() const
Return system name.
Definition: TimePaths.H:120
fileName.H
Foam::TimePaths::systemPath
fileName systemPath() const
Return system path.
Definition: TimePaths.H:146
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::TimePaths
A class for addressing time paths without using the Time class.
Definition: TimePaths.H:49
Foam::TimePaths::rootPath
const fileName & rootPath() const
Return root path.
Definition: TimePaths.H:96
Foam::TimePaths::caseName
fileName & caseName()
Return case name.
Definition: TimePaths.H:114
Foam::TimePaths::rootPath_
const fileName rootPath_
Definition: TimePaths.H:54
Foam::TimePaths::caseName
const fileName & caseName() const
Return case name.
Definition: TimePaths.H:108
Foam::TimePaths::caseConstant
fileName caseConstant() const
Return constant name for the case.
Definition: TimePaths.C:123
Foam::TimePaths::constant
const word & constant() const
Return constant name.
Definition: TimePaths.H:130
Foam::TimePaths::globalCaseName
const fileName & globalCaseName() const
Return global case name.
Definition: TimePaths.H:102
Foam::TimePaths::processorCase
bool processorCase() const
Return true if this is a processor case.
Definition: TimePaths.H:90
Foam::TimePaths::system_
const word system_
Definition: TimePaths.H:57
Foam::TimePaths::constant_
const word constant_
Definition: TimePaths.H:58