fvFieldReconstructor.C
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) 2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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\*---------------------------------------------------------------------------*/
28
30#include "volFields.H"
31#include "surfaceFields.H"
32
33// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34
36
37
38// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
39
41(
42 fvMesh& mesh,
43 const PtrList<fvMesh>& procMeshes,
44 const PtrList<labelIOList>& faceProcAddressing,
45 const PtrList<labelIOList>& cellProcAddressing,
46 const PtrList<labelIOList>& boundaryProcAddressing
47)
48:
49 mesh_(mesh),
50 procMeshes_(procMeshes),
51 faceProcAddressing_(faceProcAddressing),
52 cellProcAddressing_(cellProcAddressing),
53 boundaryProcAddressing_(boundaryProcAddressing),
54 nReconstructed_(0)
55{
56 forAll(procMeshes_, proci)
57 {
58 const fvMesh& procMesh = procMeshes_[proci];
59 if
60 (
61 faceProcAddressing[proci].size() != procMesh.nFaces()
62 || cellProcAddressing[proci].size() != procMesh.nCells()
63 || boundaryProcAddressing[proci].size() != procMesh.boundary().size()
64 )
65 {
67 << "Size of maps does not correspond to size of mesh"
68 << " for processor " << proci << endl
69 << "faceProcAddressing : " << faceProcAddressing[proci].size()
70 << " nFaces : " << procMesh.nFaces() << endl
71 << "cellProcAddressing : " << cellProcAddressing[proci].size()
72 << " nCell : " << procMesh.nCells() << endl
73 << "boundaryProcAddressing : "
74 << boundaryProcAddressing[proci].size()
75 << " nFaces : " << procMesh.boundary().size()
76 << exit(FatalError);
77 }
78 }
79}
80
81
82// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
83
85(
86 const IOobjectList& objects,
87 const wordRes& selected
88)
89{
90 label nTotal = 0;
91
92 do
93 {
94 #undef doLocalCode
95 #define doLocalCode(Method) \
96 { \
97 nTotal += this->Method <scalar> (objects, selected); \
98 nTotal += this->Method <vector> (objects, selected); \
99 nTotal += this->Method <sphericalTensor> (objects, selected); \
100 nTotal += this->Method <symmTensor> (objects, selected); \
101 nTotal += this->Method <tensor> (objects, selected); \
102 }
103
104 doLocalCode(reconstructInternalFields);
105 doLocalCode(reconstructVolumeFields);
106 doLocalCode(reconstructSurfaceFields);
107
108 #undef doLocalCode
109 }
110 while (false);
111
112 return nTotal;
113}
114
115
116// ************************************************************************* //
List of IOobjects with searching and retrieving facilities.
Definition: IOobjectList.H:59
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: PtrList.H:73
label size() const noexcept
The number of elements in the list.
Definition: UPtrListI.H:106
Finite volume reconstructor for volume and surface fields.
static int verbose_
Output verbosity when writing.
label reconstructAllFields(const IOobjectList &objects, const wordRes &selectedFields=wordRes())
Reconstruct all known field types.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
Definition: fvMesh.C:712
label nCells() const noexcept
Number of mesh cells.
label nFaces() const noexcept
Number of mesh faces.
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:54
dynamicFvMesh & mesh
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
error FatalError
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333
Foam::surfaceFields.
#define doLocalCode(GeoField)