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) 2011-2015 OpenFOAM Foundation
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 
26 #include "enrichedPatch.H"
27 
28 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
29 
31 {
33  {
35  << "Point map already completed"
36  << abort(FatalError);
37  }
38 
39  pointMapComplete_ = true;
40 
41  const Map<label>& pmm = pointMergeMap();
42 
43  // Get the mesh points for both patches. If the point has not been
44  // merged away, add it to the map
45 
46  // Do master patch
47  const labelList& masterMeshPoints = masterPatch_.meshPoints();
48  const pointField& masterLocalPoints = masterPatch_.localPoints();
49 
50  forAll(masterMeshPoints, pointI)
51  {
52  if (!pmm.found(masterMeshPoints[pointI]))
53  {
54  pointMap_.insert
55  (
56  masterMeshPoints[pointI],
57  masterLocalPoints[pointI]
58  );
59  }
60  }
61 
62  // Do slave patch
63  const labelList& slaveMeshPoints = slavePatch_.meshPoints();
64  const pointField& slaveLocalPoints = slavePatch_.localPoints();
65 
66  forAll(slaveMeshPoints, pointI)
67  {
68  if (!pmm.found(slaveMeshPoints[pointI]))
69  {
70  pointMap_.insert
71  (
72  slaveMeshPoints[pointI],
73  slaveLocalPoints[pointI]
74  );
75  }
76  }
77 }
78 
79 
80 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
81 
82 
84 {
85  if (!pointMapComplete_)
86  {
87  completePointMap();
88  }
89 
90  return pointMap_;
91 }
92 
93 
95 {
96  if (!pointMapComplete_)
97  {
98  completePointMap();
99  }
100 
101  return pointMap_;
102 }
103 
104 
105 // ************************************************************************* //
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::PrimitivePatch::localPoints
const Field< PointType > & localPoints() const
Return pointField of points in patch.
Definition: PrimitivePatchTemplate.C:432
Foam::enrichedPatch::slavePatch_
const primitiveFacePatch & slavePatch_
Reference to slave patch.
Definition: enrichedPatch.H:75
Foam::Map< label >
Foam::enrichedPatch::masterPatch_
const primitiveFacePatch & masterPatch_
Reference to master patch.
Definition: enrichedPatch.H:72
Foam::enrichedPatch::pointMergeMap
Map< label > & pointMergeMap()
Return map of point merges.
Definition: enrichedPatch.H:222
Foam::enrichedPatch::pointMap
Map< point > & pointMap()
Return non-const access to point map to add points.
Definition: enrichedPatchPointMap.C:83
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::FatalError
error FatalError
Foam::enrichedPatch::pointMapComplete_
bool pointMapComplete_
Has the point map been completed?
Definition: enrichedPatch.H:81
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:131
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:318
Foam::enrichedPatch::completePointMap
void completePointMap() const
Complete point map.
Definition: enrichedPatchPointMap.C:30
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::PrimitivePatch::meshPoints
const labelList & meshPoints() const
Return labelList of mesh points in patch.
Definition: PrimitivePatchTemplate.C:392
enrichedPatch.H
Foam::enrichedPatch::pointMap_
Map< point > pointMap_
Map of points supporting patch faces.
Definition: enrichedPatch.H:78