Loading...
Searching...
No Matches
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-2025 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
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:
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 * * * * * * * * * * * * * //
53inline bool Foam::TimePaths::distributed() const noexcept
54{
55 return distributed_;
56}
57
60{
61 return processorCase_;
62}
63
64
65inline bool Foam::TimePaths::processorCase(bool on) noexcept
67 bool old(processorCase_);
68 processorCase_ = on;
69 return old;
70}
71
74{
75 return rootPath_;
76}
77
80{
81 return globalCaseName_;
82}
83
86{
87 return caseName_;
88}
89
90
92{
93 return caseName_;
94}
95
96
97inline const Foam::fileName&
99{
100 return
101 (
103 ? globalCaseName_
104 : caseName_
105 );
106}
107
110{
111 return rootPath()/caseName();
112}
113
114
116{
117 return rootPath()/globalCaseName();
118}
119
120
123{
124 return rootPath()/caseName(layout);
125}
126
127
129(
130 const fileName& input,
131 const bool caseTag
132) const
133{
134 return input.relative(globalPath(), caseTag);
135}
136
139{
140 return constant_;
141}
142
144inline const Foam::word& Foam::TimePaths::system() const noexcept
145{
146 return system_;
147}
148
149
151{
152 if (processorCase_)
153 {
154 return ".."/constant();
155 }
156
157 return constant();
158}
159
160
163 if (processorCase_)
164 {
165 return ".."/system();
166 }
168 return system();
169}
170
173{
174 return path()/constant();
175}
176
179{
180 return path()/system();
181}
183
184// ************************************************************************* //
Layout
The layout of the case structure.
@ global
Global case layout (serial locations).
const word & system() const noexcept
Return system name.
Definition TimePathsI.H:137
bool distributed() const noexcept
True if case running with parallel distributed directories (ie. not NFS mounted).
Definition TimePathsI.H:46
const fileName & rootPath() const noexcept
Return root path.
Definition TimePathsI.H:66
const word & constant() const noexcept
Return constant name.
Definition TimePathsI.H:131
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:122
fileName caseConstant() const
Return the constant name for the case, which is ../constant() for parallel runs.
Definition TimePathsI.H:143
const fileName & globalCaseName() const noexcept
Return global case name.
Definition TimePathsI.H:72
fileName path() const
Return path for the case = rootPath/caseName.
Definition TimePathsI.H:102
fileName caseSystem() const
Return the system name for the case, which is ../system() for parallel runs.
Definition TimePathsI.H:154
bool processorCase() const noexcept
True if this is a processor case.
Definition TimePathsI.H:52
fileName constantPath() const
Return constant path.
Definition TimePathsI.H:165
fileName systemPath() const
Return system path.
Definition TimePathsI.H:171
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
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:108
A class for handling file names.
Definition fileName.H:75
fileName relative(const fileName &parent, const bool caseTag=false) const
Return a relative name by stripping off the parent directory where possible.
Definition fileName.C:443
A class for handling words, derived from Foam::string.
Definition word.H:66
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
Different types of constants.
int system(const std::string &command, const bool bg=false)
Execute the specified command via the shell.
Definition POSIX.C:1704
const direction noexcept
Definition scalarImpl.H:265