BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / parallel / decompose / decompositionMethods / decompositionMethod / decompositionMethod.H
blobb81119fb0b204b2d8e23c697788c59819d37c83e
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software: you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by
13     the Free Software Foundation, either version 3 of the License, or
14     (at your option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::decompositionMethod
27 Description
28     Abstract base class for decomposition
30 SourceFiles
31     decompositionMethod.C
33 \*---------------------------------------------------------------------------*/
35 #ifndef decompositionMethod_H
36 #define decompositionMethod_H
38 #include "polyMesh.H"
39 #include "pointField.H"
40 #include "CompactListList.H"
42 namespace Foam
45 /*---------------------------------------------------------------------------*\
46                            Class decompositionMethod Declaration
47 \*---------------------------------------------------------------------------*/
49 class decompositionMethod
52 protected:
54     // Protected data
56         const dictionary& decompositionDict_;
57         label nProcessors_;
60         //- Helper: determine (global) cellCells from mesh agglomeration.
61         static void calcCellCells
62         (
63             const polyMesh& mesh,
64             const labelList& agglom,
65             const label nCoarse,
66             CompactListList<label>& cellCells
67         );
69 private:
71     // Private Member Functions
73         //- Disallow default bitwise copy construct and assignment
74         decompositionMethod(const decompositionMethod&);
75         void operator=(const decompositionMethod&);
78 public:
80     //- Runtime type information
81     TypeName("decompositionMethod");
84     // Declare run-time constructor selection tables
86         declareRunTimeSelectionTable
87         (
88             autoPtr,
89             decompositionMethod,
90             dictionary,
91             (
92                 const dictionary& decompositionDict
93             ),
94             (decompositionDict)
95         );
98     // Selectors
100         //- Return a reference to the selected decomposition method
101         static autoPtr<decompositionMethod> New
102         (
103             const dictionary& decompositionDict
104         );
107     // Constructors
109         //- Construct given the decomposition dictionary
110         decompositionMethod(const dictionary& decompositionDict)
111         :
112             decompositionDict_(decompositionDict),
113             nProcessors_
114             (
115                 readLabel(decompositionDict.lookup("numberOfSubdomains"))
116             )
117         {}
120     //- Destructor
121     virtual ~decompositionMethod()
122     {}
125     // Member Functions
127         label nDomains() const
128         {
129             return nProcessors_;
130         }
132         //- Is method parallel aware (i.e. does it synchronize domains across
133         //  proc boundaries)
134         virtual bool parallelAware() const = 0;
137         // No topology (implemented by geometric decomposers)
139             //- Return for every coordinate the wanted processor number.
140             virtual labelList decompose
141             (
142                 const pointField& points,
143                 const scalarField& pointWeights
144             )
145             {
146                 notImplemented
147                 (
148                     "decompositionMethod:decompose(const pointField&"
149                     ", const scalarField&)"
150                 );
151                 return labelList(0);
152             }
154             //- Like decompose but with uniform weights on the points
155             virtual labelList decompose(const pointField&)
156             {
157                 notImplemented
158                 (
159                     "decompositionMethod:decompose(const pointField&)"
160                 );
161                 return labelList(0);
162             }
165         // Topology provided by mesh
167             //- Return for every coordinate the wanted processor number. Use the
168             //  mesh connectivity (if needed)
169             virtual labelList decompose
170             (
171                 const polyMesh& mesh,
172                 const pointField& points,
173                 const scalarField& pointWeights
174             ) = 0;
176             //- Like decompose but with uniform weights on the points
177             virtual labelList decompose(const polyMesh&, const pointField&);
180             //- Return for every coordinate the wanted processor number. Gets
181             //  passed agglomeration map (from fine to coarse cells) and coarse
182             //  cell
183             //  location. Can be overridden by decomposers that provide this
184             //  functionality natively. Coarse cells are local to the processor
185             //  (if in parallel). If you want to have coarse cells spanning
186             //  processors use the globalCellCells instead.
187             virtual labelList decompose
188             (
189                 const polyMesh& mesh,
190                 const labelList& cellToRegion,
191                 const pointField& regionPoints,
192                 const scalarField& regionWeights
193             );
195             //- Like decompose but with uniform weights on the regions
196             virtual labelList decompose
197             (
198                 const polyMesh& mesh,
199                 const labelList& cellToRegion,
200                 const pointField& regionPoints
201             );
204         // Topology provided explicitly addressing
206             //- Return for every coordinate the wanted processor number.
207             //  The connectivity is equal to mesh.cellCells() except for
208             //  - in parallel the cell numbers are global cell numbers
209             //    (starting
210             //    from 0 at processor0 and then incrementing all through the
211             //    processors)
212             //  - the connections are across coupled patches
213             virtual labelList decompose
214             (
215                 const labelListList& globalCellCells,
216                 const pointField& cc,
217                 const scalarField& cWeights
218             ) = 0;
220             //- Like decompose but with uniform weights on the cells
221             virtual labelList decompose
222             (
223                 const labelListList& globalCellCells,
224                 const pointField& cc
225             );
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 } // End namespace Foam
234 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 #endif
238 // ************************************************************************* //