|
|
|
lduAddressing.HGo 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-2007 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 lduAddressing 00027 00028 Description 00029 The class contains the addressing required by the lduMatrix: upper, lower 00030 and losort. It can be created in two ways: either with references to 00031 upper and lower in which case it stores references or from labelLists, 00032 in which case it stores the addressing itself. Additionally, the losort 00033 addressing belongs to the class is as on lazy evaluation. 00034 00035 The ordering of owner addresses is such that the labels are in 00036 increasing order, with groups of identical labels for edges 00037 "owned" by the same point. The neighbour labels are also ordered 00038 in ascending order but only for groups of edges belonging to each 00039 point. An example is given below: 00040 owner neighbour 00041 0 1 00042 0 20 00043 1 2 00044 1 21 00045 2 3 00046 2 22 00047 3 4 00048 3 23 00049 4 5 00050 4 24 00051 5 6 00052 5 25 00053 6 7 00054 6 26 00055 7 8 00056 7 27 00057 8 9 00058 8 28 00059 9 10 00060 9 29 00061 00062 There exists an alternative way of addressing the owner 00063 list: instead of repeating the same label in the owner list, it is 00064 possible to address the start of each point neighbours in the 00065 neighbour list. This reduces the size of owner addressing from a list 00066 over all edges to a list over all points + 1: 00067 00068 Owner start list: 0 2 4 6 8 10 12 14 16 18 00069 00070 We shall use the second form of the addressing for fast lookup 00071 of edge label from the known owner and neighbour, using the following 00072 algorithm: 1) take the owner label and position the start of lookup 00073 using the owner start list 2) loop through all neighbours of this 00074 owner (ending at the start of lookup of owner + 1) until the match 00075 with current neighbour is found. The index used on the neighbour list 00076 for the match is the edge index. 00077 00078 While owner start addressing allows us to find the edge owned by the 00079 points, it is also necessary to find the edges for which the point is 00080 a neighbour. Losort addressing lists the edges neighboured by the 00081 point and we shall use the same trick as above to address into this 00082 list. Thus, for every point the losort start gives the address of the 00083 first face to neighbour this point. 00084 00085 SourceFiles 00086 lduAddressing.C 00087 00088 \*---------------------------------------------------------------------------*/ 00089 00090 #ifndef lduAddressing_H 00091 #define lduAddressing_H 00092 00093 #include "labelList.H" 00094 #include "lduSchedule.H" 00095 00096 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00097 00098 namespace Foam 00099 { 00100 00101 /*---------------------------------------------------------------------------*\ 00102 Class lduAddressing Declaration 00103 \*---------------------------------------------------------------------------*/ 00104 00105 class lduAddressing 00106 { 00107 // Private data 00108 00109 //- Number of equations 00110 label size_; 00111 00112 00113 //- Demand-driven data 00114 00115 //- Losort addressing 00116 mutable labelList* losortPtr_; 00117 00118 //- Owner start addressing 00119 mutable labelList* ownerStartPtr_; 00120 00121 //- Losort start addressing 00122 mutable labelList* losortStartPtr_; 00123 00124 00125 // Private Member Functions 00126 00127 //- Disallow default bitwise copy construct 00128 lduAddressing(const lduAddressing&); 00129 00130 //- Disallow default bitwise assignment 00131 void operator=(const lduAddressing&); 00132 00133 //- Calculate losort 00134 void calcLosort() const; 00135 00136 //- Calculate owner start 00137 void calcOwnerStart() const; 00138 00139 //- Calculate losort start 00140 void calcLosortStart() const; 00141 00142 00143 public: 00144 00145 // Constructor 00146 lduAddressing(const label nEqns) 00147 : 00148 size_(nEqns), 00149 losortPtr_(NULL), 00150 ownerStartPtr_(NULL), 00151 losortStartPtr_(NULL) 00152 {} 00153 00154 00155 // Destructor 00156 00157 virtual ~lduAddressing(); 00158 00159 00160 // Member Functions 00161 00162 //- Return number of equations 00163 label size() const 00164 { 00165 return size_; 00166 } 00167 00168 //- Return lower addressing 00169 virtual const unallocLabelList& lowerAddr() const = 0; 00170 00171 //- Return upper addressing 00172 virtual const unallocLabelList& upperAddr() const = 0; 00173 00174 //- Return patch to internal addressing given patch number 00175 virtual const unallocLabelList& patchAddr 00176 ( 00177 const label patchNo 00178 ) const = 0; 00179 00180 // Return patch field evaluation schedule 00181 virtual const lduSchedule& patchSchedule() const = 0; 00182 00183 //- Return losort addressing 00184 const unallocLabelList& losortAddr() const; 00185 00186 //- Return owner start addressing 00187 const unallocLabelList& ownerStartAddr() const; 00188 00189 //- Return losort start addressing 00190 const unallocLabelList& losortStartAddr() const; 00191 00192 //- Return off-diagonal index given owner and neighbour label 00193 label triIndex(const label a, const label b) const; 00194 }; 00195 00196 00197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00198 00199 } // End namespace Foam 00200 00201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00202 00203 #endif 00204 00205 // ************************************************************************* // |