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 | Copyright (C) 2011-2016 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::fvFieldReconstructor
26 
27 Description
28  Finite volume reconstructor for volume and surface fields.
29 
30 SourceFiles
31  fvFieldReconstructor.C
32  fvFieldReconstructorReconstructFields.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef fvFieldReconstructor_H
37 #define fvFieldReconstructor_H
38 
39 #include "PtrList.H"
40 #include "fvMesh.H"
41 #include "IOobjectList.H"
42 #include "fvPatchFieldMapper.H"
43 #include "labelIOList.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 
51 /*---------------------------------------------------------------------------*\
52  Class fvFieldReconstructor Declaration
53 \*---------------------------------------------------------------------------*/
54 
56 {
57  // Private data
58 
59  //- Reconstructed mesh reference
60  fvMesh& mesh_;
61 
62  //- List of processor meshes
63  const PtrList<fvMesh>& procMeshes_;
64 
65  //- List of processor face addressing lists
66  const PtrList<labelIOList>& faceProcAddressing_;
67 
68  //- List of processor cell addressing lists
69  const PtrList<labelIOList>& cellProcAddressing_;
70 
71  //- List of processor boundary addressing lists
72  const PtrList<labelIOList>& boundaryProcAddressing_;
73 
74  //- Number of fields reconstructed
75  label nReconstructed_;
76 
77 
78  // Private Member Functions
79 
80  //- Disallow default bitwise copy construct
82 
83  //- Disallow default bitwise assignment
84  void operator=(const fvFieldReconstructor&);
85 
86 
87 public:
88 
89  //- Mapper for sizing only - does not do any actual mapping.
91  :
92  public fvPatchFieldMapper
93  {
94  label size_;
95 
96  public:
97 
98  // Constructors
99 
100  //- Construct given size
102  :
103  size_(size)
104  {}
105 
106 
107  // Member functions
109  label size() const
110  {
111  return size_;
112  }
114  bool direct() const
115  {
116  return true;
117  }
119  bool hasUnmapped() const
120  {
121  return false;
122  }
124  const labelUList& directAddressing() const
125  {
126  return labelUList::null();
127  }
128  };
129 
130 
131  // Constructors
132 
133  //- Construct from components
135  (
136  fvMesh& mesh,
137  const PtrList<fvMesh>& procMeshes,
139  const PtrList<labelIOList>& cellProcAddressing,
140  const PtrList<labelIOList>& boundaryProcAddressing
141  );
142 
143 
144  // Member Functions
145 
146  //- Return number of fields reconstructed
147  label nReconstructed() const
148  {
149  return nReconstructed_;
150  }
151 
152  //- Reconstruct volume internal field
153  template<class Type>
156  (
157  const IOobject& fieldIoObject,
158  const PtrList<DimensionedField<Type, volMesh>>& procFields
159  ) const;
160 
161  //- Read and reconstruct volume internal field
162  template<class Type>
164  reconstructFvVolumeInternalField(const IOobject& fieldIoObject) const;
165 
166 
167  //- Reconstruct volume field
168  template<class Type>
171  (
172  const IOobject& fieldIoObject,
174  ) const;
175 
176  //- Read and reconstruct volume field
177  template<class Type>
179  reconstructFvVolumeField(const IOobject& fieldIoObject) const;
180 
181 
182  //- Reconstruct surface field
183  template<class Type>
186  (
187  const IOobject& fieldIoObject,
189  ) const;
190 
191  //- Read and reconstruct surface field
192  template<class Type>
194  reconstructFvSurfaceField(const IOobject& fieldIoObject) const;
195 
196  //- Read, reconstruct and write all/selected volume internal fields
197  template<class Type>
199  (
200  const IOobjectList& objects,
201  const HashSet<word>& selectedFields
202  );
203 
204  //- Read, reconstruct and write all/selected volume fields
205  template<class Type>
207  (
208  const IOobjectList& objects,
209  const HashSet<word>& selectedFields
210  );
211 
212  //- Read, reconstruct and write all/selected surface fields
213  template<class Type>
215  (
216  const IOobjectList& objects,
217  const HashSet<word>& selectedFields
218  );
219 };
220 
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 } // End namespace Foam
225 
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 
228 #ifdef NoRepository
230 #endif
231 
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 
234 #endif
235 
236 // ************************************************************************* //
A HashTable with keys but without contents.
Definition: HashSet.H:59
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
List of IOobjects with searching and retrieving facilities.
Definition: IOobjectList.H:50
tmp< GeometricField< Type, fvPatchField, volMesh > > reconstructFvVolumeField(const IOobject &fieldIoObject, const PtrList< GeometricField< Type, fvPatchField, volMesh >> &) const
Reconstruct volume field.
PtrList< labelIOList > & faceProcAddressing
void reconstructFvSurfaceFields(const IOobjectList &objects, const HashSet< word > &selectedFields)
Read, reconstruct and write all/selected surface fields.
Generic GeometricField class.
dynamicFvMesh & mesh
bool hasUnmapped() const
Are there unmapped values? I.e. do all size() elements get.
Foam::fvPatchFieldMapper.
fvPatchFieldReconstructor(const label size)
Construct given size.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:61
Finite volume reconstructor for volume and surface fields.
static const UList< T > & null()
Return a null UList.
Definition: UListI.H:51
Mapper for sizing only - does not do any actual mapping.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:63
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
label nReconstructed() const
Return number of fields reconstructed.
tmp< DimensionedField< Type, volMesh > > reconstructFvVolumeInternalField(const IOobject &fieldIoObject, const PtrList< DimensionedField< Type, volMesh >> &procFields) const
Reconstruct volume internal field.
void reconstructFvVolumeFields(const IOobjectList &objects, const HashSet< word > &selectedFields)
Read, reconstruct and write all/selected volume fields.
A class for managing temporary objects.
Definition: PtrList.H:53
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
void reconstructFvVolumeInternalFields(const IOobjectList &objects, const HashSet< word > &selectedFields)
Read, reconstruct and write all/selected volume internal fields.
Namespace for OpenFOAM.
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > reconstructFvSurfaceField(const IOobject &fieldIoObject, const PtrList< GeometricField< Type, fvsPatchField, surfaceMesh >> &) const
Reconstruct surface field.