mergedSurf.H
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) 2016-2022 OpenCFD Ltd.
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 Class
27  Foam::mergedSurf
28 
29 Description
30  Simple class to manage surface merging information.
31 
32  Merging is done with PatchTools::gatherAndMerge()
33 
34 SourceFiles
35  mergedSurf.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef Foam_mergedSurf_H
40 #define Foam_mergedSurf_H
41 
42 #include "meshedSurf.H"
43 #include "globalIndex.H"
44 #include "stdFoam.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class mergedSurf Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 class mergedSurf
56 :
57  public meshedSurf
58 {
59  // Private Data
60 
61  pointField points_;
62  faceList faces_;
63  labelList pointsMap_;
64 
65  labelList zoneIds_;
66  labelList faceIds_;
67 
68  //- Gather/merge information (points)
69  globalIndex pointGlobalIndex_;
70 
71  //- Gather/merge information (faces)
72  globalIndex faceGlobalIndex_;
73 
74 
75 public:
76 
77  // Generated Methods
78 
79  //- Default construct
80  mergedSurf() noexcept = default;
81 
82  //- Copy construct
83  mergedSurf(const mergedSurf&) = default;
84 
85  //- Move construct
86  mergedSurf(mergedSurf&&) = default;
87 
88  //- Copy assignment
89  mergedSurf& operator=(const mergedSurf&) = default;
90 
91  //- Move assignment
92  mergedSurf& operator=(mergedSurf&&) = default;
93 
94 
95  // Constructors
96 
97  //- Construct from surface, and merge
99  (
100  const meshedSurf& unmergedSurface,
101  const scalar mergeDim
102  );
103 
104  //- Construct from points/faces, and merge
105  mergedSurf
106  (
107  const pointField& unmergedPoints,
108  const faceList& unmergedFaces,
109  const scalar mergeDim
110  );
111 
112  //- Construct from points/faces/zones/face-ids, and merge
113  mergedSurf
114  (
115  const pointField& unmergedPoints,
116  const faceList& unmergedFaces,
117  const labelList& origZoneIds,
118  const labelList& origFaceIds,
119  const scalar mergeDim
120  );
121 
122 
123  //- Destructor
124  virtual ~mergedSurf() = default;
125 
126 
127  // Access
128 
129  //- Number of faces
130  label size() const noexcept
131  {
132  return faces_.size();
133  }
134 
135  //- Const access to (global) points used for the surface
136  virtual const pointField& points() const noexcept
137  {
138  return points_;
139  }
140 
141  //- Const access to the surface faces
142  virtual const faceList& faces() const noexcept
143  {
144  return faces_;
145  }
146 
147  //- Per-face zone/region information
148  virtual const labelList& zoneIds() const noexcept
149  {
150  return zoneIds_;
151  }
152 
153  //- Per-face identifier (eg, element Id)
154  virtual const labelList& faceIds() const noexcept
155  {
156  return faceIds_;
157  }
158 
159  //- Map for reordered points (old-to-new)
160  const labelList& pointsMap() const noexcept
161  {
162  return pointsMap_;
163  }
164 
165  //- Const access to globalIndex used for points gathering
166  const globalIndex& pointGlobalIndex() const noexcept
167  {
168  return pointGlobalIndex_;
169  }
170 
171  //- Const access to globalIndex used for faces gathering
172  const globalIndex& faceGlobalIndex() const noexcept
173  {
174  return faceGlobalIndex_;
175  }
176 
177 
178  // Edit
179 
180  //- Clear all storage
181  void clear();
182 
183  //- Merge meshed surfaces (in parallel only).
184  bool merge
185  (
186  const meshedSurf& unmergedSurface,
187  const scalar mergeDim
188  );
190  //- Merge meshed surfaces (in parallel only).
191  bool merge
192  (
193  const pointField& unmergedPoints,
194  const faceList& unmergedFaces,
195  const scalar mergeDim
196  );
198  //- Merge meshed surfaces (in parallel only).
199  bool merge
200  (
201  const pointField& unmergedPoints,
202  const faceList& unmergedFaces,
203  const labelList& origZoneIds,
204  const labelList& origFaceIds,
205  const scalar mergeDim
206  );
207 };
208 
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 } // End namespace Foam
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 #endif
217 
218 // ************************************************************************* //
virtual const faceList & faces() const noexcept
Const access to the surface faces.
Definition: mergedSurf.H:165
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:116
mergedSurf() noexcept=default
Default construct.
const globalIndex & faceGlobalIndex() const noexcept
Const access to globalIndex used for faces gathering.
Definition: mergedSurf.H:205
virtual const labelList & faceIds() const noexcept
Per-face identifier (eg, element Id)
Definition: mergedSurf.H:181
const labelList & pointsMap() const noexcept
Map for reordered points (old-to-new)
Definition: mergedSurf.H:189
virtual ~mergedSurf()=default
Destructor.
virtual const pointField & points() const noexcept
Const access to (global) points used for the surface.
Definition: mergedSurf.H:157
Abstract definition of a meshed surface defined by faces and points.
Definition: meshedSurf.H:43
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
Definition: globalIndex.H:61
Simple class to manage surface merging information.
Definition: mergedSurf.H:50
virtual const labelList & zoneIds() const noexcept
Per-face zone/region information.
Definition: mergedSurf.H:173
bool merge(const meshedSurf &unmergedSurface, const scalar mergeDim)
Merge meshed surfaces (in parallel only).
Definition: mergedSurf.C:84
const direction noexcept
Definition: Scalar.H:258
const globalIndex & pointGlobalIndex() const noexcept
Const access to globalIndex used for points gathering.
Definition: mergedSurf.H:197
void clear()
Clear all storage.
Definition: mergedSurf.C:69
label size() const noexcept
Number of faces.
Definition: mergedSurf.H:149
Includes some standard C++ headers, defines global macros and templates used in multiple places by Op...
mergedSurf & operator=(const mergedSurf &)=default
Copy assignment.
Namespace for OpenFOAM.