1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "directInteractionList.H"
28 #include "interactionLists.H"
30 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32 void Foam::directInteractionList::buildDirectInteractionList
34 bool pointPointListBuild
37 Info<< nl << "Building list of direct interaction neighbours" << endl;
39 const polyMesh& mesh(il_.mesh());
41 List<DynamicList<label> > directInteractionList(mesh.nCells());
43 if (pointPointListBuild)
45 Info<< tab << "Point-Point direct interaction list build." << endl;
49 forAll (mesh.points(), pointIIndex)
53 pointJIndex = pointIIndex;
54 pointJIndex != mesh.points().size();
58 if (il_.testPointPointDistance(pointIIndex, pointJIndex))
60 const labelList& ptICells
62 mesh.pointCells()[pointIIndex]
65 const labelList& ptJCells
67 mesh.pointCells()[pointJIndex]
72 const label cellI(ptICells[pIC]);
76 const label cellJ(ptJCells[pJC]);
84 directInteractionList[cellI],
90 directInteractionList[cellI].append(cellJ);
100 directInteractionList[cellJ],
107 directInteractionList[cellJ].append(cellI);
118 Info<< tab << "Point-Face, Edge-Edge direct interaction list build."
121 forAll(mesh.points(), p)
123 forAll(mesh.faces(), f)
125 if (il_.testPointFaceDistance(p, f))
127 const labelList& pCells(mesh.pointCells()[p]);
129 const label cellO(mesh.faceOwner()[f]);
133 const label cellI(pCells[pC]);
135 // cells are not added to their own DIL
143 directInteractionList[cellI],
150 directInteractionList[cellI].append(cellO);
160 directInteractionList[cellO],
167 directInteractionList[cellO].append(cellI);
171 if (mesh.isInternalFace(f))
173 // boundary faces will not have neighbour
176 const label cellN(mesh.faceNeighbour()[f]);
184 directInteractionList[cellI],
191 directInteractionList[cellI].append(cellN);
201 directInteractionList[cellN],
208 directInteractionList[cellN].append(cellI);
219 forAll(mesh.edges(), edgeIIndex)
221 const edge& eI(mesh.edges()[edgeIIndex]);
225 edgeJIndex = edgeIIndex + 1;
226 edgeJIndex != mesh.edges().size();
230 const edge& eJ(mesh.edges()[edgeJIndex]);
232 if (il_.testEdgeEdgeDistance(eI, eJ))
234 const labelList& eICells(mesh.edgeCells()[edgeIIndex]);
236 const labelList& eJCells(mesh.edgeCells()[edgeJIndex]);
240 const label cellI(eICells[eIC]);
244 const label cellJ(eJCells[eJC]);
252 directInteractionList[cellI],
259 directInteractionList[cellI].append(cellJ);
269 directInteractionList[cellJ],
276 directInteractionList[cellJ].append(cellI);
286 forAll(directInteractionList, transDIL)
288 (*this)[transDIL].transfer
290 directInteractionList[transDIL].shrink()
303 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
305 Foam::directInteractionList::directInteractionList
307 const interactionLists& il,
308 bool pointPointListBuild
311 labelListList(il.mesh().nCells()),
314 if ((*this).size() > 1)
316 buildDirectInteractionList(pointPointListBuild);
318 else if ((*this).size() == 1)
321 << "Single cell mesh, no direct interaction lists required."
324 (*this)[0].setSize(0);
329 Foam::directInteractionList::directInteractionList
331 const interactionLists& il
334 labelListList(il.mesh().nCells()),
337 Info<< "Read directInteractionList from disk not implemented" << endl;
341 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
343 Foam::directInteractionList::~directInteractionList()
347 // ************************************************************************* //