TimePathsI.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) 2018-2023 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
31 (
32  const fileName& rootPath,
33  const fileName& caseName,
34  const word& systemDirName,
35  const word& constantDirName
36 )
37 :
38  TimePaths
39  (
40  false, // processorCase
41  rootPath, // rootPath
42  false, // distributed
43  caseName, // globalCaseName
44  caseName, // caseName
45  systemDirName,
46  constantDirName
47  )
48 {}
49 
50 
51 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
52 
53 inline bool Foam::TimePaths::distributed() const noexcept
54 {
55  return distributed_;
56 }
57 
58 
59 inline bool Foam::TimePaths::processorCase() const noexcept
60 {
61  return processorCase_;
62 }
63 
64 
65 inline bool Foam::TimePaths::processorCase(bool on) noexcept
66 {
67  bool old(processorCase_);
68  processorCase_ = on;
69  return old;
70 }
71 
72 
74 {
75  return rootPath_;
76 }
77 
78 
80 {
81  return globalCaseName_;
82 }
83 
84 
86 {
87  return case_;
88 }
89 
90 
92 {
93  return case_;
94 }
95 
96 
98 {
99  return rootPath()/caseName();
100 }
101 
102 
104 {
105  return rootPath()/globalCaseName();
106 }
107 
108 
110 (
111  const fileName& input,
112  const bool caseTag
113 ) const
114 {
115  return input.relative(globalPath(), caseTag);
116 }
117 
119 inline const Foam::word& Foam::TimePaths::constant() const noexcept
120 {
121  return constant_;
122 }
123 
125 inline const Foam::word& Foam::TimePaths::system() const noexcept
126 {
127  return system_;
128 }
129 
130 
132 {
133  if (processorCase_)
134  {
135  return ".."/constant();
136  }
137 
138  return constant();
139 }
140 
141 
143 {
144  if (processorCase_)
145  {
146  return ".."/system();
147  }
148 
149  return system();
150 }
151 
154 {
155  return path()/constant();
156 }
157 
158 
160 {
161  return path()/system();
162 }
163 
164 
165 // ************************************************************************* //
fileName constantPath() const
Return constant path.
Definition: TimePathsI.H:146
Address the time paths without using the Time class.
Definition: TimePaths.H:52
A class for handling file names.
Definition: fileName.H:72
fileName relativePath(const fileName &input, const bool caseTag=false) const
Return the input relative to the globalPath by stripping off a leading value of the globalPath...
Definition: TimePathsI.H:103
fileName systemPath() const
Return system path.
Definition: TimePathsI.H:152
bool processorCase() const noexcept
True if this is a processor case.
Definition: TimePathsI.H:52
fileName caseSystem() const
Return the system name for the case, which is ../system() for parallel runs.
Definition: TimePathsI.H:135
A class for handling words, derived from Foam::string.
Definition: word.H:63
static Istream & input(Istream &is, IntRange< T > &range)
Definition: IntRanges.C:33
const word & system() const noexcept
Return system name.
Definition: TimePathsI.H:118
const direction noexcept
Definition: Scalar.H:258
fileName caseConstant() const
Return the constant name for the case, which is ../constant() for parallel runs.
Definition: TimePathsI.H:124
bool distributed() const noexcept
True if case running with parallel distributed directories (ie. not NFS mounted)
Definition: TimePathsI.H:46
const word & constant() const noexcept
Return constant name.
Definition: TimePathsI.H:112
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
const fileName & rootPath() const noexcept
Return root path.
Definition: TimePathsI.H:66
const fileName & globalCaseName() const noexcept
Return global case name.
Definition: TimePathsI.H:72
TimePaths(const bool processorCase, const fileName &rootPath, const bool distributed, const fileName &globalCaseName, const fileName &caseName, const word &systemDirName="system", const word &constantDirName="constant")
Construct from all components.
Definition: TimePaths.C:62
fileName path() const
Return path for the case = rootPath/caseName.
Definition: TimePathsI.H:90
int system(const std::string &command, const bool bg=false)
Execute the specified command via the shell.
Definition: POSIX.C:1702
const fileName & caseName() const noexcept
Return case name.
Definition: TimePathsI.H:78
fileName globalPath() const
Return global path for the case = rootPath/globalCaseName.
Definition: TimePathsI.H:96