TimeNew.C
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) 2019-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 #include "Time.H"
29 #include "argList.H"
30 
31 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
32 
34 {
35  return autoPtr<Time>::New
36  (
37  fileName("."), // root-path
38  fileName("."), // case-name
39  false, // No enableFunctionObjects
40  false // No enableLibs
41  );
42 }
43 
44 // FUTURE?
45 // Foam::autoPtr<Foam::Time> Foam::Time::New(const Time& runTime)
46 // {
47 // fileName caseDir(runTime.path());
48 // caseDir.toAbsolute();
49 //
50 // return autoPtr<Time>::New
51 // (
52 // caseDir.path(), // root-path
53 // caseDir.name(), // case-name
54 // false, // No enableFunctionObjects
55 // false // No enableLibs
56 // );
57 // }
58 
59 
61 {
62  return autoPtr<Time>::New
63  (
64  caseDir.path(), // root-path
65  caseDir.name(), // case-name
66  false, // No enableFunctionObjects
67  false // No enableLibs
68  );
69 }
70 
71 
73 {
74  return autoPtr<Time>::New
75  (
77  args,
78  false, // No enableFunctionObjects
79  false, // No enableLibs
80  IOobjectOption::MUST_READ // No re-reading
81  );
82 }
83 
84 
86 {
88  caseDir.toAbsolute();
89 
90  return autoPtr<Time>::New
91  (
92  caseDir.path(), // root-path
93  caseDir.name(), // case-name
94  false, // No enableFunctionObjects
95  false // No enableLibs
96  );
97 }
98 
99 
101 {
102  fileName caseDir(runTime.globalPath());
103  caseDir.toAbsolute();
104 
105  return autoPtr<Time>::New
106  (
107  caseDir.path(), // root-path
108  caseDir.name(), // case-name
109  false, // No enableFunctionObjects
110  false // No enableLibs
111  );
112 }
113 
114 
115 // ************************************************************************* //
A class for handling file names.
Definition: fileName.H:72
static autoPtr< Time > NewGlobalTime()
Construct (dummy) global Time - no functionObjects or libraries, using the global path information st...
Definition: TimeNew.C:78
engineTime & runTime
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: TimeNew.C:26
static std::string path(const std::string &str)
Return directory path name (part before last /)
Definition: fileNameI.H:169
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:69
fileName globalPath() const
Return global path for the case = rootPath/globalCaseName. Same as TimePaths::globalPath() ...
Definition: Time.H:512
Extract command arguments and options from the supplied argc and argv parameters. ...
Definition: argList.H:118
static word controlDictName
The default control dictionary name (normally "controlDict")
Definition: Time.H:268
fileName & toAbsolute()
Convert from relative to absolute.
Definition: fileName.C:370
static std::string name(const std::string &str)
Return basename (part beyond last /), including its extension.
Definition: fileNameI.H:192
static fileName envGlobalPath()
Global case (directory) from environment variable.
Definition: argList.C:651
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
Definition: autoPtr.H:178
Foam::argList args(argc, argv)