RemoteData.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2022-2025 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::RemoteData
26 
27 Description
28  Struct for keeping processor, element (cell, face, point) and a piece of
29  data. Used for finding minimum values across multiple processes.
30 
31 SourceFiles
32  RemoteDataI.H
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef RemoteData_H
37 #define RemoteData_H
38 
39 #include "remote.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 // Forward declaration of friend functions and operators
47 template<class Type>
48 class RemoteData;
49 template<class Type>
50 inline bool operator==(const RemoteData<Type>&, const RemoteData<Type>&);
51 template<class Type>
52 inline bool operator!=(const RemoteData<Type>&, const RemoteData<Type>&);
53 template<class Type>
55 template<class Type>
56 inline Ostream& operator<<(Ostream&, const RemoteData<Type>&);
57 
58 /*---------------------------------------------------------------------------*\
59  Class RemoteData Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 template<class Type>
63 class RemoteData
64 :
65  public remote
66 {
67 public:
68 
69  //- Component type
70  typedef RemoteData<Type> cmptType;
71 
72 
73  // Public Data
74 
75  //- Data
76  Type data;
77 
78 
79  // Constructors
80 
81  //- Construct null
82  inline RemoteData();
83 
84  //- Construct from components
85  inline RemoteData(const label, const label, const Type&);
86 
87  //- Construct from element index and data. Pstream will be used to
88  // determine the processor index.
89  inline RemoteData(const label, const Type&);
90 
91  //- Construct from stream
92  inline RemoteData(Istream& is);
93 
94 
95  // Public Classes
96 
97  //- Operator to take the first valid process
98  struct firstProcOp
99  {
100  inline RemoteData<Type> operator()
101  (
102  const RemoteData<Type>& a,
103  const RemoteData<Type>& b
104  ) const;
105  };
106 
107  //- Operator to take the first valid process
108  struct firstProcEqOp
109  {
110  inline void operator()
111  (
112  RemoteData<Type>& a,
113  const RemoteData<Type>& b
114  ) const;
115  };
116 
117  //- Operator to take smallest valid value
118  struct smallestEqOp
119  {
120  inline void operator()
121  (
122  RemoteData<Type>& a,
123  const RemoteData<Type>& b
124  ) const;
125  };
126 
127  //- Operator to take greatest valid value
128  struct greatestEqOp
129  {
130  inline void operator()
131  (
132  RemoteData<Type>& a,
133  const RemoteData<Type>& b
134  ) const;
135  };
136 
137  //- Operator to take smallest first valid value
138  struct smallestFirstEqOp
139  {
140  inline void operator()
141  (
142  RemoteData<Type>& a,
143  const RemoteData<Type>& b
144  ) const;
145  };
146 
147  //- Operator to take greatest first valid value
148  struct greatestFirstEqOp
149  {
150  inline void operator()
151  (
152  RemoteData<Type>& a,
153  const RemoteData<Type>& b
154  ) const;
155  };
156 
157 
158  // Friend Operators
159 
160  //- Equality comparison
161  friend bool operator== <Type>
162  (
163  const RemoteData<Type>& a,
164  const RemoteData<Type>& b
165  );
166 
167  //- Inequality comparison
168  friend bool operator!= <Type>
169  (
170  const RemoteData<Type>& a,
171  const RemoteData<Type>& b
172  );
173 
174 
175  // IOstream Operators
176 
177  //- Write to stream
178  friend Ostream& operator<< <Type>
179  (
180  Ostream& os,
181  const RemoteData<Type>& p
182  );
183 
184  //- Read from stream
185  friend Istream& operator>> <Type>
186  (
187  Istream& is,
189  );
190 };
191 
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 } // End namespace Foam
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 #include "RemoteDataI.H"
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 #endif
204 
205 // ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Struct for keeping processor, element (cell, face, point) and a piece of data. Used for finding minim...
Definition: RemoteData.H:65
RemoteData()
Construct null.
Definition: RemoteDataI.H:31
RemoteData< Type > cmptType
Component type.
Definition: RemoteData.H:69
friend Ostream & operator(Ostream &os, const RemoteData< Type > &p)
Write to stream.
Type data
Data.
Definition: RemoteData.H:75
Struct for keeping processor, element (cell, face, point) index.
Definition: remote.H:57
volScalarField & b
Definition: createFields.H:27
Namespace for OpenFOAM.
bool operator!=(const particle &, const particle &)
Definition: particle.C:424
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
Istream & operator>>(Istream &, pistonPointEdgeData &)
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)
volScalarField & p
Operator to take the first valid process.
Definition: RemoteData.H:108
Operator to take the first valid process.
Definition: RemoteData.H:98
Operator to take greatest valid value.
Definition: RemoteData.H:128
Operator to take greatest first valid value.
Definition: RemoteData.H:148
Operator to take smallest valid value.
Definition: RemoteData.H:118
Operator to take smallest first valid value.
Definition: RemoteData.H:138