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 Example of function object specification:
42 \verbatim
43 syncObjects1
44 {
45 type syncObjects;
46 libs ("libutilityFunctionObjects.so");
47 ...
48
49 // Where is data located relative to runTime. Given as a filename
50 // with every '/' indicating a sub-objectRegistry w.r.t. runTime.
51 // Local data is under <root>/send/processorXXX. After execution
52 // (potentially remote) data will be under the corresponding
53 // <root>/receive/processorYYY objectRegistry.
54 //root "level0/level1/level2";
55 }
56 \endverbatim
57
58 Where the entries comprise:
59 \table
60 Property | Description | Required | Default value
61 type | type name: syncObjects | yes |
62 root | relative location of data | no | ""
63 \endtable
64
65See also
66 Foam::functionObject
67
68SourceFiles
69 syncObjects.C
70
71\*---------------------------------------------------------------------------*/
72
73#ifndef functionObjects_syncObjects_H
74#define functionObjects_syncObjects_H
75
76#include "token.H"
77#include "functionObject.H"
78#include "IOField.H"
79
80// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
81
82namespace Foam
83{
84
85// Forward declaration of classes
86class objectRegistry;
87
88namespace functionObjects
89{
90
91/*---------------------------------------------------------------------------*\
92 Class functionObjects::syncObjects Declaration
93\*---------------------------------------------------------------------------*/
94
95class syncObjects
96:
97 public functionObject
98{
99private:
100
101 // Private data
102
103 //- Top-level registry
104 const objectRegistry& obr_;
105
106 //- objectRegistry location relative to top-level
107 fileName root_;
108
110 // Private Member Functions
111
112 //- No copy construct
113 syncObjects(const syncObjects&) = delete;
114
115 //- No copy assignment
116 void operator=(const syncObjects&) = delete;
117
118
119protected:
120
121 //- Do all: synchronise all IOFields and objectRegistry
122 void sync();
123
124
125public:
126
127 //- Runtime type information
128 TypeName("syncObjects");
129
130
131 // Constructors
132
133 //- Construct from Time and dictionary
135 (
136 const word& name,
137 const Time& runTime,
138 const dictionary& dict
139 );
140
141
142 //- Destructor
143 virtual ~syncObjects() = default;
144
145
146 // Member Functions
147
148 const objectRegistry& obr() const
149 {
150 return obr_;
151 }
152
153 const fileName& root() const
154 {
155 return root_;
156 }
158 //- Read the syncObjects data
159 virtual bool read(const dictionary&);
160
161 //- Do nothing
162 virtual bool execute();
163
164 //- Write the registered objects
165 virtual bool write();
166};
168
169// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170
171} // End namespace functionObjects
172} // End namespace Foam
173
174// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175
176#endif
177
178// ************************************************************************* //
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A class for handling file names.
Definition: fileName.H:76
Abstract base-class for Time/database function objects.
const word & name() const noexcept
Return the name of this functionObject.
Copies content of local objectRegistry to all processors.
Definition: syncObjects.H:112
const objectRegistry & obr() const
Definition: syncObjects.H:162
virtual ~syncObjects()=default
Destructor.
TypeName("syncObjects")
Runtime type information.
void sync()
Do all: synchronise all IOFields and objectRegistry.
Definition: syncObjects.C:70
virtual bool execute()
Do nothing.
Definition: syncObjects.C:195
virtual bool write()
Write the registered objects.
Definition: syncObjects.C:208
virtual bool read(const dictionary &)
Read the syncObjects data.
Definition: syncObjects.C:172
const fileName & root() const
Definition: syncObjects.H:167
Registry of regIOobjects.
A class for handling words, derived from Foam::string.
Definition: word.H:68
engineTime & runTime
Namespace for OpenFOAM.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73