FreeFOAM The Cross-Platform CFD Toolkit
pointFieldReconstructor.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) 1991-2010 OpenCFD Ltd.
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 
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 Foam::pointFieldReconstructor::pointFieldReconstructor
31 (
32  const pointMesh& mesh,
33  const PtrList<pointMesh>& procMeshes,
34  const PtrList<labelIOList>& pointProcAddressing,
35  const PtrList<labelIOList>& boundaryProcAddressing
36 )
37 :
38  mesh_(mesh),
39  procMeshes_(procMeshes),
40  pointProcAddressing_(pointProcAddressing),
41  boundaryProcAddressing_(boundaryProcAddressing),
42  patchPointAddressing_(procMeshes.size())
43 {
44  // Inverse-addressing of the patch point labels.
45  labelList pointMap(mesh_.size(), -1);
46 
47  // Create the pointPatch addressing
48  forAll(procMeshes_, proci)
49  {
50  const pointMesh& procMesh = procMeshes_[proci];
51 
52  patchPointAddressing_[proci].setSize(procMesh.boundary().size());
53 
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);
60 
61  const labelList& patchPointLabels =
62  mesh_.boundary()[boundaryProcAddressing_[proci][patchi]]
63  .meshPoints();
64 
65  // Create the inverse-addressing of the patch point labels.
66  forAll (patchPointLabels, pointi)
67  {
68  pointMap[patchPointLabels[pointi]] = pointi;
69  }
70 
71  const labelList& procPatchPoints =
72  procMesh.boundary()[patchi].meshPoints();
73 
74  forAll (procPatchPoints, pointi)
75  {
76  procPatchAddr[pointi] =
77  pointMap
78  [
79  pointProcAddressing_[proci][procPatchPoints[pointi]]
80  ];
81  }
82 
83  if (procPatchAddr.size() && min(procPatchAddr) < 0)
84  {
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  }
101 }
102 
103 
104 // ************************ vim: set sw=4 sts=4 et: ************************ //