directInteractionList.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "directInteractionList.H"
00028 #include "interactionLists.H"
00029
00030
00031
00032 void Foam::directInteractionList::buildDirectInteractionList
00033 (
00034 bool pointPointListBuild
00035 )
00036 {
00037 Info<< nl << "Building list of direct interaction neighbours" << endl;
00038
00039 const polyMesh& mesh(il_.mesh());
00040
00041 List<DynamicList<label> > directInteractionList(mesh.nCells());
00042
00043 if (pointPointListBuild)
00044 {
00045 Info<< tab << "Point-Point direct interaction list build." << endl;
00046
00047 label pointJIndex;
00048
00049 forAll (mesh.points(), pointIIndex)
00050 {
00051 for
00052 (
00053 pointJIndex = pointIIndex;
00054 pointJIndex != mesh.points().size();
00055 ++pointJIndex
00056 )
00057 {
00058 if (il_.testPointPointDistance(pointIIndex, pointJIndex))
00059 {
00060 const labelList& ptICells
00061 (
00062 mesh.pointCells()[pointIIndex]
00063 );
00064
00065 const labelList& ptJCells
00066 (
00067 mesh.pointCells()[pointJIndex]
00068 );
00069
00070 forAll(ptICells, pIC)
00071 {
00072 const label cellI(ptICells[pIC]);
00073
00074 forAll(ptJCells, pJC)
00075 {
00076 const label cellJ(ptJCells[pJC]);
00077
00078 if (cellJ > cellI)
00079 {
00080 if
00081 (
00082 findIndex
00083 (
00084 directInteractionList[cellI],
00085 cellJ
00086 )
00087 == -1
00088 )
00089 {
00090 directInteractionList[cellI].append(cellJ);
00091 }
00092 }
00093
00094 if (cellI > cellJ)
00095 {
00096 if
00097 (
00098 findIndex
00099 (
00100 directInteractionList[cellJ],
00101 cellI
00102 )
00103 ==
00104 -1
00105 )
00106 {
00107 directInteractionList[cellJ].append(cellI);
00108 }
00109 }
00110 }
00111 }
00112 }
00113 }
00114 }
00115 }
00116 else
00117 {
00118 Info<< tab << "Point-Face, Edge-Edge direct interaction list build."
00119 << endl;
00120
00121 forAll(mesh.points(), p)
00122 {
00123 forAll(mesh.faces(), f)
00124 {
00125 if (il_.testPointFaceDistance(p, f))
00126 {
00127 const labelList& pCells(mesh.pointCells()[p]);
00128
00129 const label cellO(mesh.faceOwner()[f]);
00130
00131 forAll(pCells, pC)
00132 {
00133 const label cellI(pCells[pC]);
00134
00135
00136
00137 if (cellO > cellI)
00138 {
00139 if
00140 (
00141 findIndex
00142 (
00143 directInteractionList[cellI],
00144 cellO
00145 )
00146 ==
00147 -1
00148 )
00149 {
00150 directInteractionList[cellI].append(cellO);
00151 }
00152 }
00153
00154 if (cellI > cellO)
00155 {
00156 if
00157 (
00158 findIndex
00159 (
00160 directInteractionList[cellO],
00161 cellI
00162 )
00163 ==
00164 -1
00165 )
00166 {
00167 directInteractionList[cellO].append(cellI);
00168 }
00169 }
00170
00171 if (mesh.isInternalFace(f))
00172 {
00173
00174
00175
00176 const label cellN(mesh.faceNeighbour()[f]);
00177
00178 if (cellN > cellI)
00179 {
00180 if
00181 (
00182 findIndex
00183 (
00184 directInteractionList[cellI],
00185 cellN
00186 )
00187 ==
00188 -1
00189 )
00190 {
00191 directInteractionList[cellI].append(cellN);
00192 }
00193 }
00194
00195 if (cellI > cellN)
00196 {
00197 if
00198 (
00199 findIndex
00200 (
00201 directInteractionList[cellN],
00202 cellI
00203 )
00204 ==
00205 -1
00206 )
00207 {
00208 directInteractionList[cellN].append(cellI);
00209 }
00210 }
00211 }
00212 }
00213 }
00214 }
00215 }
00216
00217 label edgeJIndex;
00218
00219 forAll(mesh.edges(), edgeIIndex)
00220 {
00221 const edge& eI(mesh.edges()[edgeIIndex]);
00222
00223 for
00224 (
00225 edgeJIndex = edgeIIndex + 1;
00226 edgeJIndex != mesh.edges().size();
00227 ++edgeJIndex
00228 )
00229 {
00230 const edge& eJ(mesh.edges()[edgeJIndex]);
00231
00232 if (il_.testEdgeEdgeDistance(eI, eJ))
00233 {
00234 const labelList& eICells(mesh.edgeCells()[edgeIIndex]);
00235
00236 const labelList& eJCells(mesh.edgeCells()[edgeJIndex]);
00237
00238 forAll(eICells, eIC)
00239 {
00240 const label cellI(eICells[eIC]);
00241
00242 forAll(eJCells, eJC)
00243 {
00244 const label cellJ(eJCells[eJC]);
00245
00246 if (cellJ > cellI)
00247 {
00248 if
00249 (
00250 findIndex
00251 (
00252 directInteractionList[cellI],
00253 cellJ
00254 )
00255 ==
00256 -1
00257 )
00258 {
00259 directInteractionList[cellI].append(cellJ);
00260 }
00261 }
00262
00263 if (cellI > cellJ)
00264 {
00265 if
00266 (
00267 findIndex
00268 (
00269 directInteractionList[cellJ],
00270 cellI
00271 )
00272 ==
00273 -1
00274 )
00275 {
00276 directInteractionList[cellJ].append(cellI);
00277 }
00278 }
00279 }
00280 }
00281 }
00282 }
00283 }
00284 }
00285
00286 forAll(directInteractionList, transDIL)
00287 {
00288 (*this)[transDIL].transfer
00289 (
00290 directInteractionList[transDIL].shrink()
00291 );
00292 }
00293
00294
00295
00296 forAll((*this), dIL)
00297 {
00298 sort((*this)[dIL]);
00299 }
00300 }
00301
00302
00303
00304
00305 Foam::directInteractionList::directInteractionList
00306 (
00307 const interactionLists& il,
00308 bool pointPointListBuild
00309 )
00310 :
00311 labelListList(il.mesh().nCells()),
00312 il_(il)
00313 {
00314 if ((*this).size() > 1)
00315 {
00316 buildDirectInteractionList(pointPointListBuild);
00317 }
00318 else if ((*this).size() == 1)
00319 {
00320 Info<< nl
00321 << "Single cell mesh, no direct interaction lists required."
00322 << endl;
00323
00324 (*this)[0].setSize(0);
00325 }
00326 }
00327
00328
00329 Foam::directInteractionList::directInteractionList
00330 (
00331 const interactionLists& il
00332 )
00333 :
00334 labelListList(il.mesh().nCells()),
00335 il_(il)
00336 {
00337 Info<< "Read directInteractionList from disk not implemented" << endl;
00338 }
00339
00340
00341
00342
00343 Foam::directInteractionList::~directInteractionList()
00344 {}
00345
00346
00347
Copyright © 2000-2009 OpenCFD Ltd