FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::decompositionMethod
00026 
00027 Description
00028     Abstract base class for decomposition
00029 
00030 SourceFiles
00031     decompositionMethod.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef decompositionMethod_H
00036 #define decompositionMethod_H
00037 
00038 #include <OpenFOAM/polyMesh.H>
00039 #include <OpenFOAM/pointField.H>
00040 
00041 namespace Foam
00042 {
00043 
00044 /*---------------------------------------------------------------------------*\
00045                            Class decompositionMethod Declaration
00046 \*---------------------------------------------------------------------------*/
00047 
00048 class decompositionMethod
00049 {
00050 
00051 protected:
00052 
00053     // Protected data
00054 
00055         const dictionary& decompositionDict_;
00056         label nProcessors_;
00057 
00058 
00059         //- Helper: determine (non-parallel) cellCells from mesh agglomeration.
00060         static void calcCellCells
00061         (
00062             const polyMesh& mesh,
00063             const labelList& agglom,
00064             const label nCoarse,
00065             labelListList& cellCells
00066         );
00067 
00068 private:
00069 
00070     // Private Member Functions
00071 
00072         //- Disallow default bitwise copy construct and assignment
00073         decompositionMethod(const decompositionMethod&);
00074         void operator=(const decompositionMethod&);
00075 
00076 
00077 public:
00078 
00079     //- Runtime type information
00080     TypeName("decompositionMethod");
00081 
00082 
00083     // Declare run-time constructor selection tables
00084 
00085         declareRunTimeSelectionTable
00086         (
00087             autoPtr,
00088             decompositionMethod,
00089             dictionary,
00090             (
00091                 const dictionary& decompositionDict
00092             ),
00093             (decompositionDict)
00094         );
00095 
00096         declareRunTimeSelectionTable
00097         (
00098             autoPtr,
00099             decompositionMethod,
00100             dictionaryMesh,
00101             (
00102                 const dictionary& decompositionDict,
00103                 const polyMesh& mesh
00104             ),
00105             (decompositionDict, mesh)
00106         );
00107 
00108 
00109     // Selectors
00110 
00111         //- Return a reference to the selected decomposition method
00112         static autoPtr<decompositionMethod> New
00113         (
00114             const dictionary& decompositionDict
00115         );
00116 
00117         //- Return a reference to the selected decomposition method
00118         static autoPtr<decompositionMethod> New
00119         (
00120             const dictionary& decompositionDict,
00121             const polyMesh& mesh
00122         );
00123 
00124 
00125     // Constructors
00126 
00127         //- Construct given the decomposition dictionary
00128         decompositionMethod(const dictionary& decompositionDict)
00129         :
00130             decompositionDict_(decompositionDict),
00131             nProcessors_
00132             (
00133                 readLabel(decompositionDict.lookup("numberOfSubdomains"))
00134             )
00135         {}
00136 
00137 
00138     // Destructor
00139 
00140         virtual ~decompositionMethod()
00141         {}
00142 
00143 
00144     // Member Functions
00145 
00146         //- Is method parallel aware (i.e. does it synchronize domains across
00147         //  proc boundaries)
00148         virtual bool parallelAware() const = 0;
00149 
00150         //- Return for every coordinate the wanted processor number. Use the
00151         //  mesh connectivity (if needed)
00152         virtual labelList decompose
00153         (
00154             const pointField& points,
00155             const scalarField& pointWeights
00156         ) = 0;
00157 
00158         //- Like decompose but with uniform weights on the points
00159         virtual labelList decompose(const pointField&);
00160 
00161 
00162         //- Return for every coordinate the wanted processor number. Gets
00163         //  passed agglomeration map (from fine to coarse cells) and coarse cell
00164         //  location. Can be overridden by decomposers that provide this
00165         //  functionality natively. Coarse cells are local to the processor
00166         //  (if in parallel). If you want to have coarse cells spanning
00167         //  processors use the globalCellCells instead.
00168         virtual labelList decompose
00169         (
00170             const labelList& cellToRegion,
00171             const pointField& regionPoints,
00172             const scalarField& regionWeights
00173         );
00174 
00175         //- Like decompose but with uniform weights on the regions
00176         virtual labelList decompose
00177         (
00178             const labelList& cellToRegion,
00179             const pointField& regionPoints
00180         );
00181 
00182 
00183         //- Return for every coordinate the wanted processor number. Explicitly
00184         //  provided connectivity - does not use mesh_.
00185         //  The connectivity is equal to mesh.cellCells() except for
00186         //  - in parallel the cell numbers are global cell numbers (starting
00187         //    from 0 at processor0 and then incrementing all through the
00188         //    processors)
00189         //  - the connections are across coupled patches
00190         virtual labelList decompose
00191         (
00192             const labelListList& globalCellCells,
00193             const pointField& cc,
00194             const scalarField& cWeights
00195         ) = 0;
00196 
00197         //- Like decompose but with uniform weights on the cells
00198         virtual labelList decompose
00199         (
00200             const labelListList& globalCellCells,
00201             const pointField& cc
00202         );
00203 
00204 };
00205 
00206 
00207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00208 
00209 } // End namespace Foam
00210 
00211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00212 
00213 #endif
00214 
00215 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines