Loading...
Searching...
No Matches
syncObjects.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) 2020 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
26Class
27 Foam::functionObjects::syncObjects
28
29Group
30 grpUtilitiesFunctionObjects
31
32Description
33 Copies content of local objectRegistry to all processors.
34
35 Currently only supports IOFields. It is used to distribute IOFields
36 from different processors/regions/worlds
37 when doing loose coupling. To be used in combination with 'mapped'
38 boundary conditions.
39
40Usage
41 Minimal example by using \c system/controlDict.functions:
42 \verbatim
43 syncObjectsFO
44 {
45 // Mandatory entries
46 type syncObjects;
47 libs (utilityFunctionObjects);
48 ...
49
50 // Optional entries
51 // Where is data located relative to runTime. Given as a filename
52 // with every '/' indicating a sub-objectRegistry w.r.t. runTime.
53 // Local data is under <root>/send/processorXXX. After execution
54 // (potentially remote) data will be under the corresponding
55 // <root>/receive/processorYYY objectRegistry.
56 root <fileName>; // "level0/level1/level2";
57
58 // Inherited entries
59 ...
60 }
61 \endverbatim
62
63 where the entries mean:
64 \table
65 Property | Description | Type | Reqd | Deflt
66 type | Type name: syncObjects | word | yes | -
67 libs | Library name: utilityFunctionObjects | word | yes | -
68 root | Relative location of data | fileName | no | -
69 \endtable
70
71 The inherited entries are elaborated in:
72 - \link functionObject.H \endlink
73
74SourceFiles
75 syncObjects.C
76
77\*---------------------------------------------------------------------------*/
78
79#ifndef Foam_functionObjects_syncObjects_H
80#define Foam_functionObjects_syncObjects_H
81
82#include "token.H"
83#include "functionObject.H"
84#include "IOField.H"
85
86// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
87
88namespace Foam
89{
90
91// Forward declaration of classes
92class objectRegistry;
93
94namespace functionObjects
95{
96
97/*---------------------------------------------------------------------------*\
98 Class functionObjects::syncObjects Declaration
99\*---------------------------------------------------------------------------*/
100
101class syncObjects
102:
103 public functionObject
104{
105private:
106
107 // Private Data
108
109 //- Top-level registry
110 const objectRegistry& obr_;
111
112 //- objectRegistry location relative to top-level
113 fileName root_;
114
115
116 // Private Member Functions
117
118 //- No copy construct
119 syncObjects(const syncObjects&) = delete;
121 //- No copy assignment
122 void operator=(const syncObjects&) = delete;
123
124
125protected:
126
127 //- Do all: synchronise all IOFields and objectRegistry
128 void sync();
129
130
131public:
132
133 //- Runtime type information
134 TypeName("syncObjects");
135
136
137 // Constructors
138
139 //- Construct from name, Time and dictionary
140 syncObjects
141 (
142 const word& name,
143 const Time& runTime,
144 const dictionary& dict
145 );
146
147
148 //- Destructor
149 virtual ~syncObjects() = default;
150
151
152 // Member Functions
153
154 const objectRegistry& obr() const
155 {
156 return obr_;
157 }
158
159 const fileName& root() const
160 {
161 return root_;
162 }
163
164 //- Read the function-object dictionary
165 virtual bool read(const dictionary&);
166
167 //- Execute the function-object operations (no-op)
168 virtual bool execute();
169
170 //- Write the function-object results
171 virtual bool write();
172};
173
174
175// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176
177} // End namespace functionObjects
178} // End namespace Foam
179
180// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181
182#endif
183
184// ************************************************************************* //
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A class for handling file names.
Definition fileName.H:75
const word & name() const noexcept
Return the name of this functionObject.
functionObject(const word &name, const bool withNamePrefix=defaultUseNamePrefix)
Construct from components.
Copies content of local objectRegistry to all processors.
const objectRegistry & obr() const
virtual ~syncObjects()=default
Destructor.
TypeName("syncObjects")
Runtime type information.
void sync()
Do all: synchronise all IOFields and objectRegistry.
Definition syncObjects.C:63
virtual bool execute()
Execute the function-object operations (no-op).
virtual bool write()
Write the function-object results.
virtual bool read(const dictionary &)
Read the function-object dictionary.
const fileName & root() const
Registry of regIOobjects.
A class for handling words, derived from Foam::string.
Definition word.H:66
engineTime & runTime
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68