lduPrimitiveMeshAssembly.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) 2019 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::lduPrimitiveMeshAssembly
28 
29 Description
30  An assembly of lduMatrix that is specific inter-region coupling
31  through mapped patches.
32 
33 SourceFiles
34  lduPrimitiveMeshAssembly.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef lduPrimitiveMeshAssembly_H
39 #define lduPrimitiveMeshAssembly_H
40 
41 #include "fvMesh.H"
42 #include "lduPrimitiveMesh.H"
43 
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class lduPrimitiveMeshAssembly Declaration
52 \*---------------------------------------------------------------------------*/
54 :
55  public regIOobject,
56  public lduPrimitiveMesh
57 {
58  // Private Data
59 
60  //- UPtrList for fvMesh
61  UPtrList<lduMesh> meshes_;
62 
63  //- Overwrite patchAddr from lduPrimitiveMesh for assembly ldu address
64  List<labelList> patchAddr_;
65 
66  //- Map from original to asembled (-1 for non-existing)
67  labelListList patchMap_;
68 
69  //- Map from original to asembled plus extra virtual patch Ids
70  labelListList patchLocalToGlobalMap_;
71 
72  //- Map internal faces from local to global
73  labelListList faceMap_;
74 
75  //- Map patch local sub-face to global new internal face
76  labelListListList faceBoundMap_;
77 
78  //- Map patch local sub-face to nbrCellId
79  labelListListList cellBoundMap_;
80 
81  //- Map patch local sub-face to local patch face
82  labelListListList facePatchFaceMap_;
83 
84  //- Offset cells
85  labelList cellOffsets_;
86 
87 
88  // Private Member Functions
89 
90  //- Get size of all meshes
91  static label totalSize(const UPtrList<lduMesh>&);
92 
93  //- No copy construct
95 
96  //- No copy assignment
97  void operator=(const lduPrimitiveMeshAssembly&) = delete;
98 
99 
100 public:
101 
102 
103  // Static Data
104 
105  // Declare name of the class and its debug switch
106  TypeName("lduPrimitiveMeshAssembly");
107 
108 
109  // Constructors
110 
111  //- Construct from UPtrList of lduMesh
113  (
114  const IOobject& io,
116  );
117 
118  //- Construct from one mesh
120  (
121  const IOobject& io,
122  const lduMesh&
123  );
124 
125 
126  //- Destructor
127  virtual ~lduPrimitiveMeshAssembly() = default;
128 
129 
130  // Public Member Functions
131 
132  //- Update mappings
133  template<class Type>
134  void update
135  (
137  );
138 
139  //- Size maps
140  void updateMaps(const UPtrList<lduMesh>&);
141 
142  //- Find nrb mesh Id for mapped patches
143  label findNbrMeshId(const polyPatch& pp,const label iMesh) const;
144 
145 
146  // Access
147 
148  //- Return the object registry
149  virtual const objectRegistry& thisDb() const
150  {
151  return meshes_[0].thisDb();
152  }
153 
154  //- Return true if thisDb() is a valid DB
155  virtual bool hasDb() const
156  {
157  return true;
158  }
159 
160  //- Return patch addressing
161  virtual const labelUList& patchAddr(const label patchNo) const
162  {
163  return patchAddr_[patchNo];
164  }
165 
166  //- Return patchMap
167  const labelListList& patchMap() const
168  {
169  return patchMap_;
170  }
171 
172  //- Return patchLocalToGlobalMap
173  const labelListList& patchLocalToGlobalMap() const
174  {
175  return patchLocalToGlobalMap_;
176  }
177 
178  //- Return boundary face map
179  const labelListListList& faceBoundMap() const
180  {
181  return faceBoundMap_;
182  }
183 
184  //- Return patch local sub-face to nbrCellId map
185  const labelListListList& cellBoundMap() const
186  {
187  return cellBoundMap_;
188  }
189 
190  //- Return patch local sub-face to local patch face map
191  const labelListListList& facePatchFaceMap() const
192  {
193  return facePatchFaceMap_;
194  }
195 
196  //- Return cellOffsets
197  const labelList& cellOffsets() const
198  {
199  return cellOffsets_;
200  }
201 
202  //- Return faceMap
203  const labelListList& faceMap() const
204  {
205  return faceMap_;
206  }
207 
208  //- Return patchAddr
209  const List<labelList>& patchAddr() const
210  {
211  return patchAddr_;
212  }
213 
214  //- Return fvMeshes
215  const UPtrList<lduMesh>& meshes() const
216  {
217  return meshes_;
218  }
219 
220  //- Write Data
221  virtual bool writeData(Ostream&) const
222  {
224  return false;
225  }
226 };
227 
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 } // End namespace Foam
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 #ifdef NoRepository
237 #endif
238 
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 
241 #endif
242 
243 // ************************************************************************* //
Foam::lduPrimitiveMeshAssembly::facePatchFaceMap
const labelListListList & facePatchFaceMap() const
Return patch local sub-face to local patch face map.
Definition: lduPrimitiveMeshAssembly.H:190
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::lduPrimitiveMeshAssembly::patchLocalToGlobalMap
const labelListList & patchLocalToGlobalMap() const
Return patchLocalToGlobalMap.
Definition: lduPrimitiveMeshAssembly.H:172
Foam::lduPrimitiveMeshAssembly::TypeName
TypeName("lduPrimitiveMeshAssembly")
Foam::lduPrimitiveMeshAssembly::faceMap
const labelListList & faceMap() const
Return faceMap.
Definition: lduPrimitiveMeshAssembly.H:202
Foam::lduPrimitiveMeshAssembly::patchMap
const labelListList & patchMap() const
Return patchMap.
Definition: lduPrimitiveMeshAssembly.H:166
Foam::lduPrimitiveMeshAssembly::update
void update(UPtrList< GeometricField< Type, fvPatchField, volMesh >> &psis)
Update mappings.
Definition: lduPrimitiveMeshAssemblyTemplates.C:41
Foam::lduPrimitiveMeshAssembly::thisDb
virtual const objectRegistry & thisDb() const
Return the object registry.
Definition: lduPrimitiveMeshAssembly.H:148
lduPrimitiveMeshAssemblyTemplates.C
Foam::lduPrimitiveMeshAssembly::updateMaps
void updateMaps(const UPtrList< lduMesh > &)
Size maps.
Definition: lduPrimitiveMeshAssembly.C:102
Foam::lduPrimitiveMeshAssembly::cellOffsets
const labelList & cellOffsets() const
Return cellOffsets.
Definition: lduPrimitiveMeshAssembly.H:196
Foam::lduPrimitiveMeshAssembly::meshes
const UPtrList< lduMesh > & meshes() const
Return fvMeshes.
Definition: lduPrimitiveMeshAssembly.H:214
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
Foam::lduPrimitiveMeshAssembly::~lduPrimitiveMeshAssembly
virtual ~lduPrimitiveMeshAssembly()=default
Destructor.
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
Foam::UPtrList
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition: UPtrList.H:62
Foam::lduPrimitiveMeshAssembly::patchAddr
const List< labelList > & patchAddr() const
Return patchAddr.
Definition: lduPrimitiveMeshAssembly.H:208
Foam::lduPrimitiveMeshAssembly::patchAddr
virtual const labelUList & patchAddr(const label patchNo) const
Return patch addressing.
Definition: lduPrimitiveMeshAssembly.H:160
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::lduPrimitiveMesh
Simplest concrete lduMesh that stores the addressing needed by lduMatrix.
Definition: lduPrimitiveMesh.H:52
Foam::regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:73
Foam::List< labelList >
Foam::lduPrimitiveMeshAssembly::writeData
virtual bool writeData(Ostream &) const
Write Data.
Definition: lduPrimitiveMeshAssembly.H:220
Foam::lduPrimitiveMeshAssembly::faceBoundMap
const labelListListList & faceBoundMap() const
Return boundary face map.
Definition: lduPrimitiveMeshAssembly.H:178
Foam::UList< label >
Foam::lduPrimitiveMeshAssembly::cellBoundMap
const labelListListList & cellBoundMap() const
Return patch local sub-face to nbrCellId map.
Definition: lduPrimitiveMeshAssembly.H:184
Foam::lduPrimitiveMeshAssembly::hasDb
virtual bool hasDb() const
Return true if thisDb() is a valid DB.
Definition: lduPrimitiveMeshAssembly.H:154
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
lduPrimitiveMesh.H
Foam::GeometricField< Type, fvPatchField, volMesh >
Foam::lduPrimitiveMeshAssembly::findNbrMeshId
label findNbrMeshId(const polyPatch &pp, const label iMesh) const
Find nrb mesh Id for mapped patches.
Definition: lduPrimitiveMeshAssembly.C:137
Foam::lduPrimitiveMeshAssembly
An assembly of lduMatrix that is specific inter-region coupling through mapped patches.
Definition: lduPrimitiveMeshAssembly.H:52
Foam::lduMesh
Abstract base class for meshes which provide LDU addressing for the construction of lduMatrix and LDU...
Definition: lduMesh.H:62