Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / src / finiteVolume / fvMesh / fvMeshLduAddressing.H
blobf81f29b9c24698becf034a7fed1086026769c2a2
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend is free software: you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation, either version 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::fvMeshLduAddressing
27 Description
28     Foam::fvMeshLduAddressing
30 SourceFiles
31     fvMeshLduAddressing.C
33 \*---------------------------------------------------------------------------*/
35 #ifndef fvMeshLduAddressing_H
36 #define fvMeshLduAddressing_H
38 #include "lduAddressing.H"
39 #include "fvMesh.H"
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 namespace Foam
46 /*---------------------------------------------------------------------------*\
47                         Class fvMeshLduAddressing Declaration
48 \*---------------------------------------------------------------------------*/
50 class fvMeshLduAddressing
52     public lduAddressing
54     // Private data
56         //- Lower as a subList of allOwner
57         labelList::subList lowerAddr_;
59         //- Upper as a reference to neighbour
60         const labelList& upperAddr_;
62         //- Patch addressing as a list of sublists
63         List<const unallocLabelList*> patchAddr_;
65         //- Patch field evaluation schedule
66         const lduSchedule& patchSchedule_;
69     // Private Member Functions
71         //- Disallow default bitwise copy construct
72         fvMeshLduAddressing(const fvMeshLduAddressing&);
74         //- Disallow default bitwise assignment
75         void operator=(const fvMeshLduAddressing&);
78 public:
80     // Constructors
82         //- Construct from components
83         fvMeshLduAddressing(const fvMesh& mesh)
84         :
85             lduAddressing(mesh.nCells()),
86             lowerAddr_
87             (
88                 labelList::subList
89                 (
90                     mesh.faceOwner(),
91                     mesh.nInternalFaces()
92                 )
93             ),
94             upperAddr_(mesh.faceNeighbour()),
95             patchAddr_(mesh.boundary().size()),
96             patchSchedule_(mesh.globalData().patchSchedule())
97         {
98             forAll (mesh.boundary(), patchI)
99             {
100                 patchAddr_[patchI] = &mesh.boundary()[patchI].faceCells();
101             }
102         }
105     // Destructor
107         virtual ~fvMeshLduAddressing()
108         {}
111     // Member Functions
113         //- Return number of interfaces
114         virtual label nPatches() const
115         {
116             return patchAddr_.size();
117         }
119         //- Return lower addressing (i.e. lower label = upper triangle)
120         virtual const unallocLabelList& lowerAddr() const
121         {
122             return lowerAddr_;
123         }
125         //- Return upper addressing (i.e. upper label)
126         virtual const unallocLabelList& upperAddr() const
127         {
128             return upperAddr_;
129         }
131         //- Return patch addressing
132         virtual const unallocLabelList& patchAddr(const label i) const
133         {
134             return *patchAddr_[i];
135         }
137         // Return patch field evaluation schedule
138         virtual const lduSchedule& patchSchedule() const
139         {
140             return patchSchedule_;
141         }
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 } // End namespace Foam
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 #endif
153 // ************************************************************************* //