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

domainDecomposition.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::domainDecomposition
00027 
00028 Description
00029     Automatic domain decomposition class for FOAM meshes
00030 
00031 SourceFiles
00032     domainDecomposition.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef domainDecomposition_H
00037 #define domainDecomposition_H
00038 
00039 #include "fvMesh.H"
00040 #include "labelList.H"
00041 #include "SLList.H"
00042 #include "PtrList.H"
00043 #include "point.H"
00044 
00045 #ifndef namespaceFoam
00046 #define namespaceFoam
00047     using namespace Foam;
00048 #endif
00049 
00050 /*---------------------------------------------------------------------------*\
00051                            Class domainDecomposition Declaration
00052 \*---------------------------------------------------------------------------*/
00053 
00054 class domainDecomposition
00055 :
00056     public fvMesh
00057 {
00058     // Private data
00059 
00060         //- Mesh decomposition control dictionary
00061         IOdictionary decompositionDict_;
00062 
00063         //- Number of processors in decomposition
00064         label nProcs_;
00065 
00066         //- Is the decomposition data to be distributed for each processor
00067         bool distributed_;
00068 
00069         //- Processor label for each cell
00070         labelList cellToProc_;
00071 
00072         //- Labels of points for each processor
00073         labelListList procPointAddressing_;
00074 
00075         //- Labels of faces for each processor
00076         // Note: Face turning index is stored as the sign on addressing
00077         // Only the processor boundary faces are affected: if the sign of the
00078         // index is negative, the processor face is the reverse of the
00079         // original face. In order to do this properly, all face
00080         // indices will be incremented by 1 and the decremented as
00081         // necessary t avoid the problem of face number zero having no
00082         // sign.  
00083         labelListList procFaceAddressing_;
00084 
00085         //- Labels of cells for each processor
00086         labelListList procCellAddressing_;
00087 
00088         //- Original patch index for every processor patch
00089         labelListList procBoundaryAddressing_;
00090 
00091         //- Sizes for processor mesh patches
00092         // Excludes inter-processor boundaries
00093         labelListList procPatchSize_;
00094 
00095         //- Start indices for processor patches
00096         // Excludes inter-processor boundaries
00097         labelListList procPatchStartIndex_;
00098 
00099         //- Neighbour processor ID for inter-processor boundaries
00100         labelListList procNeighbourProcessors_;
00101 
00102         //- Sizes for inter-processor patches
00103         labelListList procProcessorPatchSize_;
00104 
00105         //- Start indices for inter-processor patches
00106         labelListList procProcessorPatchStartIndex_;
00107 
00108         //- List of globally shared point labels
00109         labelList globallySharedPoints_;
00110 
00111         //- Are there cyclic-parallel faces
00112         bool cyclicParallel_;
00113 
00114 
00115     // Private Member Functions
00116 
00117         void distributeCells();
00118 
00119         //- Mark all elements with value or -2 if occur twice
00120         static void mark
00121         (
00122             const labelList& zoneElems,
00123             const label zoneI,
00124             labelList& elementToZone
00125         );
00126 
00127 public:
00128 
00129     // Constructors
00130 
00131         //- Construct from IOobject
00132         domainDecomposition(const IOobject& io);
00133 
00134 
00135     // Destructor
00136 
00137         ~domainDecomposition();
00138 
00139 
00140     // Member Functions
00141 
00142         //- Number of processor in decomposition
00143         label nProcs() const
00144         {
00145             return nProcs_;
00146         }
00147 
00148         //- Is the decomposition data to be distributed for each processor
00149         bool distributed() const
00150         {
00151             return distributed_;
00152         }
00153 
00154         //- Decompose mesh. Optionally remove zero-sized patches.
00155         void decomposeMesh(const bool filterEmptyPatches);
00156 
00157         //- Write decomposition
00158         bool writeDecomposition();
00159 
00160         //- Cell-processor decomposition labels
00161         const labelList& cellToProc() const
00162         {
00163             return cellToProc_;
00164         }
00165 };
00166 
00167 
00168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00169 
00170 #endif
00171 
00172 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd