faMeshReconstructor.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) 2021 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::faMeshReconstructor
28 
29 Description
30  A bare-bones reconstructor for finiteArea meshes when processor
31  meshes are available (in parallel) but an equivalent serial faMesh
32  is needed for reconstruction or decomposition.
33  In these situations, a serial version of the faMesh is needed,
34  but preferably without reconstructing the entire volume mesh.
35 
36  It uses the finiteVolume faceProcAddressing in addition to
37  the geometric information available from the underlying polyMesh.
38 
39  The resulting equivalent faMesh can be used for basic operations,
40  but caution should be exercised before attempting large operations.
41 
42 SourceFiles
43  faMeshReconstructor.C
44 
45 \*---------------------------------------------------------------------------*/
46 
47 #ifndef faMeshReconstructor_H
48 #define faMeshReconstructor_H
49 
50 #include "faMesh.H"
51 #include "primitivePatch.H"
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace Foam
56 {
57 
58 // Forward Declarations
59 class Time;
60 
61 /*---------------------------------------------------------------------------*\
62  Class faMeshReconstructor Declaration
63 \*---------------------------------------------------------------------------*/
64 
66 {
67  // Private Data
68 
69  //- The processor-specific faMesh
70  const faMesh& procMesh_;
71 
72 
73  // Addressing
74 
75  //- Processor face addressing, derived from finite volume information
76  labelList faFaceProcAddr_;
77 
78  //- Processor boundary addressing
79  labelList faBoundaryProcAddr_;
80 
81  //- Processor point addressing
82  labelList faPointProcAddr_;
83 
84  //- Processor edge addressing
85  labelList faEdgeProcAddr_;
86 
87 
88  // Equivalent surface information
89 
90  //- Faces labels for a single patch
91  labelList singlePatchFaceLabels_;
92 
93  //- Faces for a single patch
94  faceList singlePatchFaces_;
95 
96  //- Support points for a single patch
97  pointField singlePatchPoints_;
98 
99  //- Lists of edge-labels (per edge patch) for the single patch
100  labelListList singlePatchEdgeLabels_;
101 
102 
103  // Demand-driven data
104 
105  //- Primitive patch
106  mutable autoPtr<primitivePatch> serialPatchPtr_;
107 
108  //- Time database for serial meshes
109  autoPtr<Time> serialRunTime_;
110 
111  //- Dummy volume mesh, used for serial area mesh
112  autoPtr<polyMesh> serialVolMesh_;
113 
114  //- Equivalent serial area mesh
115  autoPtr<faMesh> serialAreaMesh_;
116 
117 
118  // Private Member Functions
119 
120  //- Calculate all addressing, using finiteVolume faceProcAddressing
121  void calcAddressing(const labelUList& fvFaceProcAddr);
122 
123  //- Set primitive patch, removing any old one
124  void initPatch() const;
125 
126  //- Create the serial geometry
127  void createMesh();
128 
129  //- No copy construct
130  faMeshReconstructor(const faMeshReconstructor&) = delete;
131 
132  //- No copy assignment
133  void operator=(const faMeshReconstructor&) = delete;
134 
135 
136 public:
137 
138  //- Debug flag
139  static int debug;
140 
141 
142  // Constructors
143 
144  //- Construct from components
145  explicit faMeshReconstructor(const faMesh& procMesh);
146 
147  //- Construct from components
149  (
150  const faMesh& procMesh,
151  const labelUList& fvFaceProcAddressing
152  );
153 
154 
155  //- Destructor
157 
158  void clearGeom();
159 
160 
161  // Member Functions
162 
163  //- Processor point addressing
164  const labelList& pointProcAddressing() const noexcept
165  {
166  return faPointProcAddr_;
167  }
168 
169  //- Processor edge addressing
170  const labelList& edgeProcAddressing() const noexcept
171  {
172  return faEdgeProcAddr_;
173  }
174 
175  //- Processor face addressing
176  const labelList& faceProcAddressing() const noexcept
177  {
178  return faFaceProcAddr_;
179  }
180 
181  //- Processor boundary addressing
182  const labelList& boundaryProcAddressing() const noexcept
183  {
184  return faBoundaryProcAddr_;
185  }
186 
187 
188  //- Serial equivalent patch
189  const primitivePatch& patch() const;
190 
191  //- Serial equivalent patch
193 
194  //- Serial equivalent faMesh
195  const faMesh& mesh() const;
196 
197 
198  // Write
199 
200  //- Write proc addressing at the polyMesh faceInstances time
201  void writeAddressing() const;
202 
203  //- Write proc addressing at the given time
204  void writeAddressing(const word& timeName) const;
205 
206  //- Write equivalent mesh information at the polyMesh faceInstances time
207  void writeMesh() const;
208 
209  //- Write equivalent mesh information at the given time
210  void writeMesh(const word& timeName) const;
211 };
212 
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 } // End namespace Foam
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 #endif
221 
222 // ************************************************************************* //
Foam::faMeshReconstructor::boundaryProcAddressing
const labelList & boundaryProcAddressing() const noexcept
Processor boundary addressing.
Definition: faMeshReconstructor.H:181
Foam::faMeshReconstructor::mesh
const faMesh & mesh() const
Serial equivalent faMesh.
Definition: faMeshReconstructor.C:632
Foam::faMeshReconstructor
A bare-bones reconstructor for finiteArea meshes when processor meshes are available (in parallel) bu...
Definition: faMeshReconstructor.H:64
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::faMeshReconstructor::~faMeshReconstructor
~faMeshReconstructor()
Destructor.
Definition: faMeshReconstructor.C:596
Foam::faMeshReconstructor::writeAddressing
void writeAddressing() const
Write proc addressing at the polyMesh faceInstances time.
Definition: faMeshReconstructor.C:643
Foam::faMeshReconstructor::pointProcAddressing
const labelList & pointProcAddressing() const noexcept
Processor point addressing.
Definition: faMeshReconstructor.H:163
faMesh.H
Foam::Field< vector >
Foam::faMeshReconstructor::patch
const primitivePatch & patch() const
Serial equivalent patch.
Definition: faMeshReconstructor.C:610
Foam::faMeshReconstructor::edgeProcAddressing
const labelList & edgeProcAddressing() const noexcept
Processor edge addressing.
Definition: faMeshReconstructor.H:169
timeName
word timeName
Definition: getTimeIndex.H:3
Foam::faMeshReconstructor::clearGeom
void clearGeom()
Definition: faMeshReconstructor.C:602
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::List< label >
Foam::UList< label >
Foam::faMesh
Finite area mesh. Used for 2-D non-Euclidian finite area method.
Definition: faMesh.H:82
Foam::faMeshReconstructor::faceProcAddressing
const labelList & faceProcAddressing() const noexcept
Processor face addressing.
Definition: faMeshReconstructor.H:175
Foam::faMeshReconstructor::debug
static int debug
Debug flag.
Definition: faMeshReconstructor.H:138
primitivePatch.H
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:79
Foam::faMeshReconstructor::writeMesh
void writeMesh() const
Write equivalent mesh information at the polyMesh faceInstances time.
Definition: faMeshReconstructor.C:682