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