fvFieldReconstructor.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) 2011-2022 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 "surfaceFields.H"
41 #include "IOobjectList.H"
42 #include "fvPatchFieldMapper.H"
43 #include "setSizeFieldMapper.H"
44 #include "labelIOList.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 
52 /*---------------------------------------------------------------------------*\
53  Class fvFieldReconstructor Declaration
54 \*---------------------------------------------------------------------------*/
55 
57 {
58  // Private Data
59 
60  //- Reconstructed mesh reference
61  const fvMesh& completeMesh_;
62 
63  //- List of processor meshes
64  const PtrList<fvMesh>& procMeshes_;
65 
66  //- List of processor face addressing lists
67  const labelListList& faceProcAddressing_;
68 
69  //- List of processor cell addressing lists
70  const labelListList& cellProcAddressing_;
71 
72  //- Boundary field of face addressing
73  const PtrList<surfaceLabelField::Boundary>& faceProcAddressingBf_;
74 
75  //- Number of fields reconstructed
76  label nReconstructed_;
77 
78 
79  // Private Member Functions
80 
81  //- Convert a processor patch to the corresponding complete patch index
82  label completePatchID(const label proci, const label procPatchi) const;
83 
84  //- ...
85  template<class Type>
86  static void rmapFaceToFace
87  (
88  Field<Type>& toField,
89  const Field<Type>& fromField,
90  const labelUList& addressing,
91  const bool isFlux
92  );
93 
94 
95 public:
96 
97  //- Mapper for sizing only - does not do any actual mapping.
99  :
100  public fvPatchFieldMapper,
101  public setSizeFieldMapper
102  {
103  public:
104 
105  // Constructors
106 
107  //- Construct given size
108  fvPatchFieldReconstructor(const label size)
109  :
110  setSizeFieldMapper(size)
111  {}
112  };
113 
114 
115  // Constructors
116 
117  //- Construct from components
119  (
120  const fvMesh& mesh,
121  const PtrList<fvMesh>& procMeshes,
122  const labelListList& faceProcAddressing,
123  const labelListList& cellProcAddressing,
124  const PtrList<surfaceLabelField::Boundary>& faceProcAddressingBf
125  );
126 
127  //- Disallow default bitwise copy construction
129 
130 
131  // Member Functions
132 
133  //- Return number of fields reconstructed
134  label nReconstructed() const
135  {
136  return nReconstructed_;
137  }
138 
139  //- Reconstruct volume internal field
140  template<class Type>
143  (
144  const IOobject& fieldIoObject,
145  const PtrList<DimensionedField<Type, volMesh>>& procFields
146  ) const;
147 
148  //- Read and reconstruct volume internal field
149  template<class Type>
151  reconstructFvVolumeInternalField(const IOobject& fieldIoObject) const;
152 
153 
154  //- Reconstruct volume field
155  template<class Type>
158  (
159  const IOobject& fieldIoObject,
161  ) const;
162 
163  //- Read and reconstruct volume field
164  template<class Type>
166  reconstructFvVolumeField(const IOobject& fieldIoObject) const;
167 
168 
169  //- Reconstruct surface field
170  template<class Type>
173  (
174  const IOobject& fieldIoObject,
176  ) const;
177 
178  //- Read and reconstruct surface field
179  template<class Type>
181  reconstructFvSurfaceField(const IOobject& fieldIoObject) const;
182 
183  //- Read, reconstruct and write all/selected volume internal fields
184  template<class Type>
186  (
187  const IOobjectList& objects,
188  const HashSet<word>& selectedFields
189  );
190 
191  //- Read, reconstruct and write all/selected volume fields
192  template<class Type>
194  (
195  const IOobjectList& objects,
196  const HashSet<word>& selectedFields
197  );
198 
199  //- Read, reconstruct and write all/selected surface fields
200  template<class Type>
202  (
203  const IOobjectList& objects,
204  const HashSet<word>& selectedFields
205  );
206 
207 
208  // Member Operators
209 
210  //- Disallow default bitwise assignment
211  void operator=(const fvFieldReconstructor&) = delete;
212 };
213 
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 } // End namespace Foam
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 #ifdef NoRepository
223 #endif
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 #endif
228 
229 // ************************************************************************* //
Foam::surfaceFields.
A HashTable with keys but without contents.
Definition: HashSet.H:59
Field sizing mapper which sets the field size and does not map values.
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.
void reconstructFvSurfaceFields(const IOobjectList &objects, const HashSet< word > &selectedFields)
Read, reconstruct and write all/selected surface fields.
Generic GeometricField class.
fvMesh & mesh
void operator=(const fvFieldReconstructor &)=delete
Disallow default bitwise assignment.
Pre-declare SubField and related Field type.
Definition: Field.H:56
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:60
objects
Finite volume reconstructor for volume and surface fields.
Mapper for sizing only - does not do any actual mapping.
bool isFlux(const DimensionedField< Type, surfaceMesh > &df)
Check if surfaceField is a flux.
Definition: surfaceFields.H:55
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:70
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
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.
fvFieldReconstructor(const fvMesh &mesh, const PtrList< fvMesh > &procMeshes, const labelListList &faceProcAddressing, const labelListList &cellProcAddressing, const PtrList< surfaceLabelField::Boundary > &faceProcAddressingBf)
Construct from components.
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:98
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.