diff --git a/src/lagrangian/basic/InteractionLists/InteractionLists.C b/src/lagrangian/basic/InteractionLists/InteractionLists.C index d02500fe626295903fb3b3073194ab94e3fd0f68..a30489beb6c4b79141972b658c8182f69eb995dc 100644 --- a/src/lagrangian/basic/InteractionLists/InteractionLists.C +++ b/src/lagrangian/basic/InteractionLists/InteractionLists.C @@ -662,7 +662,7 @@ Foam::InteractionLists<ParticleType>::InteractionLists rilInverse_[cellI].transfer(rilInverseTemp[cellI]); } - // Direct interaction list + // Direct interaction list and direct wall faces Info<< " Building direct interaction lists" << endl; @@ -675,8 +675,31 @@ Foam::InteractionLists<ParticleType>::InteractionLists 100.0 ); + DynamicList<label> localWallFaces; + + forAll(mesh.boundaryMesh(), patchI) + { + const polyPatch& patch = mesh.boundaryMesh()[patchI]; + + if (isA<wallPolyPatch>(patch)) + { + localWallFaces.append(identity(patch.size()) + patch.start()); + } + } + + indexedOctree<treeDataFace> wallFacesTree + ( + treeDataFace(true, mesh, localWallFaces), + procBbRndExt, + 8, // maxLevel, + 10, // leafSize, + 100.0 + ); + dil_.setSize(mesh_.nCells()); + directWallFaces_.setSize(mesh.nCells()); + forAll(cellBbs, cellI) { const treeBoundBox& cellBb = cellBbs[cellI]; @@ -687,7 +710,7 @@ Foam::InteractionLists<ParticleType>::InteractionLists cellBb.max() + interactionVec ); - // Find all elements intersecting box. + // Find all cells intersecting extendedBb labelList interactingElems ( allCellsTree.findBox(extendedBb) @@ -715,96 +738,21 @@ Foam::InteractionLists<ParticleType>::InteractionLists } dil_[cellI].transfer(cellDIL); - } - - // Direct wall faces - - // DynamicLists for data gathering - DynamicList<label> thisCellOnlyWallFaces; - DynamicList<label> otherCellOnlyWallFaces; - List<DynamicList<label> > wallFacesTemp(mesh_.nCells()); - - const labelList& patchID = mesh_.boundaryMesh().patchID(); - - label nInternalFaces = mesh_.nInternalFaces(); - forAll(wallFacesTemp, thisCellI) - { - // Find all of the wall faces for the current cell - const labelList& thisCellFaces = mesh_.cells()[thisCellI]; - - DynamicList<label>& thisCellWallFaces = wallFacesTemp[thisCellI]; - - thisCellOnlyWallFaces.clear(); - - forAll(thisCellFaces, tCFI) - { - label faceI = thisCellFaces[tCFI]; - - if (!mesh_.isInternalFace(faceI)) - { - label patchI = patchID[faceI - nInternalFaces]; + // Find all wall faces intersecting extendedBb + interactingElems = wallFacesTree.findBox(extendedBb); - const polyPatch& patch = mesh_.boundaryMesh()[patchI]; + directWallFaces_[cellI].setSize(interactingElems.size(), -1); - if (isA<wallPolyPatch>(patch)) - { - thisCellOnlyWallFaces.append(faceI); - } - } - } - - // Add all the found wall faces to this cell's list, and - // retain the wall faces for this cell only to add to other - // cells. - thisCellWallFaces.append(thisCellOnlyWallFaces); - - // Loop over all of the cells in the dil for this cell, adding - // the wallFaces for this cell to the other cell's wallFace - // list, and all of the wallFaces for the other cell to this - // cell's list - - const labelList& cellDil = dil_[thisCellI]; - - forAll(cellDil, i) + forAll(interactingElems, i) { - label otherCellI = cellDil[i]; - - const labelList& otherCellFaces = mesh_.cells()[otherCellI]; - - DynamicList<label>& otherCellWallFaces = wallFacesTemp[otherCellI]; - - otherCellOnlyWallFaces.clear(); - - forAll(otherCellFaces, oCFI) - { - label faceI = otherCellFaces[oCFI]; - - if (!mesh_.isInternalFace(faceI)) - { - label patchI = patchID[faceI - nInternalFaces]; - - const polyPatch& patch = mesh_.boundaryMesh()[patchI]; - - if (isA<wallPolyPatch>(patch)) - { - otherCellOnlyWallFaces.append(faceI); - } - } - } + label elemI = interactingElems[i]; - thisCellWallFaces.append(otherCellOnlyWallFaces); + label f = wallFacesTree.shapes().faceLabels()[elemI]; - otherCellWallFaces.append(thisCellOnlyWallFaces); + directWallFaces_[cellI][i] = f; } } - - directWallFaces_.setSize(mesh_.nCells()); - - forAll(directWallFaces_, i) - { - directWallFaces_[i].transfer(wallFacesTemp[i]); - } } diff --git a/src/lagrangian/basic/InteractionLists/InteractionLists.H b/src/lagrangian/basic/InteractionLists/InteractionLists.H index 943d7e161c87ef82a10b404b1a5a1066764beeb1..3746914f2078542870a247c7ac024fbb855b4da6 100644 --- a/src/lagrangian/basic/InteractionLists/InteractionLists.H +++ b/src/lagrangian/basic/InteractionLists/InteractionLists.H @@ -63,6 +63,7 @@ SourceFiles #include "globalIndexAndTransform.H" #include "indexedOctree.H" #include "treeDataCell.H" +#include "treeDataFace.H" #include "mapDistribute.H" #include "Random.H" @@ -104,9 +105,7 @@ class InteractionLists labelListList dil_; //- Wall faces on this processor that are in interaction range - // of each each cell, data subordinate to dil, i.e. if a cell - // B is on cell A's dil, then all of cell B's wall faces are - // considered posible interactions for cell A. + // of each each cell labelListList directWallFaces_; //- Referred interaction list - which real cells are to be