All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fvFieldReconstructor.C
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-2018 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 
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  << "Size of maps does not correspond to size of mesh"
58  << " for processor " << proci << endl
59  << "faceProcAddressing : " << faceProcAddressing[proci].size()
60  << " nFaces : " << procMesh.nFaces() << endl
61  << "cellProcAddressing : " << cellProcAddressing[proci].size()
62  << " nCell : " << procMesh.nCells() << endl
63  << "boundaryProcAddressing : "
64  << boundaryProcAddressing[proci].size()
65  << " nFaces : " << procMesh.boundary().size()
66  << exit(FatalError);
67  }
68  }
69 }
70 
71 
72 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
label nFaces() const
label nCells() const
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
fvFieldReconstructor(fvMesh &mesh, const PtrList< fvMesh > &procMeshes, const PtrList< labelIOList > &faceProcAddressing, const PtrList< labelIOList > &cellProcAddressing, const PtrList< labelIOList > &boundaryProcAddressing)
Construct from components.
label size() const
Return the number of elements in the UPtrList.
Definition: UPtrListI.H:29
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:78
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
Definition: fvMesh.C:540