initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / applications / utilities / parallelProcessing / reconstructPar / pointFieldReconstructor.C
blobe09003e31f160344f8cd90104a9fa779a80f015c
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
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.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "pointFieldReconstructor.H"
29 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
31 Foam::pointFieldReconstructor::pointFieldReconstructor
33     const pointMesh& mesh,
34     const PtrList<pointMesh>& procMeshes,
35     const PtrList<labelIOList>& pointProcAddressing,
36     const PtrList<labelIOList>& boundaryProcAddressing
39     mesh_(mesh),
40     procMeshes_(procMeshes),
41     pointProcAddressing_(pointProcAddressing),
42     boundaryProcAddressing_(boundaryProcAddressing),
43     patchPointAddressing_(procMeshes.size())
45     // Inverse-addressing of the patch point labels.
46     labelList pointMap(mesh_.size(), -1);
48     // Create the pointPatch addressing
49     forAll(procMeshes_, proci)
50     {
51         const pointMesh& procMesh = procMeshes_[proci];
53         patchPointAddressing_[proci].setSize(procMesh.boundary().size());
55         forAll(procMesh.boundary(), patchi)
56         {
57             if (boundaryProcAddressing_[proci][patchi] >= 0)
58             {
59                 labelList& procPatchAddr = patchPointAddressing_[proci][patchi];
60                 procPatchAddr.setSize(procMesh.boundary()[patchi].size(), -1);
62                 const labelList& patchPointLabels =
63                     mesh_.boundary()[boundaryProcAddressing_[proci][patchi]]
64                     .meshPoints();
66                 // Create the inverse-addressing of the patch point labels.
67                 forAll (patchPointLabels, pointi)
68                 {
69                     pointMap[patchPointLabels[pointi]] = pointi;
70                 }
71             
72                 const labelList& procPatchPoints =
73                     procMesh.boundary()[patchi].meshPoints();
75                 forAll (procPatchPoints, pointi)
76                 {
77                     procPatchAddr[pointi] =
78                         pointMap
79                         [
80                             pointProcAddressing_[proci][procPatchPoints[pointi]]
81                         ];
82                 }
84                 if (procPatchAddr.size() && min(procPatchAddr) < 0)
85                 {
86                     FatalErrorIn
87                     (
88                         "pointFieldReconstructor::pointFieldReconstructor"
89                         "(\n"
90                         "    const pointMesh& mesh,\n"
91                         "    const PtrList<pointMesh>& procMeshes,\n"
92                         "    const PtrList<labelIOList>& pointProcAddressing,\n"
93                         "    const PtrList<labelIOList>& "
94                         "boundaryProcAddressing\n"
95                         ")"
96                     )   << "Incomplete patch point addressing"
97                         << abort(FatalError);
98                 }
99             }
100         }
101     }
105 // ************************************************************************* //