fvMeshPrimitiveLduAddressing.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) 2015-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::fvMeshPrimitiveLduAddressing
28 
29 Description
30  Variant of fvMeshLduAddressing that contains addressing instead of
31  slices.
32 
33  Alternatively use lduPrimitiveMesh but that assumes there are only
34  lduInterfaces and not also generic patches.
35 
36 SourceFiles
37  fvMeshPrimitiveLduAddressing.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef fvMeshPrimitiveLduAddressing_H
42 #define fvMeshPrimitiveLduAddressing_H
43 
44 #include "lduPrimitiveMesh.H"
45 #include "lduAddressing.H"
46 #include "fvMesh.H"
47 #include "globalMeshData.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class fvMeshPrimitiveLduAddressing Declaration
56 \*---------------------------------------------------------------------------*/
57 
59 :
60  public lduAddressing
61 {
62  // Private Data
63 
64  //- Lower (face to owner addressing)
65  const labelList lowerAddr_;
66 
67  //- Upper (face to neighbour addressing)
68  const labelList upperAddr_;
69 
70  //- Patch addressing as a list of sublists
71  const UPtrList<const labelUList> patchAddr_;
72 
73  //- Patch field evaluation schedule
74  const lduSchedule patchSchedule_;
75 
76 
77  // Private Member Functions
78 
79  //- No copy construct
81  (
83  ) = delete;
84 
85  //- No copy assignment
86  void operator=(const fvMeshPrimitiveLduAddressing&) = delete;
87 
88 
89 public:
90 
91  // Constructors
92 
93  //- Construct from mesh
94  explicit fvMeshPrimitiveLduAddressing(const fvMesh& mesh);
95 
96  //- Construct from components
98  (
99  const label nCells,
103  const lduSchedule& ps
104  );
105 
106 
107  //- Destructor
108  virtual ~fvMeshPrimitiveLduAddressing() = default;
109 
110 
111  // Member Functions
112 
113  //- Return lower addressing (i.e. lower label = upper triangle)
114  virtual const labelUList& lowerAddr() const noexcept
115  {
116  return lowerAddr_;
117  }
118 
119  //- Return upper addressing (i.e. upper label)
120  virtual const labelUList& upperAddr() const noexcept
121  {
122  return upperAddr_;
123  }
124 
125  //- Return patch addressing for given patch
126  virtual const labelUList& patchAddr(const label patchi) const
127  {
128  return patchAddr_[patchi];
129  }
130 
131  //- Return patch field evaluation schedule
132  virtual const lduSchedule& patchSchedule() const noexcept
133  {
134  return patchSchedule_;
135  }
136 
137  //- Given additional addressing (in the form of additional neighbour
138  //- cells, i.e. like cellCells)
139  //
140  // - add any additional faces
141  // - sort in upper-triangular order
142  // - construct cell-faces equivalent of given nbrCells
143  // (so e.g. nbrCellFaces[cellI][0] is the face corresponding to
144  // the cell nbrCells[cellI][0])
145  // (note: face in nbrCellFaces is -1 if the nbrCell is not local)
146  // - construct additional processor interface addressing:
147  // per processor the local and the remote cell.
148  // - return old-to-new face mapping
149  static labelList addAddressing
150  (
151  const lduAddressing& addr,
152  const labelListList& nbrCells,
153  label& nExtraFaces,
154  labelList& lower,
155  labelList& upper,
156  labelListList& nbrCellFaces,
157  const globalIndex&,
158  const labelList& globalCellIDs,
159  labelListList& localFaceCells,
160  labelListList& remoteFaceCells
161  );
162 
163  //- Return off-diagonal index given owner and neighbour label.
164  // \return -1 if not found
165  static label triIndex(const lduAddressing&, const label, const label);
166 };
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 } // End namespace Foam
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 #endif
176 
177 // ************************************************************************* //
Foam::lduAddressing
The class contains the addressing required by the lduMatrix: upper, lower and losort.
Definition: lduAddressing.H:114
Foam::fvMeshPrimitiveLduAddressing::patchSchedule
virtual const lduSchedule & patchSchedule() const noexcept
Return patch field evaluation schedule.
Definition: fvMeshPrimitiveLduAddressing.H:131
globalMeshData.H
Foam::fvMeshPrimitiveLduAddressing::patchAddr
virtual const labelUList & patchAddr(const label patchi) const
Return patch addressing for given patch.
Definition: fvMeshPrimitiveLduAddressing.H:125
Foam::fvMeshPrimitiveLduAddressing::~fvMeshPrimitiveLduAddressing
virtual ~fvMeshPrimitiveLduAddressing()=default
Destructor.
Foam::fvMeshPrimitiveLduAddressing::addAddressing
static labelList addAddressing(const lduAddressing &addr, const labelListList &nbrCells, label &nExtraFaces, labelList &lower, labelList &upper, labelListList &nbrCellFaces, const globalIndex &, const labelList &globalCellIDs, labelListList &localFaceCells, labelListList &remoteFaceCells)
Definition: fvMeshPrimitiveLduAddressing.C:101
Foam::fvMeshPrimitiveLduAddressing::upperAddr
virtual const labelUList & upperAddr() const noexcept
Return upper addressing (i.e. upper label)
Definition: fvMeshPrimitiveLduAddressing.H:119
Foam::stringOps::lower
string lower(const std::string &s)
Return string copy transformed with std::tolower on each character.
Definition: stringOps.C:1184
Foam::fvMeshPrimitiveLduAddressing
Variant of fvMeshLduAddressing that contains addressing instead of slices.
Definition: fvMeshPrimitiveLduAddressing.H:57
Foam::UPtrList
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition: UPtrList.H:62
lduAddressing.H
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fvMeshPrimitiveLduAddressing::lowerAddr
virtual const labelUList & lowerAddr() const noexcept
Return lower addressing (i.e. lower label = upper triangle)
Definition: fvMeshPrimitiveLduAddressing.H:113
Foam::globalIndex
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
Definition: globalIndex.H:68
Foam::List< label >
Foam::UList< label >
lduPrimitiveMesh.H
Foam::stringOps::upper
string upper(const std::string &s)
Return string copy transformed with std::toupper on each character.
Definition: stringOps.C:1200
Foam::fvMeshPrimitiveLduAddressing::triIndex
static label triIndex(const lduAddressing &, const label, const label)
Return off-diagonal index given owner and neighbour label.
Definition: fvMeshPrimitiveLduAddressing.C:75