faFieldReconstructor.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) 2016-2017 Wikki Ltd
9  Copyright (C) 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::faFieldReconstructor
29 
30 Description
31  Finite Area area and edge fields reconstruction.
32 
33 Author
34  Zeljko Tukovic, FSB Zagreb
35  Hrvoje Jasak, Wikki Ltd.
36 
37 SourceFiles
38  faFieldReconstructor.C
39  faFieldReconstructorTemplates.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef Foam_faFieldReconstructor_H
44 #define Foam_faFieldReconstructor_H
45 
46 #include "PtrList.H"
47 #include "faMesh.H"
48 #include "IOobjectList.H"
49 #include "faPatchFieldMapper.H"
50 #include "labelIOList.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 /*---------------------------------------------------------------------------*\
58  Class faFieldReconstructor Declaration
59 \*---------------------------------------------------------------------------*/
60 
62 {
63  // Private Data
64 
65  //- Reconstructed mesh reference
66  faMesh& mesh_;
67 
68  //- List of processor meshes
69  const PtrList<faMesh>& procMeshes_;
70 
71  //- List of processor edge addressing lists
72  const PtrList<labelIOList>& edgeProcAddressing_;
73 
74  //- List of processor face addressing lists
75  const PtrList<labelIOList>& faceProcAddressing_;
76 
77  //- List of processor boundary addressing lists
78  const PtrList<labelIOList>& boundaryProcAddressing_;
79 
80  //- Number of fields reconstructed
81  label nReconstructed_;
82 
83 
84  // Private Member Functions
85 
86  //- No copy construct
88 
89  //- No copy assignment
90  void operator=(const faFieldReconstructor&) = delete;
91 
92 
93 public:
94 
95  // Public Classes
96 
98  :
99  public faPatchFieldMapper
100  {
101  label size_;
102  label sizeBeforeMapping_;
103 
104  public:
105 
106  // Constructors
107 
108  //- Construct given size
110  (
111  const label size,
112  const label sizeBeforeMapping
113  )
114  :
115  size_(size),
116  sizeBeforeMapping_(sizeBeforeMapping)
117  {}
118 
119 
120  // Member Functions
121 
122  virtual label size() const
123  {
124  return size_;
125  }
126 
127  virtual label sizeBeforeMapping() const
128  {
129  return sizeBeforeMapping_;
130  }
131 
132  virtual bool direct() const
133  {
134  return true;
135  }
136 
137  virtual bool hasUnmapped() const
138  {
139  return false;
140  }
141 
142  virtual const labelUList& directAddressing() const
143  {
144  return labelUList::null();
145  }
146  };
147 
148 
149  // Static Data
151  //- Output verbosity when writing
152  static int verbose_;
153 
154 
155  // Constructors
156 
157  //- Construct from components
159  (
160  faMesh& mesh, // Target mesh
161  const PtrList<faMesh>& procMeshes, // Source meshes
162  const PtrList<labelIOList>& edgeProcAddressing,
163  const PtrList<labelIOList>& faceProcAddressing,
164  const PtrList<labelIOList>& boundaryProcAddressing
165  );
166 
168  // Member Functions
169 
170  //- Return number of fields reconstructed
171  label nReconstructed() const noexcept
172  {
173  return nReconstructed_;
174  }
175 
176  //- Reconstruct area field
177  template<class Type>
180  (
181  const IOobject& fieldObject,
183  ) const;
184 
185  //- Read and reconstruct area field
186  template<class Type>
188  reconstructAreaField(const IOobject& fieldObject);
189 
191  //- Reconstruct edge field
192  template<class Type>
195  (
196  const IOobject& fieldObject,
198  ) const;
199 
200  //- Read and reconstruct edge field
201  template<class Type>
203  reconstructEdgeField(const IOobject& fieldObject);
204 
205 
206  //- Read, reconstruct and write specified area fields
207  template<class Type>
209  (
210  const UPtrList<const IOobject>& fieldObjects
211  );
212 
213  //- Read, reconstruct and write specified edge fields
214  template<class Type>
216  (
217  const UPtrList<const IOobject>& fieldObjects
218  );
219 
220 
221  //- Read, reconstruct and write all/selected area fields
222  // An empty wordRes corresponds to select ALL.
223  template<class Type>
225  (
226  const IOobjectList& objects,
227  const wordRes& selectedFields = wordRes()
228  );
229 
230  //- Read, reconstruct and write all/selected edge fields
231  // An empty wordRes corresponds to select ALL.
232  template<class Type>
234  (
235  const IOobjectList& objects,
236  const wordRes& selectedFields = wordRes()
237  );
238 
239  //- Reconstruct all supported area/edge field types
241  (
242  const IOobjectList& objects,
243  const wordRes& selectedFields = wordRes()
244  );
245 };
246 
247 
248 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
249 
250 } // End namespace Foam
251 
252 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
253 
254 #ifdef NoRepository
256 #endif
257 
258 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
259 
260 #endif
261 
262 // ************************************************************************* //
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:87
faPatchFieldReconstructor(const label size, const label sizeBeforeMapping)
Construct given size.
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
Finite Area area and edge fields reconstruction.
tmp< GeometricField< Type, faePatchField, edgeMesh > > reconstructEdgeField(const IOobject &fieldObject)
Read and reconstruct edge field.
label reconstructEdgeFields(const UPtrList< const IOobject > &fieldObjects)
Read, reconstruct and write specified edge fields.
Generic GeometricField class.
Definition: areaFieldsFwd.H:50
static int verbose_
Output verbosity when writing.
tmp< GeometricField< Type, faPatchField, areaMesh > > reconstructField(const IOobject &fieldObject, const PtrList< GeometricField< Type, faPatchField, areaMesh >> &) const
Reconstruct area field.
virtual label size() const
The size of the mapper.
virtual bool direct() const
Is it a direct (non-interpolating) mapper?
dynamicFvMesh & mesh
label nReconstructed() const noexcept
Return number of fields reconstructed.
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
const direction noexcept
Definition: Scalar.H:258
virtual bool hasUnmapped() const
Any unmapped values?
static const UList< label > & null()
Return a UList reference to a nullObject.
Definition: UListI.H:90
tmp< GeometricField< Type, faPatchField, areaMesh > > reconstructAreaField(const IOobject &fieldObject)
Read and reconstruct area field.
label reconstructAllFields(const IOobjectList &objects, const wordRes &selectedFields=wordRes())
Reconstruct all supported area/edge field types.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Definition: List.H:55
label reconstructAreaFields(const UPtrList< const IOobject > &fieldObjects)
Read, reconstruct and write specified area fields.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
A FieldMapper for finite-area patch fields.
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:172
virtual const labelUList & directAddressing() const
Return the direct addressing values.
Namespace for OpenFOAM.