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 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  fvFieldReconstructorFields.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef fvFieldReconstructor_H
40 #define 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  //- Mapper for sizing only - does not do any actual mapping.
93  :
94  public fvPatchFieldMapper
95  {
96  label size_;
97 
98  public:
99 
100  // Constructors
101 
102  //- Construct given size
103  fvPatchFieldReconstructor(const label size)
104  :
105  size_(size)
106  {}
107 
108 
109  // Member functions
110 
111  label size() const
112  {
113  return size_;
114  }
115 
116  bool direct() const
117  {
118  return true;
119  }
120 
121  bool hasUnmapped() const
122  {
123  return false;
124  }
125 
126  const labelUList& directAddressing() const
127  {
128  return labelUList::null();
129  }
130  };
131 
132 
133  // Constructors
134 
135  //- Construct from components
137  (
138  fvMesh& mesh,
139  const PtrList<fvMesh>& procMeshes,
141  const PtrList<labelIOList>& cellProcAddressing,
142  const PtrList<labelIOList>& boundaryProcAddressing
143  );
144 
145 
146  // Member Functions
147 
148  //- Return number of fields reconstructed
149  label nReconstructed() const
150  {
151  return nReconstructed_;
152  }
153 
154  //- Reconstruct volume internal field
155  template<class Type>
158  (
159  const IOobject& fieldIoObject,
160  const PtrList<DimensionedField<Type, volMesh>>& procFields
161  ) const;
162 
163  //- Read and reconstruct volume internal field
164  template<class Type>
166  reconstructFvVolumeInternalField(const IOobject& fieldIoObject) const;
167 
168 
169  //- Reconstruct volume field
170  template<class Type>
173  (
174  const IOobject& fieldIoObject,
176  ) const;
177 
178  //- Read and reconstruct volume field
179  template<class Type>
181  reconstructFvVolumeField(const IOobject& fieldIoObject) const;
182 
183 
184  //- Reconstruct surface field
185  template<class Type>
188  (
189  const IOobject& fieldIoObject,
191  ) const;
192 
193  //- Read and reconstruct surface field
194  template<class Type>
196  reconstructFvSurfaceField(const IOobject& fieldIoObject) const;
197 
198  //- Read, reconstruct and write specified volume internal fields
199  template<class Type>
201  (
202  const IOobjectList& objects,
203  const UList<word>& fieldNames
204  );
205 
206  //- Read, reconstruct and write specified volume fields
207  template<class Type>
209  (
210  const IOobjectList& objects,
211  const UList<word>& fieldNames
212  );
213 
214  //- Read, reconstruct and write specified surface fields
215  template<class Type>
217  (
218  const IOobjectList& objects,
219  const UList<word>& fieldNames
220  );
221 
222 
223  //- Read, reconstruct and write all/selected volume internal fields
224  // An empty wordRes corresponds to select ALL.
225  template<class Type>
227  (
228  const IOobjectList& objects,
229  const wordRes& selectedFields = wordRes()
230  );
231 
232  //- Read, reconstruct and write all/selected volume fields
233  // An empty wordRes corresponds to select ALL.
234  template<class Type>
236  (
237  const IOobjectList& objects,
238  const wordRes& selectedFields = wordRes()
239  );
240 
241  //- Read, reconstruct and write all/selected surface fields
242  // An empty wordRes corresponds to select ALL.
243  template<class Type>
245  (
246  const IOobjectList& objects,
247  const wordRes& selectedFields = wordRes()
248  );
249 
250  //- Read, reconstruct and write all/selected volume internal fields
251  // An empty wordHashSet corresponds to select ALL.
252  // \note this may be removed in the future (2018-11)
253  template<class Type>
255  (
256  const IOobjectList& objects,
257  const wordHashSet& selectedFields
258  );
259 
260  //- Read, reconstruct and write all/selected volume fields
261  // An empty wordHashSet corresponds to select ALL.
262  // \note this may be removed in the future (2018-11)
263  template<class Type>
265  (
266  const IOobjectList& objects,
267  const wordHashSet& selectedFields
268  );
269 
270  //- Read, reconstruct and write all/selected surface fields
271  // An empty wordHashSet corresponds to select ALL.
272  // \note this may be removed in the future (2018-11)
273  template<class Type>
275  (
276  const IOobjectList& objects,
277  const wordHashSet& selectedFields
278  );
279 };
280 
281 
282 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
283 
284 } // End namespace Foam
285 
286 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
287 
288 #ifdef NoRepository
290 #endif
291 
292 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
293 
294 #endif
295 
296 // ************************************************************************* //
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
faceProcAddressing
PtrList< labelIOList > & faceProcAddressing
Definition: checkFaceAddressingComp.H:9
Foam::fvFieldReconstructor::reconstructFvVolumeField
tmp< GeometricField< Type, fvPatchField, volMesh > > reconstructFvVolumeField(const IOobject &fieldIoObject, const PtrList< GeometricField< Type, fvPatchField, volMesh >> &) const
Reconstruct volume field.
Foam::fvFieldReconstructor::reconstructFvVolumeInternalFields
label reconstructFvVolumeInternalFields(const IOobjectList &objects, const UList< word > &fieldNames)
Read, reconstruct and write specified volume internal fields.
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::fvFieldReconstructor::nReconstructed
label nReconstructed() const
Return number of fields reconstructed.
Definition: fvFieldReconstructor.H:148
IOobjectList.H
fvPatchFieldMapper.H
fvFieldReconstructorFields.C
Foam::HashSet< word, Hash< word > >
Foam::fvFieldReconstructor::reconstructFvSurfaceField
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > reconstructFvSurfaceField(const IOobject &fieldIoObject, const PtrList< GeometricField< Type, fvsPatchField, surfaceMesh >> &) const
Reconstruct surface field.
Foam::fvFieldReconstructor::fvPatchFieldReconstructor::hasUnmapped
bool hasUnmapped() const
Are there unmapped values? I.e. do all size() elements get.
Definition: fvFieldReconstructor.H:120
Foam::fvFieldReconstructor::fvPatchFieldReconstructor
Mapper for sizing only - does not do any actual mapping.
Definition: fvFieldReconstructor.H:91
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:59
Foam::fvFieldReconstructor::fvPatchFieldReconstructor::size
label size() const
Definition: fvFieldReconstructor.H:110
fieldNames
const wordRes fieldNames(propsDict.getOrDefault< wordRes >("fields", wordRes()))
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::IOobjectList
List of IOobjects with searching and retrieving facilities.
Definition: IOobjectList.H:55
Foam::fvFieldReconstructor
Finite volume reconstructor for volume and surface fields.
Definition: fvFieldReconstructor.H:56
labelIOList.H
Foam::UList< label >
Foam::wordRes
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:51
Foam::fvFieldReconstructor::fvPatchFieldReconstructor::directAddressing
const labelUList & directAddressing() const
Definition: fvFieldReconstructor.H:125
PtrList.H
Foam::fvFieldReconstructor::reconstructFvVolumeInternalField
tmp< DimensionedField< Type, volMesh > > reconstructFvVolumeInternalField(const IOobject &fieldIoObject, const PtrList< DimensionedField< Type, volMesh >> &procFields) const
Reconstruct volume internal field.
Foam::fvFieldReconstructor::fvPatchFieldReconstructor::direct
bool direct() const
Definition: fvFieldReconstructor.H:115
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::UList::null
static const UList< T > & null()
Return a UList reference to a nullObject.
Definition: UListI.H:53
Foam::GeometricField< Type, fvPatchField, volMesh >
Foam::fvFieldReconstructor::reconstructFvSurfaceFields
label reconstructFvSurfaceFields(const IOobjectList &objects, const UList< word > &fieldNames)
Read, reconstruct and write specified surface fields.
Foam::fvFieldReconstructor::reconstructFvVolumeFields
label reconstructFvVolumeFields(const IOobjectList &objects, const UList< word > &fieldNames)
Read, reconstruct and write specified volume fields.
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54
Foam::fvFieldReconstructor::fvPatchFieldReconstructor::fvPatchFieldReconstructor
fvPatchFieldReconstructor(const label size)
Construct given size.
Definition: fvFieldReconstructor.H:102