OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

decompositionMethod.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::decompositionMethod
00027 
00028 Description
00029     Abstract base class for decomposition
00030 
00031 SourceFiles
00032     decompositionMethod.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef decompositionMethod_H
00037 #define decompositionMethod_H
00038 
00039 #include "polyMesh.H"
00040 #include "pointField.H"
00041 
00042 namespace Foam
00043 {
00044 
00045 /*---------------------------------------------------------------------------*\
00046                            Class decompositionMethod Declaration
00047 \*---------------------------------------------------------------------------*/
00048 
00049 class decompositionMethod
00050 {
00051 
00052 protected:
00053 
00054     // Protected data
00055 
00056         const dictionary& decompositionDict_;
00057         label nProcessors_;
00058 
00059 
00060         //- Helper: determine (non-parallel) cellCells from mesh agglomeration.
00061         static void calcCellCells
00062         (
00063             const polyMesh& mesh,
00064             const labelList& agglom,
00065             const label nCoarse,
00066             labelListList& cellCells
00067         );
00068 
00069 private:
00070 
00071     // Private Member Functions
00072 
00073         //- Disallow default bitwise copy construct and assignment
00074         decompositionMethod(const decompositionMethod&);
00075         void operator=(const decompositionMethod&);
00076 
00077 
00078 public:
00079 
00080     //- Runtime type information
00081     TypeName("decompositionMethod");
00082 
00083 
00084     // Declare run-time constructor selection tables
00085 
00086         declareRunTimeSelectionTable
00087         (
00088             autoPtr,
00089             decompositionMethod,
00090             dictionary,
00091             (
00092                 const dictionary& decompositionDict
00093             ),
00094             (decompositionDict)
00095         );
00096 
00097         declareRunTimeSelectionTable
00098         (
00099             autoPtr,
00100             decompositionMethod,
00101             dictionaryMesh,
00102             (
00103                 const dictionary& decompositionDict,
00104                 const polyMesh& mesh
00105             ),
00106             (decompositionDict, mesh)
00107         );
00108 
00109 
00110     // Selectors
00111 
00112         //- Return a reference to the selected decomposition method
00113         static autoPtr<decompositionMethod> New
00114         (
00115             const dictionary& decompositionDict
00116         );
00117 
00118         //- Return a reference to the selected decomposition method
00119         static autoPtr<decompositionMethod> New
00120         (
00121             const dictionary& decompositionDict,
00122             const polyMesh& mesh
00123         );
00124 
00125 
00126     // Constructors
00127 
00128         //- Construct given the decomposition dictionary
00129         decompositionMethod(const dictionary& decompositionDict)
00130         :
00131             decompositionDict_(decompositionDict),
00132             nProcessors_
00133             (
00134                 readLabel(decompositionDict.lookup("numberOfSubdomains"))
00135             )
00136         {}
00137 
00138 
00139     // Destructor
00140 
00141         virtual ~decompositionMethod()
00142         {}
00143 
00144 
00145     // Member Functions
00146 
00147         //- Is method parallel aware (i.e. does it synchronize domains across
00148         //  proc boundaries)
00149         virtual bool parallelAware() const = 0;
00150 
00151         //- Return for every coordinate the wanted processor number. Use the
00152         //  mesh connectivity (if needed)
00153         virtual labelList decompose(const pointField&) = 0;
00154 
00155         //- Return for every coordinate the wanted processor number. Gets
00156         //  passed agglomeration map (from fine to coarse cells) and coarse cell
00157         //  location. Can be overridden by decomposers that provide this
00158         //  functionality natively. Coarse cells are local to the processor
00159         //  (if in parallel). If you want to have coarse cells spanning
00160         //  processors use the next function below instead.
00161         virtual labelList decompose
00162         (
00163             const labelList& cellToRegion,
00164             const pointField& regionPoints
00165         );
00166 
00167         //- Return for every coordinate the wanted processor number. Explicitly
00168         //  provided connectivity - does not use mesh_.
00169         //  The connectivity is equal to mesh.cellCells() except for
00170         //  - in parallel the cell numbers are global cell numbers (starting
00171         //    from 0 at processor0 and then incrementing all through the
00172         //    processors)
00173         //  - the connections are across coupled patches
00174         virtual labelList decompose
00175         (
00176             const labelListList& globalCellCells,
00177             const pointField& cc
00178         ) = 0;
00179 
00180 };
00181 
00182 
00183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00184 
00185 } // End namespace Foam
00186 
00187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00188 
00189 #endif
00190 
00191 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd