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-2020 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 mergedSurf_H
40 #define mergedSurf_H
41 
42 #include "meshedSurf.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class mergedSurf Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class mergedSurf
54 :
55  public meshedSurf
56 {
57  pointField points_;
58  faceList faces_;
59  labelList pointsMap_;
60 
61  labelList zoneIds_;
62  labelList faceIds_;
63 
64 
65 public:
66 
67  // Constructors
68 
69  //- Default construct
70  mergedSurf() = default;
71 
72  //- Copy construct
73  mergedSurf(const mergedSurf&) = default;
74 
75  //- Move construct
76  mergedSurf(mergedSurf&&) = default;
77 
78  //- Construct and merge
80  (
81  const meshedSurf& unmergedSurface,
82  const scalar mergeDim
83  );
84 
85  //- Construct and merge
87  (
88  const pointField& unmergedPoints,
89  const faceList& unmergedFaces,
90  const scalar mergeDim
91  );
92 
93  //- Construct and merge
95  (
96  const pointField& unmergedPoints,
97  const faceList& unmergedFaces,
98  const labelList& origZoneIds,
99  const labelList& origFaceIds,
100  const scalar mergeDim
101  );
102 
103 
104  //- Destructor
105  virtual ~mergedSurf() = default;
106 
107 
108  // Access Member Functions
109 
110  //- Can use (parallel only)
111  static bool use();
112 
113  //- Number of faces
114  label size() const
115  {
116  return faces_.size();
117  }
118 
119  //- Const access to (global) points used for the surface
120  virtual const pointField& points() const
121  {
122  return points_;
123  }
124 
125  //- Const access to the surface faces
126  virtual const faceList& faces() const
127  {
128  return faces_;
129  }
130 
131  //- Per-face zone/region information
132  virtual const labelList& zoneIds() const
133  {
134  return zoneIds_;
135  }
136 
137  //- Per-face identifier (eg, element Id)
138  virtual const labelList& faceIds() const
139  {
140  return faceIds_;
141  }
142 
143  //- Map for reordered points (old-to-new)
144  const labelList& pointsMap() const
145  {
146  return pointsMap_;
147  }
148 
149 
150  // Edit
151 
152  //- Clear all storage
153  void clear();
154 
155  //- Merge meshed surfaces (in parallel only).
156  bool merge
157  (
158  const meshedSurf& unmergedSurface,
159  const scalar mergeDim
160  );
161 
162  //- Merge meshed surfaces (in parallel only).
163  bool merge
164  (
165  const pointField& unmergedPoints,
166  const faceList& unmergedFaces,
167  const scalar mergeDim
168  );
169 
170  //- Merge meshed surfaces (in parallel only).
171  bool merge
172  (
173  const pointField& unmergedPoints,
174  const faceList& unmergedFaces,
175  const labelList& origZoneIds,
176  const labelList& origFaceIds,
177  const scalar mergeDim
178  );
179 
180 
181  // Member Operators
182 
183  //- Copy assignment
184  mergedSurf& operator=(const mergedSurf&) = default;
185 
186  //- Move assignment
187  mergedSurf& operator=(mergedSurf&&) = default;
188 };
189 
190 
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 
193 } // End namespace Foam
194 
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 
197 #endif
198 
199 // ************************************************************************* //
Foam::mergedSurf::size
label size() const
Number of faces.
Definition: mergedSurf.H:113
Foam::mergedSurf::operator=
mergedSurf & operator=(const mergedSurf &)=default
Copy assignment.
Foam::mergedSurf::clear
void clear()
Clear all storage.
Definition: mergedSurf.C:89
Foam::meshedSurf
Abstract definition of a meshed surface defined by faces and points.
Definition: meshedSurf.H:49
Foam::mergedSurf::pointsMap
const labelList & pointsMap() const
Map for reordered points (old-to-new)
Definition: mergedSurf.H:143
Foam::mergedSurf::faces
virtual const faceList & faces() const
Const access to the surface faces.
Definition: mergedSurf.H:125
Foam::Field< vector >
Foam::mergedSurf
Simple class to manage surface merging information.
Definition: mergedSurf.H:52
Foam::mergedSurf::merge
bool merge(const meshedSurf &unmergedSurface, const scalar mergeDim)
Merge meshed surfaces (in parallel only).
Definition: mergedSurf.C:101
Foam::mergedSurf::mergedSurf
mergedSurf()=default
Default construct.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::mergedSurf::zoneIds
virtual const labelList & zoneIds() const
Per-face zone/region information.
Definition: mergedSurf.H:131
Foam::mergedSurf::faceIds
virtual const labelList & faceIds() const
Per-face identifier (eg, element Id)
Definition: mergedSurf.H:137
Foam::mergedSurf::use
static bool use()
Can use (parallel only)
Definition: mergedSurf.C:83
Foam::List< face >
Foam::mergedSurf::~mergedSurf
virtual ~mergedSurf()=default
Destructor.
Foam::mergedSurf::points
virtual const pointField & points() const
Const access to (global) points used for the surface.
Definition: mergedSurf.H:119
meshedSurf.H