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