FreeFOAM The Cross-Platform CFD Toolkit
enrichedPatchPointMap.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 Description
25 
26 \*---------------------------------------------------------------------------*/
27 
29 
30 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
31 
32 void Foam::enrichedPatch::completePointMap() const
33 {
34  if (pointMapComplete_)
35  {
36  FatalErrorIn("void enrichedPatch::completePointMap() const")
37  << "Point map already completed"
38  << abort(FatalError);
39  }
40 
41  pointMapComplete_ = true;
42 
43  const Map<label>& pmm = pointMergeMap();
44 
45  // Get the mesh points for both patches. If the point has not been
46  // merged away, add it to the map
47 
48  // Do master patch
49  const labelList& masterMeshPoints = masterPatch_.meshPoints();
50  const pointField& masterLocalPoints = masterPatch_.localPoints();
51 
52  forAll (masterMeshPoints, pointI)
53  {
54  if (!pmm.found(masterMeshPoints[pointI]))
55  {
56  pointMap_.insert
57  (
58  masterMeshPoints[pointI],
59  masterLocalPoints[pointI]
60  );
61  }
62  }
63 
64  // Do slave patch
65  const labelList& slaveMeshPoints = slavePatch_.meshPoints();
66  const pointField& slaveLocalPoints = slavePatch_.localPoints();
67 
68  forAll (slaveMeshPoints, pointI)
69  {
70  if (!pmm.found(slaveMeshPoints[pointI]))
71  {
72  pointMap_.insert
73  (
74  slaveMeshPoints[pointI],
75  slaveLocalPoints[pointI]
76  );
77  }
78  }
79 }
80 
81 
82 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
83 
84 
86 {
87  if (!pointMapComplete_)
88  {
89  completePointMap();
90  }
91 
92  return pointMap_;
93 }
94 
95 
97 {
98  if (!pointMapComplete_)
99  {
100  completePointMap();
101  }
102 
103  return pointMap_;
104 }
105 
106 
107 // ************************ vim: set sw=4 sts=4 et: ************************ //