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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "enrichedPatch.H"
29 
30 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
31 
32 void Foam::enrichedPatch::completePointMap() const
33 {
34  if (pointMapComplete_)
35  {
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.
46  // If the point has not been 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 // ************************************************************************* //
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:67
Foam::pointField
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:44
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::FatalError
error FatalError
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
Foam::PrimitivePatch::localPoints
const Field< point_type > & localPoints() const
Return pointField of points in patch.
Definition: PrimitivePatch.C:359
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::PrimitivePatch::meshPoints
const labelList & meshPoints() const
Return labelList of mesh points in patch.
Definition: PrimitivePatch.C:330
enrichedPatch.H
Foam::enrichedPatch::pointMergeMap
const Map< label > & pointMergeMap() const
Return map of point merges.
Definition: enrichedPatchI.H:52