fileOperationInitialise.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) 2017-2018 OpenFOAM Foundation
9  Copyright (C) 2023 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::fileOperationInitialise
29 
30 Description
31  General fileOperation initialiser.
32  Handles \c -ioRanks option, using it to set the FOAM_IORANKS environment
33  variable.
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef Foam_fileOperations_fileOperationInitialise_H
38 #define Foam_fileOperations_fileOperationInitialise_H
39 
40 #include "runTimeSelectionTables.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 namespace fileOperations
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class fileOperationInitialise Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 {
55 public:
56 
57  //- Runtime type information
58  TypeName("fileOperationInitialise");
59 
60 
61  // Constructors
62 
63  //- Construct from components
64  fileOperationInitialise(int& argc, char**& argv);
65 
66 
67  // Declare run-time constructor selection table
68 
70  (
71  autoPtr,
73  word,
74  (
75  int& argc, char**& argv
76  ),
77  (argc, argv)
78  );
79 
80 
81  // Selectors
82 
83  //- Select initialisation type
85  (
86  const word& type, int& argc, char**& argv
87  );
88 
89 
90  //- Destructor
91  virtual ~fileOperationInitialise() = default;
92 
93 
94  // Member Functions
95 
96  //- Requires (MPI) threading?
97  virtual bool needsThreading() const = 0;
98 };
99 
100 
101 /*---------------------------------------------------------------------------*\
102  Class fileOperationInitialise_unthreaded Declaration
103 \*---------------------------------------------------------------------------*/
104 
105 //- A fileOperation initialiser for unthreaded file handlers.
107 :
109 {
110 public:
112  // Constructors
113 
114  //- Construct from components
115  fileOperationInitialise_unthreaded(int& argc, char**& argv)
116  :
117  fileOperationInitialise(argc, argv)
118  {}
119 
120 
121  //- Destructor
123 
124 
125  // Member Functions
126 
127  //- No (MPI) threading required
128  virtual bool needsThreading() const { return false; }
129 };
130 
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 } // End namespace fileOperations
135 } // End namespace Foam
136 
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 
139 #endif
140 
141 // ************************************************************************* //
TypeName("fileOperationInitialise")
Runtime type information.
virtual ~fileOperationInitialise_unthreaded()=default
Destructor.
static autoPtr< fileOperationInitialise > New(const word &type, int &argc, char **&argv)
Select initialisation type.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: POSIX.C:799
A class for handling words, derived from Foam::string.
Definition: word.H:63
fileOperationInitialise(int &argc, char **&argv)
Construct from components.
fileOperationInitialise_unthreaded(int &argc, char **&argv)
Construct from components.
A fileOperation initialiser for unthreaded file handlers.
virtual ~fileOperationInitialise()=default
Destructor.
virtual bool needsThreading() const =0
Requires (MPI) threading?
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
Macros to ease declaration of run-time selection tables.
declareRunTimeSelectionTable(autoPtr, fileOperationInitialise, word,(int &argc, char **&argv),(argc, argv))
virtual bool needsThreading() const
No (MPI) threading required.
Namespace for OpenFOAM.