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 | Copyright (C) 2011 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 \*---------------------------------------------------------------------------*/
25 
26 #include "fvFieldReconstructor.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 Foam::fvFieldReconstructor::fvFieldReconstructor
31 (
32  fvMesh& mesh,
33  const PtrList<fvMesh>& procMeshes,
34  const PtrList<labelIOList>& faceProcAddressing,
35  const PtrList<labelIOList>& cellProcAddressing,
36  const PtrList<labelIOList>& boundaryProcAddressing
37 )
38 :
39  mesh_(mesh),
40  procMeshes_(procMeshes),
41  faceProcAddressing_(faceProcAddressing),
42  cellProcAddressing_(cellProcAddressing),
43  boundaryProcAddressing_(boundaryProcAddressing),
44  nReconstructed_(0)
45 {
46  forAll(procMeshes_, procI)
47  {
48  const fvMesh& procMesh = procMeshes_[procI];
49  if
50  (
51  faceProcAddressing[procI].size() != procMesh.nFaces()
52  || cellProcAddressing[procI].size() != procMesh.nCells()
53  || boundaryProcAddressing[procI].size() != procMesh.boundary().size()
54  )
55  {
57  (
58  "fvFieldReconstructor::fvFieldReconstructor\n"
59  "(\n"
60  " fvMesh&,\n"
61  " const PtrList<fvMesh>&,\n"
62  " const PtrList<labelIOList>&,\n"
63  " const PtrList<labelIOList>&,\n"
64  " const PtrList<labelIOList>&\n"
65  ")"
66  ) << "Size of maps does not correspond to size of mesh"
67  << " for processor " << procI << endl
68  << "faceProcAddressing : " << faceProcAddressing[procI].size()
69  << " nFaces : " << procMesh.nFaces() << endl
70  << "cellProcAddressing : " << cellProcAddressing[procI].size()
71  << " nCell : " << procMesh.nCells() << endl
72  << "boundaryProcAddressing : "
73  << boundaryProcAddressing[procI].size()
74  << " nFaces : " << procMesh.boundary().size()
75  << exit(FatalError);
76  }
77  }
78 }
79 
80 
81 // ************************************************************************* //
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
label size() const
Return the number of elements in the PtrList.
Definition: PtrListI.H:32
label nFaces() const
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:61
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
label nCells() const
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
#define forAll(list, i)
Definition: UList.H:421
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:314
error FatalError
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
Definition: fvMesh.C:552