![]() |
|
00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2005 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 ProcessorTopology 00027 00028 Description 00029 Determines processor-processor connection. After instantiation contains 00030 on all processors the processor-processor connection table. 00031 00032 *this[procI] gives the list of neighbouring processors. 00033 00034 SourceFiles 00035 ProcessorTopology.C 00036 00037 \*---------------------------------------------------------------------------*/ 00038 00039 #ifndef ProcessorTopology_H 00040 #define ProcessorTopology_H 00041 00042 #include "labelList.H" 00043 00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00045 00046 namespace Foam 00047 { 00048 00049 /*---------------------------------------------------------------------------*\ 00050 Class ProcessorTopology Declaration 00051 \*---------------------------------------------------------------------------*/ 00052 00053 //- Struct to hold the patch index and the initialisation flag 00054 // for the patch schedule 00055 struct labool 00056 { 00057 label patch; 00058 bool init; 00059 bool bufferedTransfer; 00060 00061 friend bool operator!=(const labool& lb1, const labool& lb2) 00062 { 00063 return true; 00064 } 00065 00066 friend Ostream& operator<<(Ostream& os, const labool& lb) 00067 { 00068 os << lb.patch << token::SPACE 00069 << lb.init << token::SPACE 00070 << lb.bufferedTransfer; 00071 return os; 00072 } 00073 }; 00074 00075 typedef List<labool> patchScheduleList; 00076 00077 00078 template<class Patch, class ProcPatch> 00079 class ProcessorTopology 00080 : 00081 public labelListList 00082 { 00083 00084 private: 00085 00086 // Private data 00087 00088 //- Local map from neighbour proc to patchI. Different per processor! 00089 // -1 or patchI for connection to procID 00090 labelList procPatchMap_; 00091 00092 //- From cell (=processor) to face (processor-processor communication) 00093 labelListList cellFaces_; 00094 00095 //- From face (processor-processor communication) to cell (=processor) 00096 labelListList faceCells_; 00097 00098 //- Order in which the patches should be initialised/evaluated 00099 // corresponding to the schedule 00100 patchScheduleList patchSchedule_; 00101 00102 00103 // Private Member Functions 00104 00105 //- Return all neighbouring processors of this processor. Set 00106 // procPatchMap_. 00107 labelList procNeighbours(const PtrList<Patch>&); 00108 00109 //- Calculate cell-face and face-cell addressing. 00110 void calcAddressing(); 00111 00112 00113 public: 00114 00115 // Constructors 00116 00117 //- Construct from boundaryMesh 00118 ProcessorTopology(const PtrList<Patch>& patches); 00119 00120 00121 // Member Functions 00122 00123 //- From processor to unique inter-processor 'face'. 00124 const labelListList& cellFaces() const 00125 { 00126 return cellFaces_; 00127 } 00128 00129 //- From unique inter-processor 'face' to the two processors using it. 00130 const labelListList& faceCells() const 00131 { 00132 return faceCells_; 00133 } 00134 00135 //- from neighbour processor to index in boundaryMesh. Local information 00136 // (so not same over all processors) 00137 const labelList& procPatchMap() const 00138 { 00139 return procPatchMap_; 00140 } 00141 00142 //- Order in which the patches should be initialised/evaluated 00143 // corresponding to the schedule 00144 const patchScheduleList& patchSchedule() const 00145 { 00146 return patchSchedule_; 00147 } 00148 00149 //- Get label of 'face' for connection to neighbour procID on current 00150 // processor. 00151 label getFace(const label nbrProcID) const; 00152 00153 //- Get label of 'face' for connection to neighbour procID 00154 label getFace(const label myProcID, const label nbrProcID) const; 00155 }; 00156 00157 00158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00159 00160 } // End namespace Foam 00161 00162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00163 00164 #ifdef NoRepository 00165 # include "ProcessorTopology.C" 00166 #endif 00167 00168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00169 00170 #endif 00171 00172 // ************************************************************************* //