Forward compatibility: flex
[foam-extend-3.2.git] / applications / utilities / parallelProcessing / reconstructParMesh / pointFieldReconstructor.C
blobe67d6bdf27ecf4fa9f464c1473c09f3c1a71a3a7
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend 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 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "pointFieldReconstructor.H"
28 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
30 Foam::pointFieldReconstructor::pointFieldReconstructor
32     const pointMesh& mesh,
33     const PtrList<pointMesh>& procMeshes,
34     const PtrList<labelIOList>& pointProcAddressing,
35     const PtrList<labelIOList>& boundaryProcAddressing
38     mesh_(mesh),
39     procMeshes_(procMeshes),
40     pointProcAddressing_(pointProcAddressing),
41     boundaryProcAddressing_(boundaryProcAddressing),
42     patchPointAddressing_(procMeshes.size())
44     // Inverse-addressing of the patch point labels.
45     labelList pointMap(mesh_.size(), -1);
47     // Create the pointPatch addressing
48     forAll(procMeshes_, proci)
49     {
50         const pointMesh& procMesh = procMeshes_[proci];
52         patchPointAddressing_[proci].setSize(procMesh.boundary().size());
54         forAll(procMesh.boundary(), patchi)
55         {
56             if (boundaryProcAddressing_[proci][patchi] >= 0)
57             {
58                 labelList& procPatchAddr = patchPointAddressing_[proci][patchi];
59                 procPatchAddr.setSize(procMesh.boundary()[patchi].size(), -1);
61                 const labelList& patchPointLabels =
62                     mesh_.boundary()[boundaryProcAddressing_[proci][patchi]]
63                     .meshPoints();
65                 // Create the inverse-addressing of the patch point labels.
66                 forAll (patchPointLabels, pointi)
67                 {
68                     pointMap[patchPointLabels[pointi]] = pointi;
69                 }
71                 const labelList& procPatchPoints =
72                     procMesh.boundary()[patchi].meshPoints();
74                 forAll (procPatchPoints, pointi)
75                 {
76                     procPatchAddr[pointi] =
77                         pointMap
78                         [
79                             pointProcAddressing_[proci][procPatchPoints[pointi]]
80                         ];
81                 }
83                 if (procPatchAddr.size() && min(procPatchAddr) < 0)
84                 {
85                     FatalErrorIn
86                     (
87                         "pointFieldReconstructor::pointFieldReconstructor"
88                         "(\n"
89                         "    const pointMesh& mesh,\n"
90                         "    const PtrList<pointMesh>& procMeshes,\n"
91                         "    const PtrList<labelIOList>& pointProcAddressing,\n"
92                         "    const PtrList<labelIOList>& "
93                         "boundaryProcAddressing\n"
94                         ")"
95                     )   << "Incomplete patch point addressing"
96                         << abort(FatalError);
97                 }
98             }
99         }
100     }
104 // ************************************************************************* //