fvFieldReconstructor.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) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2018-2022 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::fvFieldReconstructor
29 
30 Description
31  Finite volume reconstructor for volume and surface fields.
32 
33 SourceFiles
34  fvFieldReconstructor.C
35  fvFieldReconstructorTemplates.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef Foam_fvFieldReconstructor_H
40 #define Foam_fvFieldReconstructor_H
41 
42 #include "PtrList.H"
43 #include "fvMesh.H"
44 #include "IOobjectList.H"
45 #include "fvPatchFieldMapper.H"
46 #include "labelIOList.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class fvFieldReconstructor Declaration
55 \*---------------------------------------------------------------------------*/
56 
58 {
59  // Private Data
60 
61  //- Reconstructed mesh reference
62  fvMesh& mesh_;
63 
64  //- List of processor meshes
65  const PtrList<fvMesh>& procMeshes_;
66 
67  //- List of processor face addressing lists
68  const PtrList<labelIOList>& faceProcAddressing_;
69 
70  //- List of processor cell addressing lists
71  const PtrList<labelIOList>& cellProcAddressing_;
72 
73  //- List of processor boundary addressing lists
74  const PtrList<labelIOList>& boundaryProcAddressing_;
75 
76  //- Number of fields reconstructed
77  label nReconstructed_;
78 
79 
80  // Private Member Functions
81 
82  //- No copy construct
84 
85  //- No copy assignment
86  void operator=(const fvFieldReconstructor&) = delete;
87 
88 
89 public:
90 
91  // Public Classes
92 
93  //- Mapper for sizing only - does not do any actual mapping.
95  :
96  public fvPatchFieldMapper
97  {
98  label size_;
99 
100  public:
101 
102  // Constructors
103 
104  //- Construct given size
105  fvPatchFieldReconstructor(const label size)
106  :
107  size_(size)
108  {}
109 
110 
111  // Member functions
112 
113  label size() const
114  {
115  return size_;
116  }
117 
118  bool direct() const
119  {
120  return true;
121  }
122 
123  bool hasUnmapped() const
124  {
125  return false;
126  }
127 
129  {
130  return labelUList::null();
131  }
132  };
134 
135  // Static Data
136 
137  //- Output verbosity when writing
138  static int verbose_;
139 
140 
141  // Constructors
142 
143  //- Construct from components
145  (
146  fvMesh& mesh,
147  const PtrList<fvMesh>& procMeshes,
148  const PtrList<labelIOList>& faceProcAddressing,
149  const PtrList<labelIOList>& cellProcAddressing,
150  const PtrList<labelIOList>& boundaryProcAddressing
151  );
152 
153 
154  // Member Functions
156  //- Return number of fields reconstructed
157  label nReconstructed() const noexcept
158  {
159  return nReconstructed_;
160  }
161 
162  //- Reconstruct volume internal field
163  template<class Type>
166  (
167  const IOobject& fieldObject,
168  const PtrList<DimensionedField<Type, volMesh>>& procFields
169  ) const;
170 
171  //- Read and reconstruct volume internal field
172  template<class Type>
174  reconstructInternalField(const IOobject& fieldObject) const;
175 
176 
177  //- Reconstruct volume field
178  template<class Type>
181  (
182  const IOobject& fieldObject,
184  ) const;
185 
186  //- Read and reconstruct volume field
187  template<class Type>
189  reconstructVolumeField(const IOobject& fieldObject) const;
190 
191 
192  //- Reconstruct surface field
193  template<class Type>
196  (
197  const IOobject& fieldObject,
199  ) const;
200 
201  //- Read and reconstruct surface field
202  template<class Type>
204  reconstructSurfaceField(const IOobject& fieldObject) const;
205 
206 
207  //- Read, reconstruct and write specified volume internal fields
208  template<class Type>
210  (
211  const UPtrList<const IOobject>& fieldObjects
212  );
213 
214  //- Read, reconstruct and write specified volume fields
215  template<class Type>
217  (
218  const UPtrList<const IOobject>& fieldObjects
219  );
220 
221  //- Read, reconstruct and write specified surface fields
222  template<class Type>
224  (
225  const UPtrList<const IOobject>& fieldObjects
226  );
227 
228 
229  //- Read, reconstruct and write all/selected volume internal fields
230  // An empty wordRes corresponds to select ALL.
231  template<class Type>
233  (
234  const IOobjectList& objects,
235  const wordRes& selectedFields = wordRes()
236  );
237 
238  //- Read, reconstruct and write all/selected volume fields
239  // An empty wordRes corresponds to select ALL.
240  template<class Type>
242  (
243  const IOobjectList& objects,
244  const wordRes& selectedFields = wordRes()
245  );
246 
247  //- Read, reconstruct and write all/selected surface fields
248  // An empty wordRes corresponds to select ALL.
249  template<class Type>
251  (
252  const IOobjectList& objects,
253  const wordRes& selectedFields = wordRes()
254  );
255 
256  //- Reconstruct all known field types
258  (
259  const IOobjectList& objects,
260  const wordRes& selectedFields = wordRes()
261  );
262 };
263 
264 
265 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
266 
267 } // End namespace Foam
268 
269 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
270 
271 #ifdef NoRepository
273 #endif
274 
275 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
276 
277 #endif
278 
279 // ************************************************************************* //
List of IOobjects with searching and retrieving facilities. Implemented as a HashTable, so the various sorted methods should be used if traversing in parallel.
Definition: IOobjectList.H:55
label nReconstructed() const noexcept
Return number of fields reconstructed.
tmp< GeometricField< Type, fvPatchField, volMesh > > reconstructVolumeField(const IOobject &fieldObject) const
Read and reconstruct volume field.
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > reconstructSurfaceField(const IOobject &fieldObject) const
Read and reconstruct surface field.
Generic GeometricField class.
Definition: areaFieldsFwd.H:50
dynamicFvMesh & mesh
tmp< DimensionedField< Type, volMesh > > reconstructInternalField(const IOobject &fieldObject) const
Read and reconstruct volume internal field.
A FieldMapper for finite-volume patch fields.
fvPatchFieldReconstructor(const label size)
Construct given size.
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:53
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition: HashTable.H:106
label reconstructAllFields(const IOobjectList &objects, const wordRes &selectedFields=wordRes())
Reconstruct all known field types.
const direction noexcept
Definition: Scalar.H:258
const labelUList & directAddressing() const
Return the direct addressing values.
label reconstructVolumeFields(const UPtrList< const IOobject > &fieldObjects)
Read, reconstruct and write specified volume fields.
Finite volume reconstructor for volume and surface fields.
static const UList< label > & null()
Return a UList reference to a nullObject.
Definition: UListI.H:90
Mapper for sizing only - does not do any actual mapping.
label reconstructInternalFields(const UPtrList< const IOobject > &fieldObjects)
Read, reconstruct and write specified volume internal fields.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Definition: List.H:55
tmp< DimensionedField< Type, volMesh > > reconstructField(const IOobject &fieldObject, const PtrList< DimensionedField< Type, volMesh >> &procFields) const
Reconstruct volume internal field.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
static int verbose_
Output verbosity when writing.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
bool direct() const
Is it a direct (non-interpolating) mapper?
label reconstructSurfaceFields(const UPtrList< const IOobject > &fieldObjects)
Read, reconstruct and write specified surface fields.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:172
Namespace for OpenFOAM.