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-2016 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  labelList lowerAddr_;
66 
67  //- Upper (face to neighbour addressing)
68  labelList upperAddr_;
69 
70  //- Patch addressing as a list of sublists
71  List<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
95 
96  //- Construct from components
98  (
99  const label nCells,
102  const List<const labelUList*>& interfaces,
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
115  {
116  return lowerAddr_;
117  }
118 
119  //- Return upper addressing (i.e. upper label)
120  virtual const labelUList& upperAddr() const
121  {
122  return upperAddr_;
123  }
124 
125  //- Return patch addressing
126  virtual const labelUList& patchAddr(const label i) const
127  {
128  return *patchAddr_[i];
129  }
130 
131  // Return patch field evaluation schedule
132  virtual const lduSchedule& patchSchedule() const
133  {
134  return patchSchedule_;
135  }
136 
137  //- Given additional addressing (in the form of additional neighbour
138  // cells, i.e. like cellCells)
139  // - add any additional faces
140  // - sort in upper-triangular order
141  // - construct cell-faces equivalent of given nbrCells
142  // (so e.g. nbrCellFaces[cellI][0] is the face corresponding to
143  // the cell nbrCells[cellI][0])
144  // (note: face in nbrCellFaces is -1 if the nbrCell is not local)
145  // - construct additional processor interface addressing:
146  // per processor the local and the remote cell.
147  // - return old-to-new face mapping
148  static labelList addAddressing
149  (
150  const lduAddressing& addr,
151  const labelListList& nbrCells,
152  label& nExtraFaces,
153  labelList& lower,
154  labelList& upper,
155  labelListList& nbrCellFaces,
156  const globalIndex&,
157  const labelList& globalCellIDs,
158  labelListList& localFaceCells,
159  labelListList& remoteFaceCells
160  );
161 
162  //- Return off-diagonal index given owner and neighbour label. Return
163  // -1 if not found
164  static label triIndex(const lduAddressing&, const label, const label);
165 };
166 
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 } // End namespace Foam
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 #endif
175 
176 // ************************************************************************* //
Foam::lduAddressing
The class contains the addressing required by the lduMatrix: upper, lower and losort.
Definition: lduAddressing.H:114
Foam::fvMeshPrimitiveLduAddressing::patchAddr
virtual const labelUList & patchAddr(const label i) const
Return patch addressing.
Definition: fvMeshPrimitiveLduAddressing.H:125
globalMeshData.H
Foam::fvMeshPrimitiveLduAddressing::patchSchedule
virtual const lduSchedule & patchSchedule() const
Definition: fvMeshPrimitiveLduAddressing.H:131
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)
Given additional addressing (in the form of additional neighbour.
Definition: fvMeshPrimitiveLduAddressing.C:109
Foam::stringOps::lower
string lower(const std::string &s)
Return string copy transformed with std::tolower on each character.
Definition: stringOps.C:1186
Foam::fvMeshPrimitiveLduAddressing
Variant of fvMeshLduAddressing that contains addressing instead of slices.
Definition: fvMeshPrimitiveLduAddressing.H:57
lduAddressing.H
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMeshPrimitiveLduAddressing::upperAddr
virtual const labelUList & upperAddr() const
Return upper addressing (i.e. upper label)
Definition: fvMeshPrimitiveLduAddressing.H:119
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:83
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fvMeshPrimitiveLduAddressing::lowerAddr
virtual const labelUList & lowerAddr() const
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:1202
Foam::fvMeshPrimitiveLduAddressing::triIndex
static label triIndex(const lduAddressing &, const label, const label)
Return off-diagonal index given owner and neighbour label. Return.
Definition: fvMeshPrimitiveLduAddressing.C:81