diff --git a/src/lagrangian/basic/InteractionLists/DirectInteractionList/DirectInteractionList.C b/src/lagrangian/basic/InteractionLists/DirectInteractionList/DirectInteractionList.C deleted file mode 100644 index 68c7d6dabf7a089d388031de3f11c121d2eaa8f7..0000000000000000000000000000000000000000 --- a/src/lagrangian/basic/InteractionLists/DirectInteractionList/DirectInteractionList.C +++ /dev/null @@ -1,548 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "DirectInteractionList.H" -#include "InteractionLists.H" -#include "ReferredCellList.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template<class ParticleType> -void Foam::DirectInteractionList<ParticleType>::buildDirectInteractionList -( - bool pointPointListBuild -) -{ - Info<< " Building list of direct interaction neighbours" << endl; - - const polyMesh& mesh = il_.mesh(); - - List<DynamicList<label> > DirectInteractionList(mesh.nCells()); - - if (pointPointListBuild) - { - Info<< " Point-Point direct interaction list build." << endl; - - label pointJIndex; - - forAll (mesh.points(), pointIIndex) - { - for - ( - pointJIndex = pointIIndex; - pointJIndex != mesh.points().size(); - ++pointJIndex - ) - { - if (il_.testPointPointDistance(pointIIndex, pointJIndex)) - { - const labelList& ptICells - ( - mesh.pointCells()[pointIIndex] - ); - - const labelList& ptJCells - ( - mesh.pointCells()[pointJIndex] - ); - - forAll(ptICells, pIC) - { - const label cellI(ptICells[pIC]); - - forAll(ptJCells, pJC) - { - const label cellJ(ptJCells[pJC]); - - if (cellJ > cellI) - { - if - ( - findIndex - ( - DirectInteractionList[cellI], - cellJ - ) - == -1 - ) - { - DirectInteractionList[cellI].append(cellJ); - } - } - - if (cellI > cellJ) - { - if - ( - findIndex - ( - DirectInteractionList[cellJ], - cellI - ) - == - -1 - ) - { - DirectInteractionList[cellJ].append(cellI); - } - } - } - } - } - } - } - } - else - { - Info<< " Point-Face, Edge-Edge direct interaction list build." - << endl; - - forAll(mesh.points(), p) - { - forAll(mesh.faces(), f) - { - if (il_.testPointFaceDistance(p, f)) - { - const labelList& pCells(mesh.pointCells()[p]); - - const label cellO(mesh.faceOwner()[f]); - - forAll(pCells, pC) - { - const label cellI(pCells[pC]); - - // cells are not added to their own DIL - - if (cellO > cellI) - { - if - ( - findIndex - ( - DirectInteractionList[cellI], - cellO - ) - == - -1 - ) - { - DirectInteractionList[cellI].append(cellO); - } - } - - if (cellI > cellO) - { - if - ( - findIndex - ( - DirectInteractionList[cellO], - cellI - ) - == - -1 - ) - { - DirectInteractionList[cellO].append(cellI); - } - } - - if (mesh.isInternalFace(f)) - { - // boundary faces will not have neighbour - // information - - const label cellN(mesh.faceNeighbour()[f]); - - if (cellN > cellI) - { - if - ( - findIndex - ( - DirectInteractionList[cellI], - cellN - ) - == - -1 - ) - { - DirectInteractionList[cellI].append(cellN); - } - } - - if (cellI > cellN) - { - if - ( - findIndex - ( - DirectInteractionList[cellN], - cellI - ) - == - -1 - ) - { - DirectInteractionList[cellN].append(cellI); - } - } - } - } - } - } - } - - label edgeJIndex; - - forAll(mesh.edges(), edgeIIndex) - { - const edge& eI(mesh.edges()[edgeIIndex]); - - for - ( - edgeJIndex = edgeIIndex + 1; - edgeJIndex != mesh.edges().size(); - ++edgeJIndex - ) - { - const edge& eJ(mesh.edges()[edgeJIndex]); - - if (il_.testEdgeEdgeDistance(eI, eJ)) - { - const labelList& eICells(mesh.edgeCells()[edgeIIndex]); - - const labelList& eJCells(mesh.edgeCells()[edgeJIndex]); - - forAll(eICells, eIC) - { - const label cellI(eICells[eIC]); - - forAll(eJCells, eJC) - { - const label cellJ(eJCells[eJC]); - - if (cellJ > cellI) - { - if - ( - findIndex - ( - DirectInteractionList[cellI], - cellJ - ) - == - -1 - ) - { - DirectInteractionList[cellI].append(cellJ); - } - } - - if (cellI > cellJ) - { - if - ( - findIndex - ( - DirectInteractionList[cellJ], - cellI - ) - == - -1 - ) - { - DirectInteractionList[cellJ].append(cellI); - } - } - } - } - } - } - } - } - - forAll(DirectInteractionList, transDIL) - { - (*this)[transDIL].transfer - ( - DirectInteractionList[transDIL].shrink() - ); - } - - // sorting DILs - - forAll((*this), dilI) - { - sort((*this)[dilI]); - } -} - - -template<class ParticleType> -void Foam::DirectInteractionList<ParticleType>::buildWallFaces() -{ - Info<< " Building list of wall faces in range of cells" << endl; - - const polyMesh& mesh = il_.mesh(); - - // DynamicLists for data gathering - DynamicList<label> thisCellOnlyWallFaces; - DynamicList<label> otherCellOnlyWallFaces; - - forAll(wallFaces_, thisCellI) - { - // Find all of the wall faces for the current cell - - const labelList& thisCellFaces = mesh.cells()[thisCellI]; - - labelList& thisCellWallFaces = wallFaces_[thisCellI]; - - thisCellOnlyWallFaces.clear(); - - forAll(thisCellFaces, tCFI) - { - label faceI = thisCellFaces[tCFI]; - - if (!mesh.isInternalFace(faceI)) - { - label patchI = mesh.boundaryMesh().whichPatch(faceI); - const polyPatch& patch = mesh.boundaryMesh()[patchI]; - - // move reference point for wall - 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& dil = (*this)[thisCellI]; - - forAll(dil, i) - { - label otherCellI = dil[i]; - - const labelList& otherCellFaces = mesh.cells()[otherCellI]; - - labelList& otherCellWallFaces = wallFaces_[otherCellI]; - - otherCellOnlyWallFaces.clear(); - - forAll(otherCellFaces, oCFI) - { - label faceI = otherCellFaces[oCFI]; - - if (!mesh.isInternalFace(faceI)) - { - label patchI = mesh.boundaryMesh().whichPatch(faceI); - const polyPatch& patch = mesh.boundaryMesh()[patchI]; - - // move reference point for wall - if (isA<wallPolyPatch>(patch)) - { - otherCellOnlyWallFaces.append(faceI); - } - } - } - - thisCellWallFaces.append(otherCellOnlyWallFaces); - - otherCellWallFaces.append(thisCellOnlyWallFaces); - } - } -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template<class ParticleType> -Foam::DirectInteractionList<ParticleType>::DirectInteractionList -( - const InteractionLists<ParticleType>& il, - bool pointPointListBuild -) -: - labelListList(il.mesh().nCells()), - il_(il), - wallFaces_(il.mesh().nCells()), - referredCellsForInteraction_(il.mesh().nCells()) -{ - if ((*this).size() > 1) - { - buildDirectInteractionList(pointPointListBuild); - } - else if ((*this).size() == 1) - { - Info<< " Single cell mesh, no direct interaction lists required." - << endl; - - (*this)[0].setSize(0); - } - - buildWallFaces(); -} - - -template<class ParticleType> -Foam::DirectInteractionList<ParticleType>::DirectInteractionList -( - const InteractionLists<ParticleType>& il -) -: - labelListList(il.mesh().nCells()), - il_(il), - wallFaces_(il.mesh().nCells()), - referredCellsForInteraction_(il.mesh().nCells()) -{ - Info<< " Read DirectInteractionList from disk not implemented" << endl; -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class ParticleType> -Foam::DirectInteractionList<ParticleType>::~DirectInteractionList() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<class ParticleType> -void Foam::DirectInteractionList<ParticleType>::buildInverseAddressing() -{ - const ReferredCellList<ParticleType>& ril = il_.ril(); - - // Temporary Dynamic lists for accumulation - List<DynamicList<label> > referredCellsForInteraction - ( - referredCellsForInteraction_.size() - ); - - // Loop over all referred cells - forAll(ril, refCellI) - { - const ReferredCell<ParticleType>& refCell = ril[refCellI]; - - const labelList& realCells = refCell.realCellsForInteraction(); - - // Loop over all real cells in that the referred cell is to - // supply interactions to and record the index of this - // referred cell in the cells entry in - // referredCellsForInteraction_ - - forAll(realCells, realCellI) - { - referredCellsForInteraction[realCells[realCellI]].append(refCellI); - } - } - - forAll(referredCellsForInteraction_, cellI) - { - referredCellsForInteraction_[cellI].transfer - ( - referredCellsForInteraction[cellI] - ); - } -} - - -template<class ParticleType> -void Foam::DirectInteractionList<ParticleType>:: -writeReferredCellsForInteraction() const -{ - const ReferredCellList<ParticleType>& ril = il_.ril(); - - forAll(*this, cellI) - { - const labelList& refCells = referredCellsForInteraction_[cellI]; - - if (!refCells.size()) - { - continue; - } - - fileName fName = - il_.mesh().time().path() - /"referredCellsForInteraction_" + name(cellI) + ".obj"; - - Info<< " Writing " << fName.name() << endl; - - OFstream referredCellsFile(fName); - - label vertexOffset = 1; - - forAll(refCells, refCellForInteractionI) - { - const ReferredCell<ParticleType>& refCell = - ril[refCells[refCellForInteractionI]]; - - const pointField& refCellPts = refCell.points(); - - const faceList& refCellFaces = refCell.faces(); - - forAll(refCellPts, ptI) - { - referredCellsFile - << "v " - << refCellPts[ptI].x() << " " - << refCellPts[ptI].y() << " " - << refCellPts[ptI].z() - << nl; - } - - forAll(refCellFaces, faceI) - { - referredCellsFile << "f"; - - forAll(refCellFaces[faceI], fPtI) - { - referredCellsFile - << " " << refCellFaces[faceI][fPtI] + vertexOffset; - } - - referredCellsFile << nl; - } - - vertexOffset += refCellPts.size(); - } - - referredCellsFile.flush(); - } -} - - -// ************************************************************************* // diff --git a/src/lagrangian/basic/InteractionLists/DirectInteractionList/DirectInteractionList.H b/src/lagrangian/basic/InteractionLists/DirectInteractionList/DirectInteractionList.H deleted file mode 100644 index 9403016262030932d0ad1c14a83fa67001f53f24..0000000000000000000000000000000000000000 --- a/src/lagrangian/basic/InteractionLists/DirectInteractionList/DirectInteractionList.H +++ /dev/null @@ -1,158 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Class - Foam::DirectInteractionList - -Description - Data stored that specifies what a "real" cell (one on the current - processor) interacts with. - -SourceFiles - DirectInteractionListI.H - DirectInteractionList.C - -\*---------------------------------------------------------------------------*/ - -#ifndef DirectInteractionList_H -#define DirectInteractionList_H - -#include "polyMesh.H" -#include "List.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// Forward declaration of classes -template<class ParticleType> -class InteractionLists; - -/*---------------------------------------------------------------------------*\ - Class DirectInteractionList Declaration -\*---------------------------------------------------------------------------*/ - -template<class ParticleType> -class DirectInteractionList -: - public labelListList -{ - // Private data - - //- A reference to the InteractionLists object holding this object - const InteractionLists<ParticleType>& il_; - - //- Data specifying which patch faces of type "wall" are in range - // of each cell - labelListList wallFaces_; - - //- Data specifying which referred cells are in range of each - // cell, Inverse data of ReferredCell's realCellsForInteraction - labelListList referredCellsForInteraction_; - - - // Private Member Functions - - void buildDirectInteractionList - ( - bool pointPointListBuild - ); - - void buildWallFaces(); - - //- Disallow default bitwise copy construct - DirectInteractionList(const DirectInteractionList&); - - //- Disallow default bitwise assignment - void operator=(const DirectInteractionList&); - - -public: - - // Constructors - - //- Construct lists by searching the mesh - DirectInteractionList - ( - const InteractionLists<ParticleType>& il, - bool pointPointListBuild - ); - - //- Construct from file - DirectInteractionList - ( - const InteractionLists<ParticleType>& il - ); - - - // Destructor - - ~DirectInteractionList(); - - - // Member Functions - - //- Build referredCellsForInteraction by interrogating the - //- ReferredCellList of the InteractionLists object that owns - //- this object. - void buildInverseAddressing(); - - - // Access - - inline const labelListList& wallFaces() const; - - inline const labelListList& referredCellsForInteraction() const; - - inline const InteractionLists<ParticleType>& il() const; - - - // Write - - //- Write the referred cells in range of each real cell - void writeReferredCellsForInteraction() const; - -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "DirectInteractionListI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "DirectInteractionList.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/basic/InteractionLists/DirectInteractionList/DirectInteractionListI.H b/src/lagrangian/basic/InteractionLists/DirectInteractionList/DirectInteractionListI.H deleted file mode 100644 index 5b195cc2951c5dc437e7a88fd124c2b694af0f60..0000000000000000000000000000000000000000 --- a/src/lagrangian/basic/InteractionLists/DirectInteractionList/DirectInteractionListI.H +++ /dev/null @@ -1,53 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<class ParticleType> -inline const Foam::labelListList& -Foam::DirectInteractionList<ParticleType>::wallFaces() const -{ - return wallFaces_; -} - - -template<class ParticleType> -inline const Foam::labelListList& -Foam::DirectInteractionList<ParticleType>::referredCellsForInteraction() const -{ - return referredCellsForInteraction_; -} - - -template<class ParticleType> -inline const Foam::InteractionLists<ParticleType>& -Foam::DirectInteractionList<ParticleType>::il() const -{ - return il_; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/basic/InteractionLists/ReferredCellList/ReferredCell/ReferredCell.C b/src/lagrangian/basic/InteractionLists/ReferredCellList/ReferredCell/ReferredCell.C deleted file mode 100644 index c8c4f877969ebe9b69f71b37b2ac877efbd98ed4..0000000000000000000000000000000000000000 --- a/src/lagrangian/basic/InteractionLists/ReferredCellList/ReferredCell/ReferredCell.C +++ /dev/null @@ -1,556 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*----------------------------------------------------------------------------*/ - -#include "ReferredCell.H" -#include "InteractionLists.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template<class ParticleType> -void Foam::ReferredCell<ParticleType>::setConstructionData -( - const polyMesh& mesh, - const label sourceCell -) -{ - // Points - - const labelList& points = mesh.cellPoints()[sourceCell]; - - pointField sourceCellVertices(points.size()); - - forAll(sourceCellVertices, sCV) - { - sourceCellVertices[sCV] = mesh.points()[points[sCV]]; - } - - vertexPositions_ = referPositions(sourceCellVertices); - - - // Edges - - const labelList& edges = mesh.cellEdges()[sourceCell]; - - edgeList sourceCellEdges(edges.size()); - - forAll(sourceCellEdges, sCE) - { - sourceCellEdges[sCE] = mesh.edges()[edges[sCE]]; - } - - locallyMapEdgeList(points, sourceCellEdges); - - - // Faces - - labelList faces(mesh.cells()[sourceCell]); - - pointField sourceCellFaceCentres(faces.size()); - - vectorField sourceCellFaceAreas(faces.size()); - - labelListList sourceCellFaces(faces.size()); - - DynamicList<label> wallFaces; - - forAll(faces, f) - { - label faceI = faces[f]; - - sourceCellFaces[f] = mesh.faces()[faceI]; - - sourceCellFaceCentres[f] = mesh.faceCentres()[faceI]; - - sourceCellFaceAreas[f] = mesh.faceAreas()[faceI]; - - if (!mesh.isInternalFace(faceI)) - { - label patchI = mesh.boundaryMesh().whichPatch(faceI); - const polyPatch& patch = mesh.boundaryMesh()[patchI]; - - // move reference point for wall - if (isA<wallPolyPatch>(patch)) - { - wallFaces.append(f); - } - } - } - - wallFaces_.transfer(wallFaces); - - locallyMapFaceList(points, sourceCellFaces); - - faceCentres_ = referPositions(sourceCellFaceCentres); - - faceAreas_ = rotateVectors(sourceCellFaceAreas); -} - - -template<class ParticleType> -void Foam::ReferredCell<ParticleType>::locallyMapEdgeList -( - const labelList& points, - const edgeList& sourceCellEdges -) -{ - edges_.setSize(sourceCellEdges.size()); - - forAll(sourceCellEdges, sCE) - { - const edge& e(sourceCellEdges[sCE]); - - edges_[sCE].start() = findIndex(points, e.start()); - - edges_[sCE].end() = findIndex(points, e.end()); - - if - ( - edges_[sCE].start() == -1 - || edges_[sCE].end() == -1 - ) - { - FatalErrorIn("Foam::ReferredCell::locallyMapEdgeList") - << "edgeList and points labelList for " - << "referred cell do not match: " - << nl << "points: " << points - << nl << "egdes: " << sourceCellEdges - << abort(FatalError); - } - } -} - - -template<class ParticleType> -void Foam::ReferredCell<ParticleType>::locallyMapFaceList -( - const labelList& points, - const labelListList& sourceCellFaces -) -{ - faces_.setSize(sourceCellFaces.size()); - - forAll(sourceCellFaces, sCF) - { - const labelList& sourceCellFace(sourceCellFaces[sCF]); - - face& localFace(faces_[sCF]); - - localFace.setSize(sourceCellFace.size()); - - forAll(sourceCellFace, p) - { - localFace[p] = findIndex(points, sourceCellFace[p]); - - if (localFace[p] == -1) - { - FatalErrorIn("Foam::ReferredCell::locallyMapEdgeList") - << "edgeList and points labelList for " - << "referred cell do not match: " - << nl << "points: " << points - << nl << "faces: " << sourceCellFaces - << abort(FatalError); - } - } - } -} - - -template<class ParticleType> -Foam::vector Foam::ReferredCell<ParticleType>::referPosition -( - const vector& positionToRefer -) -{ - return offset_ + (rotation_ & positionToRefer); -} - - -template<class ParticleType> -Foam::pointField -Foam::ReferredCell<ParticleType>::referPositions -( - const pointField& positionsToRefer -) -{ - return offset_ + (rotation_ & positionsToRefer); -} - - -template<class ParticleType> -Foam::vector -Foam::ReferredCell<ParticleType>::rotateVector(const vector& vectorToRotate) -{ - return rotation_ & vectorToRotate; -} - - -template<class ParticleType> -Foam::vectorField -Foam::ReferredCell<ParticleType>::rotateVectors -( - const vectorField& vectorsToRotate -) -{ - return rotation_ & vectorsToRotate; -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template<class ParticleType> -Foam::ReferredCell<ParticleType>::ReferredCell() -: - IDLList<ParticleType>(), - sourceProc_(-1), - sourceCell_(-1), - vertexPositions_(), - edges_(), - faces_(), - wallFaces_(), - faceCentres_(), - faceAreas_(), - realCellsForInteraction_(), - offset_(vector::zero), - rotation_(I) -{} - - - -template<class ParticleType> -Foam::ReferredCell<ParticleType>::ReferredCell -( - const polyMesh& mesh, - const label sourceProc, - const label sourceCell, - const vector& offset, - const tensor& rotation -) -: - IDLList<ParticleType>(), - sourceProc_(sourceProc), - sourceCell_(sourceCell), - edges_(), - faces_(), - wallFaces_(), - faceCentres_(), - faceAreas_(), - realCellsForInteraction_(), - offset_(offset), - rotation_(rotation) -{ - setConstructionData(mesh, sourceCell); -} - - -template<class ParticleType> -Foam::ReferredCell<ParticleType>::ReferredCell -( - const label sourceProc, - const label sourceCell, - const pointField& vertexPositions, - const edgeList& localEdges, - const faceList& localFaces, - const labelList& wallFaces, - const pointField& faceCentres, - const vectorField& faceAreas, - const vector& offset, - const tensor& rotation -) -: - IDLList<ParticleType>(), - sourceProc_(sourceProc), - sourceCell_(sourceCell), - edges_(localEdges), - faces_(localFaces), - wallFaces_(wallFaces), - faceCentres_(), - faceAreas_(), - realCellsForInteraction_(), - offset_(offset), - rotation_(rotation) -{ - // Supplied vertexPositions, faceCentres and faceAreas are of the - // "original" cell, and need to be transformed to the referred - // locations on construction - - vertexPositions_ = referPositions(vertexPositions); - - faceCentres_ = referPositions(faceCentres); - - faceAreas_ = rotateVectors(faceAreas); -} - - -template<class ParticleType> -Foam::ReferredCell<ParticleType>::ReferredCell -( - const polyMesh& mesh, - const label sourceProc, - const label sourceCell, - const vector& cS, - const vector& cD, - const vector& nS, - const vector& nD -) -: - IDLList<ParticleType>(), - sourceProc_(sourceProc), - sourceCell_(sourceCell) -{ - // It is assumed that the vectors originating from the faces being referred - // here are correct periodic faces - i.e. they have the same area etc. - - vector nA = -nS/mag(nS); - vector nB = nD/mag(nD); - - rotation_ = rotationTensor(nA, nB); - - offset_ = cD - (rotation_ & cS); - - // Allow sourceCell = -1 to create a dummy ReferredCell - // to obtain the transformation - - if(sourceCell >= 0) - { - setConstructionData(mesh, sourceCell); - } -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class ParticleType> -Foam::ReferredCell<ParticleType>::~ReferredCell() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<class ParticleType> -Foam::ReferredCell<ParticleType> Foam::ReferredCell<ParticleType>::reRefer -( - const vector& cS, - const vector& cD, - const vector& nS, - const vector& nD -) -{ - vector nA = -nS/mag(nS); - vector nB = nD/mag(nD); - - tensor newRotation = rotationTensor(nA, nB); - - vector newOffset = cD - (newRotation & cS); - - tensor reReferredRotation = newRotation & rotation_; - - vector reReferredOffset = newOffset + (newRotation & offset_); - - return ReferredCell - ( - sourceProc_, - sourceCell_, - rotation_.T() & (vertexPositions_ - offset_), - edges_, - faces_, - wallFaces_, - rotation_.T() & (faceCentres_ - offset_), - rotation_.T() & (faceAreas_), - reReferredOffset, - reReferredRotation - ); -} - - -template<class ParticleType> -Foam::vector Foam::ReferredCell<ParticleType>::referPosition -( - const vector& positionToRefer -) const -{ - return offset_ + (rotation_ & positionToRefer); -} - - -template<class ParticleType> -Foam::pointField Foam::ReferredCell<ParticleType>::referPosition -( - const pointField& positionsToRefer -) const -{ - return offset_ + (rotation_ & positionsToRefer); -} - - -template<class ParticleType> -Foam::vector Foam::ReferredCell<ParticleType>::rotateVector -( - const vector& vectorToRotate -) const -{ - return rotation_ & vectorToRotate; -} - - -template<class ParticleType> -Foam::vectorField Foam::ReferredCell<ParticleType>::rotateVectors -( - const vectorField& vectorsToRotate -) const -{ - return rotation_ & vectorsToRotate; -} - - -template<class ParticleType> -void Foam::ReferredCell<ParticleType>::referInParticle -( - ParticleType* incomingParticlePtr -) -{ - ParticleType& p = *incomingParticlePtr; - - p.position() = referPosition - ( - p.position() - ); - - p.transformProperties(rotation_); - - this->append(incomingParticlePtr); -} - - -template<class ParticleType> -bool Foam::ReferredCell<ParticleType>::duplicate -( - const ReferredCell<ParticleType>& refCellDupl -) const -{ - return - ( - sourceProc_ == refCellDupl.sourceProc() - && sourceCell_ == refCellDupl.sourceCell() - && mag(offset_ - refCellDupl.offset()) - < InteractionLists<ParticleType>::transTol - ); -} - - -template<class ParticleType> -bool Foam::ReferredCell<ParticleType>::duplicate -( - const label procNo, - const label nCells -) const -{ - return - ( - sourceProc_ == procNo - && sourceCell_ < nCells - && mag(offset_) - < InteractionLists<ParticleType>::transTol - ); -} - - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - -template<class ParticleType> -bool Foam::operator== -( - const ReferredCell<ParticleType>& a, - const ReferredCell<ParticleType>& b -) -{ - return const_cast<ReferredCell<ParticleType>&>(a).duplicate - ( - const_cast<const ReferredCell<ParticleType>&>(b) - ); -} - - -template<class ParticleType> -bool Foam::operator!= -( - const ReferredCell<ParticleType>& a, - const ReferredCell<ParticleType>& b -) -{ - return !(a == b); -} - - -template<class ParticleType> -Foam::Istream& Foam::operator>>(Istream& is, ReferredCell<ParticleType>& rC) -{ - - is >> rC.sourceProc_ - >> rC.sourceCell_ - >> rC.vertexPositions_ - >> rC.edges_ - >> rC.faces_ - >> rC.wallFaces_ - >> rC.faceCentres_ - >> rC.faceAreas_ - >> rC.offset_ - >> rC.rotation_; - - is.check("Istream& operator>>(Istream& f, ReferredCell<ParticleType>& rC"); - - return is; -} - - -template<class ParticleType> -Foam::Ostream& Foam::operator<< -( - Ostream& os, - const ReferredCell<ParticleType>& rC -) -{ - - os << rC.sourceProc() - << token::SPACE << rC.sourceCell() - << token::SPACE << rC.points() - << token::SPACE << rC.edges() - << token::SPACE << rC.faces() - << token::SPACE << rC.wallFaces() - << token::SPACE << rC.faceCentres() - << token::SPACE << rC.faceAreas() - << token::SPACE << rC.offset() - << token::SPACE << rC.rotation(); - - os.check - ( - "Ostream& operator<<(Ostream& f, const ReferredCell<ParticleType>& rC" - ); - - return os; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/basic/InteractionLists/ReferredCellList/ReferredCell/ReferredCell.H b/src/lagrangian/basic/InteractionLists/ReferredCellList/ReferredCell/ReferredCell.H deleted file mode 100644 index 368f790e6a5e5b4e7feb3b364927f081f481d4b3..0000000000000000000000000000000000000000 --- a/src/lagrangian/basic/InteractionLists/ReferredCellList/ReferredCell/ReferredCell.H +++ /dev/null @@ -1,339 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Class - Foam::ReferredCell - -Description - -SourceFiles - ReferredCellI.H - ReferredCell.C - -\*---------------------------------------------------------------------------*/ - -#ifndef ReferredCell_H -#define ReferredCell_H - -#include "vector.H" -#include "tensor.H" -#include "transform.H" -#include "IDLList.H" -#include "labelList.H" -#include "edgeList.H" -#include "polyMesh.H" -#include "faceList.H" - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// Forward declaration of friend functions and operators - -template<class ParticleType> -class ReferredCell; - -template<class ParticleType> -bool operator== -( - const ReferredCell<ParticleType>& a, - const ReferredCell<ParticleType>& b -); - -template<class ParticleType> -bool operator!= -( - const ReferredCell<ParticleType>& a, - const ReferredCell<ParticleType>& b -); - -template<class ParticleType> -Istream& operator>> -( - Istream&, - ReferredCell<ParticleType>& -); - -template<class ParticleType> -Ostream& operator<< -( - Ostream&, - const ReferredCell<ParticleType>& -); - - -/*---------------------------------------------------------------------------*\ - Class ReferredCell Declaration -\*---------------------------------------------------------------------------*/ - -template<class ParticleType> -class ReferredCell -: - public IDLList<ParticleType> -{ - // Private data - - //- The source processor of this referred cell - label sourceProc_; - - //- The cell on the source processor that this cell is referring - label sourceCell_; - - //- Referred cell vertex positions - pointField vertexPositions_; - - //- The edge structure of this referred cell, indices of the - // vertexPositions_ list - edgeList edges_; - - //- The face structure of this referred cell, indices of the - // vertexPositions_ list - faceList faces_; - - // Which of the faces represent wall faces on their source processor - labelList wallFaces_; - - //- The face centre data for the cell in the referred position - pointField faceCentres_; - - //- The face area data for the cell in the referred position - vectorField faceAreas_; - - //- Which cells on the processor hosting this referred cell - // require interactions from it - labelList realCellsForInteraction_; - - //- Vector (shift) part of the transformation from the original cell - vector offset_; - - //- Tensor (rotate) part of the transformation from the original cell - tensor rotation_; - - - // Private Member Functions - - void setConstructionData - ( - const polyMesh& mesh, - const label sourceCell - ); - - void locallyMapEdgeList - ( - const labelList& points, - const edgeList& sourceCellEdges - ); - - void locallyMapFaceList - ( - const labelList& points, - const labelListList& sourceCellFaces - ); - - vector referPosition(const vector& positionToRefer); - - pointField referPositions(const pointField& positionsToRefer); - - vector rotateVector(const vector& vectorToRotate); - - vectorField rotateVectors(const vectorField& vectorsToRotate); - - -public: - - // Constructors - - //- Construct null - - ReferredCell(); - - //- Construct from components with external edge information - ReferredCell - ( - const polyMesh& mesh, - const label sourceProc, - const label sourceCell, - const vector& offset, - const tensor& rotation - ); - - //- Construct from components with existing local edge information - ReferredCell - ( - const label sourceProc, - const label sourceCell, - const pointField& vertexPositions, - const edgeList& localEdges, - const faceList& localFaces, - const labelList& wallFaces, - const pointField& faceCentres, - const vectorField& faceAreas, - const vector& offset, - const tensor& rotation - ); - - //- Construct from pair of face centers (c) and plain - // face normals (n) (no need to make unit vectors or - // reverse one direction) - // Order of vectors important (S = source, D = Destination). - // External edge information. - ReferredCell - ( - const polyMesh& mesh, - const label sourceProc, - const label sourceCell, - const vector& cS, - const vector& cD, - const vector& nS, - const vector& nD - ); - - - // Destructor - - virtual ~ReferredCell(); - - - // Member Functions - - //- Take this ReferredCell object that has already had it's transform - // calculated and refer it on again, retaining same source info. - ReferredCell reRefer - ( - const vector& cS, - const vector& cD, - const vector& nS, - const vector& nD - ); - - //- Use internal transformatation values to transform the given - // postion to its new location. - vector referPosition(const vector& positionToRefer) const; - - //- Use internal transformatation values to transform the given - // list of postions to their new locations. - pointField referPosition(const pointField& positionsToRefer) const; - - //- Use internal transformatation values to rotate the given vector - vector rotateVector(const vector& vectorToRotate) const; - - //- Use internal transformatation values to rotate the given - // list of vectors - vectorField rotateVectors(const vectorField& vectorsToRotate) const; - - //- referInParticle takes a referred particle from a source - // processor, transforming its position and properties - void referInParticle(ParticleType* incomingParticlePtr); - - //- duplicate() function to test whether a referred or real cell - // supplied by arguement is a duplicate of this ReferredCell. - // Can be used bi-directionally - i.e. can be called on an existing - // referred cell with a proposed ReferredCell as argument, - // or vice versa. Can only be called by a proposed ReferredCell with - // a real cell index as arguement to test to see if the proposed - // ReferredCell is a duplicate. - // A duplicate cell is defined as one which has the same source - // processor, source cell, and an equal offset. Real cells have zero - // offset by definition. - bool duplicate(const ReferredCell& refCellDupl) const; - - bool duplicate(const label procNo, const label nCells) const; - - - // Access - - inline label sourceProc() const; - - inline label sourceCell() const; - - inline const vector& offset() const; - - inline const tensor& rotation() const; - - inline const pointField& points() const; - - inline const edgeList& edges() const; - - inline const faceList& faces() const; - - inline const labelList& wallFaces() const; - - inline const pointField& faceCentres() const; - - inline const vectorField& faceAreas() const; - - inline labelList& realCells(); - - inline const labelList& realCellsForInteraction() const; - - - // Friend Operators - - friend bool operator== <ParticleType> - ( - const ReferredCell<ParticleType>& a, - const ReferredCell<ParticleType>& b - ); - - friend bool operator!= <ParticleType> - ( - const ReferredCell<ParticleType>& a, - const ReferredCell<ParticleType>& b - ); - - friend Istream& operator>> <ParticleType> - ( - Istream&, - ReferredCell<ParticleType>& - ); - - friend Ostream& operator<< <ParticleType> - ( - Ostream&, - const ReferredCell<ParticleType>& - ); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "ReferredCellI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "ReferredCell.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/basic/InteractionLists/ReferredCellList/ReferredCell/ReferredCellI.H b/src/lagrangian/basic/InteractionLists/ReferredCellList/ReferredCell/ReferredCellI.H deleted file mode 100644 index 50d07d89e6972ab1fdeaee19f80a85ed25841fc5..0000000000000000000000000000000000000000 --- a/src/lagrangian/basic/InteractionLists/ReferredCellList/ReferredCell/ReferredCellI.H +++ /dev/null @@ -1,119 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<class ParticleType> -inline Foam::label Foam::ReferredCell<ParticleType>::sourceProc() const -{ - return sourceProc_; -} - - -template<class ParticleType> -inline Foam::label Foam::ReferredCell<ParticleType>::sourceCell() const -{ - return sourceCell_; -} - - -template<class ParticleType> -inline const Foam::vector& Foam::ReferredCell<ParticleType>::offset() const -{ - return offset_; -} - - -template<class ParticleType> -inline const Foam::tensor& Foam::ReferredCell<ParticleType>::rotation() const -{ - return rotation_; -} - - -template<class ParticleType> -inline const Foam::pointField& -Foam::ReferredCell<ParticleType>::points() const -{ - return vertexPositions_; -} - - -template<class ParticleType> -inline const Foam::edgeList& Foam::ReferredCell<ParticleType>::edges() const -{ - return edges_; -} - - -template<class ParticleType> -inline const Foam::faceList& -Foam::ReferredCell<ParticleType>::faces() const -{ - return faces_; -} - - -template<class ParticleType> -inline const Foam::labelList& -Foam::ReferredCell<ParticleType>::wallFaces() const -{ - return wallFaces_; -} - - -template<class ParticleType> -inline const Foam::pointField& -Foam::ReferredCell<ParticleType>::faceCentres() const -{ - return faceCentres_; -} - - -template<class ParticleType> -inline const Foam::vectorField& -Foam::ReferredCell<ParticleType>::faceAreas() const -{ - return faceAreas_; -} - - -template<class ParticleType> -inline Foam::labelList& Foam::ReferredCell<ParticleType>::realCells() -{ - return realCellsForInteraction_; -} - - -template<class ParticleType> -inline const Foam::labelList& -Foam::ReferredCell<ParticleType>::realCellsForInteraction() const -{ - return realCellsForInteraction_; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/basic/InteractionLists/ReferredCellList/ReferredCellList.C b/src/lagrangian/basic/InteractionLists/ReferredCellList/ReferredCellList.C deleted file mode 100644 index 735b1f68389fab0b029e6ce4a7191f1121c00791..0000000000000000000000000000000000000000 --- a/src/lagrangian/basic/InteractionLists/ReferredCellList/ReferredCellList.C +++ /dev/null @@ -1,1858 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*----------------------------------------------------------------------------*/ - -#include "ReferredCellList.H" -#include "InteractionLists.H" -#include "polyBoundaryMeshEntries.H" -#include "PstreamCombineReduceOps.H" -#include "Time.H" -#include "globalMeshData.H" -#include "processorPolyPatch.H" -#include "cyclicPolyPatch.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template<class ParticleType> -void Foam::ReferredCellList<ParticleType>::buildReferredCellList -( - bool pointPointListBuild -) -{ - Info<< " Building list of referred interaction neighbours" << endl; - - const polyMesh& mesh(il_.mesh()); - - DynamicList<ReferredCell<ParticleType> > referredInteractionList; - - // realCellsWithinRangeOfAnyReferringPatch - DynamicList<label> rCellsWRRP; - - // realFacesWithinRangeOfAnyReferringPatch - DynamicList<label> rFacesWRRP; - - // realEdgesWithinRangeOfAnyReferringPatch - DynamicList<label> rEdgesWRRP; - - // realPointsWithinRangeOfAnyReferringPatch - DynamicList<label> rPointsWRRP; - - labelListList processorPatchSegmentMapping - ( - mesh.globalData().processorPatches().size() - ); - - List<pointField> allNeighbourFaceCentres - ( - mesh.globalData().processorPatches().size() - ); - - List<vectorField> allNeighbourFaceAreas - ( - mesh.globalData().processorPatches().size() - ); - - label nUndecomposedPatches = 0; - - if (Pstream::parRun()) - { - dictionary patchDictionary; - - DynamicList<word> patchNames; - - Time undecomposedTime - ( - Time::controlDictName, - mesh.time().rootPath(), - mesh.time().caseName().path() - ); - - IOobject undecomposedBoundaryHeader - ( - "boundary", - undecomposedTime.constant(), - polyMesh::meshSubDir, - undecomposedTime, - IOobject::MUST_READ, - IOobject::NO_WRITE, - false - ); - - if (undecomposedBoundaryHeader.headerOk()) - { - polyBoundaryMeshEntries undecomposedPatchEntries - ( - undecomposedBoundaryHeader - ); - - forAll(undecomposedPatchEntries, patchi) - { - patchNames.append - ( - undecomposedPatchEntries[patchi].keyword() - ); - - patchDictionary.add - ( - undecomposedPatchEntries[patchi] - ); - } - } - else - { - FatalErrorIn ("ReferredCellList.C") - << nl << "unable to read undecomposed boundary file from " - << "constant/polyMesh" << nl - << abort(FatalError); - } - - labelIOList faceProcAddressing - ( - IOobject - ( - "faceProcAddressing", - mesh.time().constant(), - polyMesh::meshSubDir, - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE, - false - ) - ); - - labelList procPatches(mesh.globalData().processorPatches()); - - nUndecomposedPatches = patchNames.size(); - - // processorPatchSegmentMapping works by mapping the original patch and - // half that a face on a processor patch was on before decomposition. - // This creates a patch segment for each half of each original (cyclic) - // patch which can be assessed separately. There are n = - // patchNames.size() original patches, k = 0 to n-1. The mapping is: - // value = 0: originally an internal face value = k, was originally on - // the on the patch k-1, 1st half value = -k, was originally on the on - // the patch k-1, 2nd half - - forAll(procPatches,pP) - { - const processorPolyPatch& patch = refCast<const processorPolyPatch> - ( - mesh.boundaryMesh()[procPatches[pP]] - ); - - labelList& procPatchSegMap = processorPatchSegmentMapping[pP]; - - procPatchSegMap.setSize(patch.size()); - - forAll (patch, pI) - { - label decomposedMeshFace = patch.start() + pI; - - label faceProcAdd = faceProcAddressing[decomposedMeshFace]; - - label globalFace = abs(faceProcAdd)-1; - - label minStart = -1; - - forAll(patchNames, pN) - { - if (patchDictionary.found(patchNames[pN])) - { - const dictionary& patchDict = - patchDictionary.subDict(patchNames[pN]); - - label startFace - ( - readLabel - ( - patchDict.lookup("startFace") - ) - ); - - label nFaces(readLabel(patchDict.lookup("nFaces"))); - - if (minStart < 0 || startFace < minStart) - { - minStart = startFace; - } - - if - ( - globalFace >= startFace - && globalFace < startFace + nFaces/2 - ) - { - procPatchSegMap[pI] = pN + 1; - } - else if - ( - globalFace >= startFace + nFaces/2 - && globalFace < startFace + nFaces - ) - { - procPatchSegMap[pI] = -(pN + 1); - } - } - } - - if (globalFace < minStart) - { - procPatchSegMap[pI] = 0; - } - } - } - - forAll(procPatches,pP) - { - const processorPolyPatch& patch = refCast<const processorPolyPatch> - ( - mesh.boundaryMesh()[procPatches[pP]] - ); - - { - OPstream toNeighbProc - ( - Pstream::blocking, - patch.neighbProcNo() - ); - - toNeighbProc << patch.faceCentres() << patch.faceAreas(); - } - } - - forAll(procPatches,pP) - { - const processorPolyPatch& patch = refCast<const processorPolyPatch> - ( - mesh.boundaryMesh()[procPatches[pP]] - ); - - pointField& neighbFaceCentres = allNeighbourFaceCentres[pP]; - - neighbFaceCentres.setSize(patch.size()); - - vectorField& neighbFaceAreas = allNeighbourFaceAreas[pP]; - - neighbFaceAreas.setSize(patch.size()); - - { - IPstream fromNeighbProc - ( - Pstream::blocking, - patch.neighbProcNo() - ); - - fromNeighbProc >> neighbFaceCentres >> neighbFaceAreas; - } - } - - // ************************************************************* - // Tests that all processor patch segments from different - // original patches prior to decomposition produce the same - // transform. Check before 1st iteration. - // ************************************************************* - - forAll(procPatches,pP) - { - const processorPolyPatch& patch = refCast<const processorPolyPatch> - ( - mesh.boundaryMesh()[procPatches[pP]] - ); - - const pointField& neighbFaceCentres = allNeighbourFaceCentres[pP]; - - const vectorField& neighbFaceAreas = allNeighbourFaceAreas[pP]; - - label nUP; - - for - ( - nUP = -nUndecomposedPatches; - nUP <= nUndecomposedPatches; - nUP++ - ) - { - DynamicList<vector> refOff; - - DynamicList<tensor> refTrans; - - forAll (patch, faceI) - { - if (processorPatchSegmentMapping[pP][faceI] == nUP) - { - ReferredCell<ParticleType> testRefCell - ( - mesh, - -1, - -1, - patch.faceCentres()[faceI], - neighbFaceCentres[faceI], - patch.faceNormals()[faceI], - neighbFaceAreas[faceI] - /(mag(neighbFaceAreas[faceI]) + VSMALL) - ); - - refOff.append(testRefCell.offset()); - - refTrans.append(testRefCell.rotation()); - } - } - - refOff.shrink(); - - refTrans.shrink(); - - if (refOff.size()) - { - if - ( - sum(mag(refOff-refOff[0]))/refOff.size() - > InteractionLists<ParticleType>::transTol - || sum(mag(refTrans-refTrans[0]))/refTrans.size() - > InteractionLists<ParticleType>::transTol - ) - { - FatalErrorIn ("ReferredCellList.C") - << nl << "Face pairs on patch " - << patch.name() - << ", segment " << patchNames[nUP] - << " do not give the same referring " - << " transformations to within tolerance of " - << InteractionLists<ParticleType>::transTol << nl - << " Referring offsets:" << refOff << nl - << " Average sum of mag difference: " - << sum(mag(refOff-refOff[0]))/refOff.size() << nl - << " Referring transforms:" << refTrans << nl - << " Average sum of mag difference: " - << sum(mag(refTrans-refTrans[0]))/refTrans.size() - << nl << abort(FatalError); - } - } - } - } - } - - label cellsReferredThisIteration = 1; - - label iterationNo = 0; - - while (cellsReferredThisIteration > 0) - { - label refIntListStartSize = referredInteractionList.size(); - - forAll (mesh.boundaryMesh(), patchI) - { - // Treat local cyclics on each processor before processor - // boundaries. Separate treatment allows the serial version to run - // transparently. - - if (isA<cyclicPolyPatch>(mesh.boundaryMesh()[patchI])) - { - const cyclicPolyPatch& patch = refCast<const cyclicPolyPatch> - ( - mesh.boundaryMesh()[patchI] - ); - - if (patch.size()) - { - if (iterationNo == 0) - { - // Tests that all combinations of face pairs produce the - // same transform. Only check on 1st iteration. - - label faceL; - // A face in the 1st half of the patch - - label faceM; - // Face corresponding to faceL in the 2nd half of the - // patch. Assumes correct face ordering. - - vectorField refOff(patch.size()/2); - - List<tensor> refTrans(patch.size()/2); - - for - ( - faceL = 0, faceM = patch.size()/2; - faceL < patch.size()/2; - faceL++, faceM++ - ) - { - ReferredCell<ParticleType> testRefCell - ( - mesh, - -1, - -1, - patch.faceCentres()[faceL], - patch.faceCentres()[faceM], - patch.faceNormals()[faceL], - patch.faceNormals()[faceM] - ); - - refOff[faceL] = testRefCell.offset(); - - refTrans[faceL] = testRefCell.rotation(); - } - - if - ( - sum(mag(refOff - refOff[0]))/(patch.size()/2) - > InteractionLists<ParticleType>::transTol - || sum(mag(refTrans - refTrans[0]))/(patch.size()/2) - > InteractionLists<ParticleType>::transTol - ) - { - FatalErrorIn ("ReferredCellList.C") - << nl << "Face pairs on patch " - << patch.name() - << " do not give the same referring " - << " transformations to within tolerance of " - << InteractionLists<ParticleType>::transTol - << nl << " Referring offsets:" << refOff << nl - << " Average sum of mag difference: " - << sum(mag(refOff - refOff[0]))/refOff.size() - << nl - << " Referring transforms:" << refTrans << nl - << " Average sum of mag difference: " - << sum(mag(refTrans - refTrans[0])) - /refTrans.size() - << nl << abort(FatalError); - } - } - - // ********************************************************* - // 1st half of face list - 1st side of boundary - // ********************************************************* - - label faceI; - - DynamicList<label> meshFacesOnThisSegment; - - for (faceI = 0; faceI < patch.size()/2; faceI++) - { - // unable to use the normal accessors for the polyPatch - // because points on separate halves need used - // separately - - meshFacesOnThisSegment.append(faceI + patch.start()); - } - - meshFacesOnThisSegment.shrink(); - - DynamicList<label> meshEdgesOnThisSegment; - - DynamicList<label> meshPointsOnThisSegment; - - forAll(meshFacesOnThisSegment, mFOTS) - { - const label segFace = meshFacesOnThisSegment[mFOTS]; - - const labelList& faceEdges = mesh.faceEdges()[segFace]; - - forAll (faceEdges, fE) - { - const label faceEdge(faceEdges[fE]); - - if - ( - findIndex - ( - meshEdgesOnThisSegment, - faceEdge - ) == -1 - ) - { - meshEdgesOnThisSegment.append(faceEdge); - } - } - - const face& facePoints(mesh.faces()[segFace]); - - forAll (facePoints, fP) - { - const label facePoint(facePoints[fP]); - - if - ( - findIndex - ( - meshPointsOnThisSegment, - facePoint - ) - == - -1 - ) - { - meshPointsOnThisSegment.append(facePoint); - } - } - } - - meshEdgesOnThisSegment.shrink(); - - meshPointsOnThisSegment.shrink(); - - if (iterationNo == 0) - { - // Assessing real cells in range is only required on - // the 1st iteration because they do not change from - // iteration to iteration. - - labelList realCellsFoundInRange - ( - il_.realCellsInRangeOfSegment - ( - meshFacesOnThisSegment, - meshEdgesOnThisSegment, - meshPointsOnThisSegment - ) - ); - - forAll(realCellsFoundInRange,cFIR) - { - const label realCell = realCellsFoundInRange[cFIR]; - - ReferredCell<ParticleType> cellToRefer - ( - mesh, - Pstream::myProcNo(), - realCell, - patch.faceCentres()[0], - patch.faceCentres()[patch.size()/2], - patch.faceNormals()[0], - patch.faceNormals()[patch.size()/2] - ); - - // Test all existing referred and real cells to - // check duplicates are not being made or cells - // aren't being referred back onto themselves - - bool addCellToRefer = true; - - // Check if cellToRefer is an existing referred cell - - forAll(referredInteractionList, rIL) - { - if - ( - cellToRefer.duplicate - ( - referredInteractionList[rIL] - ) - ) - { - addCellToRefer = false; - - break; - } - } - - // Check for cellToRefer being referred back - // ontop of a real cell - - if - ( - cellToRefer.duplicate - ( - Pstream::myProcNo(), - mesh.nCells() - ) - ) - { - addCellToRefer = false; - } - - if (addCellToRefer) - { - referredInteractionList.append(cellToRefer); - } - - // add real cells found in range of cyclic patch - // to whole mesh list - - if (findIndex (rCellsWRRP, realCell) == -1) - { - rCellsWRRP.append(realCell); - } - } - } - - referredInteractionList.shrink(); - - labelList ReferredCellsFoundInRange - ( - il_.ReferredCellsInRangeOfSegment - ( - referredInteractionList, - meshFacesOnThisSegment, - meshEdgesOnThisSegment, - meshPointsOnThisSegment - ) - ); - - forAll(ReferredCellsFoundInRange,cFIR) - { - ReferredCell<ParticleType>& existingRefCell = - referredInteractionList - [ - ReferredCellsFoundInRange[cFIR] - ]; - - ReferredCell<ParticleType> cellToReRefer = - existingRefCell.reRefer - ( - patch.faceCentres()[0], - patch.faceCentres()[patch.size()/2], - patch.faceNormals()[0], - patch.faceNormals()[patch.size()/2] - ); - - // Test all existing referred and real cells to check - // duplicates are not being made or cells aren't being - // referred back onto themselves - - bool addCellToReRefer = true; - - // Check if cellToRefer is an existing referred cell - - forAll(referredInteractionList, rIL) - { - if - ( - cellToReRefer.duplicate - ( - referredInteractionList[rIL] - ) - ) - { - addCellToReRefer = false; - - break; - } - } - - // Check for cellToRefer being referred back - // ontop of a real cell - - if - ( - cellToReRefer.duplicate - ( - Pstream::myProcNo(), - mesh.nCells() - ) - ) - { - addCellToReRefer = false; - } - - if (addCellToReRefer) - { - referredInteractionList.append(cellToReRefer); - } - } - - // ********************************************************* - // 2nd half of face list - 2nd side of boundary - // ********************************************************* - - meshFacesOnThisSegment.clear(); - - for (faceI = patch.size()/2; faceI < patch.size(); faceI++) - { - // unable to use the normal accessors for the polyPatch - // because points on separate halves need used - // separately - - meshFacesOnThisSegment.append(faceI + patch.start()); - } - - meshFacesOnThisSegment.shrink(); - - meshEdgesOnThisSegment.clear(); - - meshPointsOnThisSegment.clear(); - - forAll(meshFacesOnThisSegment, mFOTS) - { - const label segFace = meshFacesOnThisSegment[mFOTS]; - - const labelList& faceEdges = mesh.faceEdges()[segFace]; - - forAll (faceEdges, fE) - { - const label faceEdge(faceEdges[fE]); - - if - ( - findIndex - ( - meshEdgesOnThisSegment, - faceEdge - ) - == - -1 - ) - { - meshEdgesOnThisSegment.append(faceEdge); - } - } - - const face& facePoints(mesh.faces()[segFace]); - - forAll (facePoints, fP) - { - const label facePoint(facePoints[fP]); - - if - ( - findIndex - ( - meshPointsOnThisSegment, - facePoint - ) - == - -1 - ) - { - meshPointsOnThisSegment.append(facePoint); - } - } - } - - meshEdgesOnThisSegment.shrink(); - - meshPointsOnThisSegment.shrink(); - - if (iterationNo == 0) - { - // Assessing real cells in range is only required on - // the 1st iteration because they do not change from - // iteration to iteration. - - labelList realCellsFoundInRange - ( - il_.realCellsInRangeOfSegment - ( - meshFacesOnThisSegment, - meshEdgesOnThisSegment, - meshPointsOnThisSegment - ) - ); - - forAll(realCellsFoundInRange,cFIR) - { - const label realCell = realCellsFoundInRange[cFIR]; - - ReferredCell<ParticleType> cellToRefer - ( - mesh, - Pstream::myProcNo(), - realCell, - patch.faceCentres()[patch.size()/2], - patch.faceCentres()[0], - patch.faceNormals()[patch.size()/2], - patch.faceNormals()[0] - ); - - // Test all existing referred and real cells to - // check duplicates are not being made or cells - // aren't being referred back onto themselves - - bool addCellToRefer = true; - - // Check if cellToRefer is an existing referred cell - - forAll(referredInteractionList, rIL) - { - if - ( - cellToRefer.duplicate - ( - referredInteractionList[rIL] - ) - ) - { - addCellToRefer = false; - - break; - } - } - - // Check for cellToRefer being referred back - // ontop of a real cell - - if - ( - cellToRefer.duplicate - ( - Pstream::myProcNo(), - mesh.nCells() - ) - ) - { - addCellToRefer = false; - } - - if (addCellToRefer) - { - referredInteractionList.append(cellToRefer); - } - - // add real cells found in range of cyclic patch - // to whole mesh list - - if (findIndex (rCellsWRRP, realCell) == -1) - { - rCellsWRRP.append(realCell); - } - } - } - - referredInteractionList.shrink(); - - ReferredCellsFoundInRange = - il_.ReferredCellsInRangeOfSegment - ( - referredInteractionList, - meshFacesOnThisSegment, - meshEdgesOnThisSegment, - meshPointsOnThisSegment - ); - - forAll(ReferredCellsFoundInRange,cFIR) - { - ReferredCell<ParticleType>& existingRefCell = - referredInteractionList - [ - ReferredCellsFoundInRange[cFIR] - ]; - - ReferredCell<ParticleType> cellToReRefer = - existingRefCell.reRefer - ( - patch.faceCentres()[patch.size()/2], - patch.faceCentres()[0], - patch.faceNormals()[patch.size()/2], - patch.faceNormals()[0] - ); - - // Test all existing referred and real cells to check - // duplicates are not being made or cells aren't being - // referred back onto themselves - - bool addCellToReRefer = true; - - // Check if cellToRefer is an existing referred cell - - forAll(referredInteractionList, rIL) - { - if - ( - cellToReRefer.duplicate - ( - referredInteractionList[rIL] - ) - ) - { - addCellToReRefer = false; - - break; - } - } - - // Check for cellToRefer being referred back - // ontop of a real cell - - if - ( - cellToReRefer.duplicate - ( - Pstream::myProcNo(), - mesh.nCells() - ) - ) - { - addCellToReRefer = false; - } - - if (addCellToReRefer) - { - referredInteractionList.append(cellToReRefer); - } - } - } - } - } - - if (Pstream::parRun()) - { - labelList procPatches(mesh.globalData().processorPatches()); - - forAll(procPatches,pP) - { - const processorPolyPatch& patch = - refCast<const processorPolyPatch> - ( - mesh.boundaryMesh()[procPatches[pP]] - ); - - DynamicList<ReferredCell<ParticleType> > - ReferredCellsToTransfer; - - const pointField& neighbFaceCentres = - allNeighbourFaceCentres[pP]; - - const vectorField& neighbFaceAreas = allNeighbourFaceAreas[pP]; - - label nUP; - - for - ( - nUP = -nUndecomposedPatches; - nUP <= nUndecomposedPatches; - nUP++ - ) - { - // faceT is used to specify one face on this patch segment - // that will be used to calculate the transformation values. - // All faces are guaranteed to produce the same transform - // because of the checks carried out at the start of the - // function. Setting to -1 until the 1st face on this - // segment is found. - - label faceT = -1; - - DynamicList<label> meshFacesOnThisSegment; - - forAll (patch, faceI) - { - if (processorPatchSegmentMapping[pP][faceI] == nUP) - { - if (faceT == -1) - { - faceT = faceI; - } - - meshFacesOnThisSegment.append - ( - faceI + patch.start() - ); - } - } - - meshFacesOnThisSegment.shrink(); - - DynamicList<label> meshEdgesOnThisSegment; - - DynamicList<label> meshPointsOnThisSegment; - - forAll(meshFacesOnThisSegment, mFOTS) - { - const label segFace = meshFacesOnThisSegment[mFOTS]; - - const labelList& faceEdges = mesh.faceEdges()[segFace]; - - forAll (faceEdges, fE) - { - const label faceEdge(faceEdges[fE]); - - if - ( - findIndex - ( - meshEdgesOnThisSegment, - faceEdge - ) - == - -1 - ) - { - meshEdgesOnThisSegment.append(faceEdge); - } - } - - const face& facePoints(mesh.faces()[segFace]); - - forAll (facePoints, fP) - { - const label facePoint(facePoints[fP]); - - if - ( - findIndex - ( - meshPointsOnThisSegment, - facePoint - ) - == - -1 - ) - { - meshPointsOnThisSegment.append(facePoint); - } - } - } - - meshEdgesOnThisSegment.shrink(); - - meshPointsOnThisSegment.shrink(); - - if (meshFacesOnThisSegment.size()) - { - if (faceT == -1) - { - FatalErrorIn ("ReferredCellList.C") - << nl << "faceT == -1 encountered but " - << meshFacesOnThisSegment.size() - << " faces found on patch segment." - << abort(FatalError); - } - - if (iterationNo == 0) - { - // Assessing real cells in range is only required on - // the 1st iteration because they do not change from - // iteration to iteration. - - labelList realCellsFoundInRange - ( - il_.realCellsInRangeOfSegment - ( - meshFacesOnThisSegment, - meshEdgesOnThisSegment, - meshPointsOnThisSegment - ) - ); - - forAll(realCellsFoundInRange,cFIR) - { - const label realCell = - realCellsFoundInRange[cFIR]; - - ReferredCell<ParticleType> cellToRefer - ( - mesh, - Pstream::myProcNo(), - realCell, - patch.faceCentres()[faceT], - neighbFaceCentres[faceT], - patch.faceNormals()[faceT], - neighbFaceAreas[faceT] - /(mag(neighbFaceAreas[faceT]) + VSMALL) - ); - - ReferredCellsToTransfer.append(cellToRefer); - - // add real cells found in range of processor - // patch to whole mesh list - - if (findIndex (rCellsWRRP, realCell) == -1) - { - rCellsWRRP.append(realCell); - } - } - } - - referredInteractionList.shrink(); - - labelList ReferredCellsFoundInRange - ( - il_.ReferredCellsInRangeOfSegment - ( - referredInteractionList, - meshFacesOnThisSegment, - meshEdgesOnThisSegment, - meshPointsOnThisSegment - ) - ); - - forAll(ReferredCellsFoundInRange,cFIR) - { - ReferredCell<ParticleType>& existingRefCell = - referredInteractionList - [ - ReferredCellsFoundInRange[cFIR] - ]; - - ReferredCell<ParticleType> cellToReRefer = - existingRefCell.reRefer - ( - patch.faceCentres()[faceT], - neighbFaceCentres[faceT], - patch.faceNormals()[faceT], - neighbFaceAreas[faceT] - /(mag(neighbFaceAreas[faceT]) + VSMALL) - ); - - ReferredCellsToTransfer.append(cellToReRefer); - } - } - } - - ReferredCellsToTransfer.shrink(); - - // Send these cells to the neighbouring processor. - - { - OPstream toNeighbProc - ( - Pstream::blocking, - patch.neighbProcNo() - ); - - toNeighbProc << ReferredCellsToTransfer; - } - } - - forAll(procPatches,pP) - { - const processorPolyPatch& patch = - refCast<const processorPolyPatch> - ( - mesh.boundaryMesh()[procPatches[pP]] - ); - - // Receive the cells from neighbour - - List<ReferredCell<ParticleType> > - ReferredCellsFromNeighbour(patch.size()); - - { - IPstream fromNeighbProc - ( - Pstream::blocking, - patch.neighbProcNo() - ); - - fromNeighbProc >> ReferredCellsFromNeighbour; - } - - // Check to see if they are duplicates, if not append - // them to the referredInteractionList - - forAll(ReferredCellsFromNeighbour,rCFN) - { - ReferredCell<ParticleType>& cellToRefer = - ReferredCellsFromNeighbour[rCFN]; - - // Test all existing referred and real cells to check - // duplicates are not being made or cells aren't being - // referred back onto themselves - - bool addCellToRefer = true; - - // Check if cellToRefer is an existing referred cell - - forAll(referredInteractionList, rIL) - { - if (cellToRefer.duplicate(referredInteractionList[rIL])) - { - addCellToRefer = false; - - break; - } - } - - // Check for cellToRefer being referred back ontop of a real - // cell - - if - ( - cellToRefer.duplicate - ( - Pstream::myProcNo(), - mesh.nCells() - ) - ) - { - addCellToRefer = false; - } - - if (addCellToRefer) - { - referredInteractionList.append(cellToRefer); - } - } - } - } - - if (iterationNo == 0) - { - // record all real cells in range of any referring patch (cyclic or - // processor) on the first iteration when the real cells are - // evaluated. - - rCellsWRRP.shrink(); - - // construct {faces, edges, points}WithinRangeOfAnyReferringPatch - - forAll(rCellsWRRP, rCWR) - { - const label realCell(rCellsWRRP[rCWR]); - - const labelList& rCFaces - ( - mesh.cells()[realCell] - ); - - forAll(rCFaces, rCF) - { - const label f(rCFaces[rCF]); - - if (findIndex(rFacesWRRP,f) == -1) - { - rFacesWRRP.append(f); - } - } - - const labelList& rCEdges - ( - mesh.cellEdges()[realCell] - ); - - forAll(rCEdges, rCE) - { - const label e(rCEdges[rCE]); - - if (findIndex(rEdgesWRRP,e) == -1) - { - rEdgesWRRP.append(e); - } - } - - const labelList& rCPoints - ( - mesh.cellPoints()[realCell] - ); - - forAll(rCPoints, rCP) - { - const label p(rCPoints[rCP]); - - if (findIndex(rPointsWRRP,p) == -1) - { - rPointsWRRP.append(p); - } - } - } - - rFacesWRRP.shrink(); - - rEdgesWRRP.shrink(); - - rPointsWRRP.shrink(); - } - - iterationNo++; - - cellsReferredThisIteration = - referredInteractionList.size() - refIntListStartSize; - - reduce(cellsReferredThisIteration, sumOp<label>()); - - Info<< " Cells added this iteration: " - << cellsReferredThisIteration << endl; - } - - referredInteractionList.shrink(); - - (*this).setSize - ( - referredInteractionList.size() - ); - - forAll(referredInteractionList, rIL) - { - (*this)[rIL] = referredInteractionList[rIL]; - } - - Info<< " Finding real cells in range of referred cells" << endl; - - forAll(*this, rC) - { - const polyMesh& mesh(il_.mesh()); - - ReferredCell<ParticleType>& refCell = (*this)[rC]; - - DynamicList<label> realCellsFoundInRange; - - const pointField& refCellPoints = refCell.points(); - - forAll(rFacesWRRP, rCF) - { - const label f(rFacesWRRP[rCF]); - - if (il_.testPointFaceDistance(refCellPoints,f)) - { - const label cellO(mesh.faceOwner()[f]); - - if (findIndex(realCellsFoundInRange, cellO) == -1) - { - realCellsFoundInRange.append(cellO); - } - - if (mesh.isInternalFace(f)) - { - // boundary faces will not have neighbour information - - const label cellN(mesh.faceNeighbour()[f]); - - if (findIndex(realCellsFoundInRange, cellN) == -1) - { - realCellsFoundInRange.append(cellN); - } - } - } - } - - forAll(rPointsWRRP, rCP) - { - const label p(rPointsWRRP[rCP]); - - if (il_.testPointFaceDistance(p,refCell)) - { - const labelList& pCells(mesh.pointCells()[p]); - - forAll(pCells, pC) - { - const label cellI(pCells[pC]); - - if (findIndex(realCellsFoundInRange, cellI) == -1) - { - realCellsFoundInRange.append(cellI); - } - } - } - } - - - const edgeList& refCellEdges = refCell.edges(); - - forAll(rEdgesWRRP, rCE) - { - const label edgeIIndex(rEdgesWRRP[rCE]); - - const edge& eI(mesh.edges()[edgeIIndex]); - - forAll(refCellEdges, rCE) - { - const edge& eJ(refCellEdges[rCE]); - - if - ( - il_.testEdgeEdgeDistance - ( - eI, - refCellPoints[eJ.start()], - refCellPoints[eJ.end()] - ) - ) - { - const labelList& eICells(mesh.edgeCells()[edgeIIndex]); - - forAll(eICells, eIC) - { - const label cellI(eICells[eIC]); - - if (findIndex(realCellsFoundInRange, cellI) == -1) - { - realCellsFoundInRange.append(cellI); - } - } - } - } - } - - refCell.realCells() = realCellsFoundInRange.shrink(); - } -} - - -template<class ParticleType> -void Foam::ReferredCellList<ParticleType>::buildCellReferralLists() -{ - Info<< " Determining particle referring schedule" << endl; - - DynamicList<label> referralProcs; - - // Run through all ReferredCells to build list of interacting processors - - forAll(*this, refCellI) - { - const ReferredCell<ParticleType>& refCell((*this)[refCellI]); - - if (findIndex(referralProcs, refCell.sourceProc()) == -1) - { - referralProcs.append(refCell.sourceProc()); - } - } - - List<DynamicList<label> > cellSendingReferralLists(referralProcs.size()); - - List<DynamicList<DynamicList<label> > > - cellReceivingReferralLists(referralProcs.size()); - - // Run through all ReferredCells again building up send and receive info - - forAll(*this, refCellI) - { - const ReferredCell<ParticleType>& rC((*this)[refCellI]); - - label rPI = findIndex(referralProcs, rC.sourceProc()); - - DynamicList<DynamicList<label> >& rRL(cellReceivingReferralLists[rPI]); - - DynamicList<label>& sRL(cellSendingReferralLists[rPI]); - - label existingSource = findIndex(sRL, rC.sourceCell()); - - // Check to see if this source cell has already been allocated to - // come to this processor. If not, add the source cell to the sending - // list and add the current referred cell to the receiving list. - - // It shouldn't be possible for the sending and receiving lists to be - // different lengths, because their append operations happen at the - // same time. - - if (existingSource == -1) - { - sRL.append(rC.sourceCell()); - - rRL.append(DynamicList<label>(labelList(1, refCellI))); - } - else - { - rRL[existingSource].append(refCellI); - } - } - - // It is assumed that cell exchange is reciprocal, if proc A has cells to - // send to proc B, then proc B must have some to send to proc A. - - cellReceivingReferralLists_.setSize(referralProcs.size()); - - cellSendingReferralLists_.setSize(referralProcs.size()); - - forAll(referralProcs, rPI) - { - DynamicList<DynamicList<label> >& rRL(cellReceivingReferralLists[rPI]); - - labelListList translLL(rRL.size()); - - forAll(rRL, rRLI) - { - translLL[rRLI] = rRL[rRLI]; - } - - cellReceivingReferralLists_[rPI] = receivingReferralList - ( - referralProcs[rPI], - translLL - ); - } - - // Send sendingReferralLists to each interacting processor. - - forAll(referralProcs, rPI) - { - DynamicList<label>& sRL(cellSendingReferralLists[rPI]); - - if (referralProcs[rPI] != Pstream::myProcNo()) - { - if (Pstream::parRun()) - { - OPstream toInteractingProc - ( - Pstream::blocking, - referralProcs[rPI] - ); - - toInteractingProc << sendingReferralList - ( - Pstream::myProcNo(), - sRL - ); - } - } - } - - // Receive sendingReferralLists from each interacting processor. - - forAll(referralProcs, rPI) - { - if (referralProcs[rPI] != Pstream::myProcNo()) - { - if (Pstream::parRun()) - { - IPstream fromInteractingProc - ( - Pstream::blocking, - referralProcs[rPI] - ); - - fromInteractingProc >> cellSendingReferralLists_[rPI]; - } - } - else - { - cellSendingReferralLists_[rPI] = sendingReferralList - ( - Pstream::myProcNo(), - cellSendingReferralLists[rPI] - ); - } - } -} - - -template<class ParticleType> -void Foam::ReferredCellList<ParticleType>::storeParticles -( - const receivingReferralList& rRL, - const labelList& sourceReferredCell, - IDLList<ParticleType>& particlesToReferIn -) -{ - label particleI = 0; - - forAllIter - ( - typename IDLList<ParticleType>, - particlesToReferIn, - referInIter - ) - { - ParticleType& p = referInIter(); - - labelList refCellsToReferTo = - rRL[sourceReferredCell[particleI]]; - - forAll(refCellsToReferTo, refCellI) - { - ReferredCell<ParticleType>& refCellToRefParticlesTo = - (*this)[refCellsToReferTo[refCellI]]; - - refCellToRefParticlesTo.referInParticle - ( - p.clone().ptr() - ); - } - - particleI++; - } - - particlesToReferIn.clear(); -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template<class ParticleType> -Foam::ReferredCellList<ParticleType>::ReferredCellList -( - InteractionLists<ParticleType>& il, - bool pointPointListBuild -) -: - List<ReferredCell<ParticleType> >(), - il_(il), - cloud_(il_.mesh(), "referredParticleCloud", IDLList<ParticleType>()), - cellSendingReferralLists_(), - cellReceivingReferralLists_() -{ - buildReferredCellList(pointPointListBuild); - - buildCellReferralLists(); - - writeReferredCells(); -} - - -template<class ParticleType> -Foam::ReferredCellList<ParticleType>::ReferredCellList -( - InteractionLists<ParticleType>& il -) -: - List<ReferredCell<ParticleType> >(), - il_(il), - cloud_(il_.mesh(), IDLList<ParticleType>()) -{ - Info<< " Read ReferredCellList from disk not implemented" << endl; -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class ParticleType> -Foam::ReferredCellList<ParticleType>::~ReferredCellList() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<class ParticleType> -void Foam::ReferredCellList<ParticleType>::referParticles -( - const List<DynamicList<ParticleType*> >& cellOccupancy -) -{ - Info<< " Refer particles" << endl; - - // Clear all existing referred particles - - forAll(*this, i) - { - (*this)[i].clear(); - } - - // Create referred particles for sending using cell occupancy and - // cellSendingReferralLists - - forAll(cellSendingReferralLists_, cSRL) - { - const sendingReferralList& sRL - ( - cellSendingReferralLists_[cSRL] - ); - - IDLList<ParticleType> particlesToReferOut; - - DynamicList<label> destinationReferredCell; - - forAll(sRL, sRLI) - { - List<ParticleType*> realParticles = cellOccupancy[sRL[sRLI]]; - - forAll (realParticles, rM) - { - const ParticleType& particle = *realParticles[rM]; - - particlesToReferOut.append(particle.clone().ptr()); - - destinationReferredCell.append(sRLI); - } - } - - // Send lists of referred particles to other processors - - if (sRL.destinationProc() != Pstream::myProcNo()) - { - if (Pstream::parRun()) - { - OPstream toInteractingProc - ( - Pstream::blocking, - sRL.destinationProc() - ); - - toInteractingProc - << destinationReferredCell - << particlesToReferOut; - } - - // Remove particles after transfer - particlesToReferOut.clear(); - } - else - { - // Refer particles directly for referred cells on the same - // processor. - - const receivingReferralList& rRL - ( - cellReceivingReferralLists_[cSRL] - ); - - storeParticles(rRL, destinationReferredCell, particlesToReferOut); - } - - } - - // Receive referred particle lists to and distribute to ReferredCells - // according to cellReceivingReferralLists, ReferredCells deal with the - // transformations themselves - - forAll(cellReceivingReferralLists_, cRRL) - { - const receivingReferralList& rRL - ( - cellReceivingReferralLists_[cRRL] - ); - - IDLList<ParticleType> particlesToReferIn; - - labelList sourceReferredCell; - - if (rRL.sourceProc() != Pstream::myProcNo()) - { - if (Pstream::parRun()) - { - IPstream fromInteractingProc - ( - Pstream::blocking, - rRL.sourceProc() - ); - - fromInteractingProc - >> sourceReferredCell; - - particlesToReferIn = IDLList<ParticleType> - ( - fromInteractingProc, - typename ParticleType::iNew(cloud_) - ); - } - - storeParticles(rRL, sourceReferredCell, particlesToReferIn); - } - } - - bool writeCloud = false; - - if (il_.mesh().time().outputTime() && writeCloud) - { - cloud_.clear(); - - forAll(*this, refCellI) - { - ReferredCell<ParticleType>& refCell = (*this)[refCellI]; - - forAllIter - ( - typename IDLList<ParticleType>, - refCell, - iter - ) - { - cloud_.addParticle(iter().clone().ptr()); - } - } - - Particle<ParticleType>::writeFields(cloud_); - - cloud_.clear(); - } -} - - -template<class ParticleType> -void Foam::ReferredCellList<ParticleType>::writeReferredCells() const -{ - fileName fName = il_.mesh().time().path()/"referredCells.obj"; - - Info<< " Writing " << fName.name() << endl; - - OFstream referredCellsFile(fName); - - label vertexOffset = 1; - - forAll(*this, refCellI) - { - const ReferredCell<ParticleType>& refCell = (*this)[refCellI]; - - const pointField& refCellPts = refCell.points(); - - const faceList& refCellFaces = refCell.faces(); - - forAll(refCellPts, ptI) - { - referredCellsFile - << "v " - << refCellPts[ptI].x() << " " - << refCellPts[ptI].y() << " " - << refCellPts[ptI].z() - << nl; - } - - forAll(refCellFaces, faceI) - { - referredCellsFile<< "f"; - - forAll(refCellFaces[faceI], fPtI) - { - referredCellsFile - << " " - << refCellFaces[faceI][fPtI] + vertexOffset; - } - - referredCellsFile<< nl; - } - - vertexOffset += refCellPts.size(); - } - - referredCellsFile.flush(); - - fName = il_.mesh().time().path()/"referredWallFaces.obj"; - - Info<< " Writing " << fName.name() << endl; - - OFstream referredWallFacesFile(fName); - - vertexOffset = 1; - - forAll(*this, refCellI) - { - const ReferredCell<ParticleType>& refCell = (*this)[refCellI]; - - const pointField& refCellPts = refCell.points(); - - const faceList& refCellFaces = refCell.faces(); - - const labelList& wallFaces = refCell.wallFaces(); - - forAll(wallFaces, wFI) - { - const face& f = refCellFaces[wallFaces[wFI]]; - - forAll(f, fPtI) - { - referredWallFacesFile - << "v " - << refCellPts[f[fPtI]].x() << " " - << refCellPts[f[fPtI]].y() << " " - << refCellPts[f[fPtI]].z() - << nl; - } - - referredWallFacesFile<< "f"; - - forAll(f, fPtI) - { - referredWallFacesFile << " " << fPtI + vertexOffset; - } - - referredWallFacesFile<< nl; - - vertexOffset += f.size(); - } - } - - referredWallFacesFile.flush(); -} - -// ************************************************************************* // diff --git a/src/lagrangian/basic/InteractionLists/ReferredCellList/ReferredCellList.H b/src/lagrangian/basic/InteractionLists/ReferredCellList/ReferredCellList.H deleted file mode 100644 index 6cef6b73e314a0c9112e6b8665990648056ae62f..0000000000000000000000000000000000000000 --- a/src/lagrangian/basic/InteractionLists/ReferredCellList/ReferredCellList.H +++ /dev/null @@ -1,148 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Class - Foam::ReferredCellList - -Description - -SourceFiles - ReferredCellListI.H - ReferredCellList.C - -\*---------------------------------------------------------------------------*/ - -#ifndef ReferredCellList_H -#define ReferredCellList_H - -#include "ReferredCell.H" -#include "sendingReferralList.H" -#include "receivingReferralList.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// Forward declaration of classes -template<class ParticleType> -class InteractionLists; - -/*---------------------------------------------------------------------------*\ - Class ReferredCellList Declaration -\*---------------------------------------------------------------------------*/ - -template<class ParticleType> -class ReferredCellList -: - public List<ReferredCell<ParticleType> > -{ - // Private data - - const InteractionLists<ParticleType>& il_; - - //- Dummy cloud to give to particles - Cloud<ParticleType> cloud_; - - List<sendingReferralList> cellSendingReferralLists_; - - List<receivingReferralList> cellReceivingReferralLists_; - - - // Private Member Functions - - //- Refer and rerefer cells to construct referred interactions - void buildReferredCellList - ( - bool pointPointListBuild - ); - - //- Build referralLists which define how to send information - // to ReferredCells to source cells - void buildCellReferralLists(); - - //- Store the referred particles in the referred cells - void storeParticles - ( - const receivingReferralList& rRL, - const labelList& destinationReferredCell, - IDLList<ParticleType>& particlesToReferIn - ); - - -public: - - // Constructors - - //- Construct lists by searching the mesh - ReferredCellList - ( - InteractionLists<ParticleType>& il, - bool pointPointListBuild - ); - - //- Construct from file - ReferredCellList (InteractionLists<ParticleType>& il); - - - // Destructor - - ~ReferredCellList(); - - - // Member Functions - - void referParticles - ( - const List<DynamicList<ParticleType*> >& cellOccupancy - ); - - inline const InteractionLists<ParticleType>& il() const; - - inline label nInteractingProcs() const; - - //- Write the referredCell structure to an obj file - void writeReferredCells() const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "ReferredCellListI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "ReferredCellList.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/basic/InteractionLists/ReferredCellList/ReferredCellListI.H b/src/lagrangian/basic/InteractionLists/ReferredCellList/ReferredCellListI.H deleted file mode 100644 index 47938d68606a3cc6a3cfa93e0afe61edc46d3f4a..0000000000000000000000000000000000000000 --- a/src/lagrangian/basic/InteractionLists/ReferredCellList/ReferredCellListI.H +++ /dev/null @@ -1,45 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - -template<class ParticleType> -inline const Foam::InteractionLists<ParticleType>& -Foam::ReferredCellList<ParticleType>::il() const -{ - return il_; -} - - -template<class ParticleType> -inline Foam::label -Foam::ReferredCellList<ParticleType>::nInteractingProcs() const -{ - return cellReceivingReferralLists_.size(); -} - - -// ************************************************************************* // diff --git a/src/lagrangian/basic/InteractionLists/referralLists/receivingReferralList.C b/src/lagrangian/basic/InteractionLists/referralLists/receivingReferralList.C deleted file mode 100644 index 9f1f7c0af0075c4395f743e96164a87d62f1f845..0000000000000000000000000000000000000000 --- a/src/lagrangian/basic/InteractionLists/referralLists/receivingReferralList.C +++ /dev/null @@ -1,119 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*----------------------------------------------------------------------------*/ - -#include "receivingReferralList.H" - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::receivingReferralList::receivingReferralList() -: - labelListList(), - sourceProc_(-1) -{} - - -Foam::receivingReferralList::receivingReferralList -( - const label sourceProc, - const labelListList& refCellsToSendTo -) -: - labelListList(refCellsToSendTo), - sourceProc_(sourceProc) -{} - - -Foam::receivingReferralList::receivingReferralList -( - const receivingReferralList& rL -) -: - labelListList(rL), - sourceProc_(rL.sourceProc()) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::receivingReferralList::~receivingReferralList() -{} - - -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - -void Foam::receivingReferralList::operator=(const receivingReferralList& rhs) -{ - // Check for assignment to self - if (this == &rhs) - { - FatalErrorIn - ( - "Foam::receivingReferralList::operator=" - "(const Foam::receivingReferralList&)" - ) - << "Attempted assignment to self" - << abort(FatalError); - } - - labelListList::operator=(rhs); - - sourceProc_ = rhs.sourceProc(); -} - -// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * // - -Foam::Istream& Foam::operator>>(Istream& is, receivingReferralList& rRL) -{ - is >> rRL.sourceProc_ >> static_cast<labelListList&>(rRL); - - is.check - ( - "Istream& operator<<(Istream& f, const receivingReferralList& rRL" - ); - - return is; -} - - -Foam::Ostream& Foam::operator<< -( - Ostream& os, - const receivingReferralList& rRL -) -{ - os << rRL.sourceProc() << token::SPACE - << static_cast< const labelListList& >(rRL); - - os.check - ( - "Ostream& operator<<(Ostream& f, const receivingReferralList& rRL" - ); - - return os; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/basic/InteractionLists/referralLists/receivingReferralList.H b/src/lagrangian/basic/InteractionLists/referralLists/receivingReferralList.H deleted file mode 100644 index 8d9de5341d821c288e6139b03ebe64daa97d7e56..0000000000000000000000000000000000000000 --- a/src/lagrangian/basic/InteractionLists/referralLists/receivingReferralList.H +++ /dev/null @@ -1,127 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -Class - Foam::receivingReferralList - -Description - Contains an outer list which has entries corresponding to the - incoming particles sent by the sendingReferralList on the source - processor. The inner list has the indices of the referred cells - on the current processor to refer the particles to, as a real cell - may be referred multiple times. - -SourceFiles - receivingReferralListI.H - receivingReferralList.C - receivingReferralListIO.C - -\*---------------------------------------------------------------------------*/ - -#ifndef receivingReferralList_H -#define receivingReferralList_H - -#include "labelList.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class receivingReferralList Declaration -\*---------------------------------------------------------------------------*/ - -class receivingReferralList -: - public labelListList -{ - // Private data - - label sourceProc_; - - -public: - - // Constructors - - //- Construct null - receivingReferralList(); - - //- Construct from components - receivingReferralList - ( - const label sourceProc, - const labelListList& refCellsToSendTo - ); - - //- Construct as copy - receivingReferralList(const receivingReferralList&); - - - // Destructor - - ~receivingReferralList(); - - - // Member Functions - - // Access - - inline label sourceProc() const; - - - // Member Operators - - void operator=(const receivingReferralList&); - - - // IOstream Operators - - friend Istream& operator>> - ( - Istream&, - receivingReferralList& - ); - - friend Ostream& operator<< - ( - Ostream&, - const receivingReferralList& - ); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "receivingReferralListI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/basic/InteractionLists/referralLists/receivingReferralListI.H b/src/lagrangian/basic/InteractionLists/referralLists/receivingReferralListI.H deleted file mode 100644 index 9f97bd68838e5f99eac24b68ea759892d44d2e35..0000000000000000000000000000000000000000 --- a/src/lagrangian/basic/InteractionLists/referralLists/receivingReferralListI.H +++ /dev/null @@ -1,35 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -inline Foam::label Foam::receivingReferralList::sourceProc() const -{ - return sourceProc_; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/basic/InteractionLists/referralLists/sendingReferralList.C b/src/lagrangian/basic/InteractionLists/referralLists/sendingReferralList.C deleted file mode 100644 index 0cc3fcce992e831e7f873b601201376ef08411d1..0000000000000000000000000000000000000000 --- a/src/lagrangian/basic/InteractionLists/referralLists/sendingReferralList.C +++ /dev/null @@ -1,117 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*----------------------------------------------------------------------------*/ - -#include "sendingReferralList.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::sendingReferralList::sendingReferralList() -: - labelList(), - destinationProc_(-1) -{} - - -Foam::sendingReferralList::sendingReferralList -( - const label destinationProc, - const labelList& cellsToSend -) -: - labelList(cellsToSend), - destinationProc_(destinationProc) -{} - - -Foam::sendingReferralList::sendingReferralList -( - const sendingReferralList& rL -) -: - labelList(rL), - destinationProc_(rL.destinationProc()) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::sendingReferralList::~sendingReferralList() -{} - - -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - -void Foam::sendingReferralList::operator=(const sendingReferralList& rhs) -{ - // Check for assignment to self - if (this == &rhs) - { - FatalErrorIn - ( - "Foam::sendingReferralList::" \ - "operator=(const Foam::sendingReferralList&)" - ) - << "Attempted assignment to self" - << abort(FatalError); - } - - labelList::operator=(rhs); - - destinationProc_ = rhs.destinationProc(); -} - - -// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * // - -Foam::Istream& Foam::operator>> -( - Istream& is, - sendingReferralList& sRL -) -{ - is >> sRL.destinationProc_ >> static_cast<labelList&>(sRL); - - is.check("Istream& operator<<(Istream& f, const sendingReferralList& sRL"); - - return is; -} - - -Foam::Ostream& Foam::operator<< -( - Ostream& os, - const sendingReferralList& rL -) -{ - os << rL.destinationProc() << token::SPACE - << static_cast< const labelList& >(rL); - - os.check("Ostream& operator<<(Ostream& f, const sendingReferralList& rL"); - - return os; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/basic/InteractionLists/referralLists/sendingReferralList.H b/src/lagrangian/basic/InteractionLists/referralLists/sendingReferralList.H deleted file mode 100644 index cf1e840e1c79d3273481cb275d2932fe32cc5954..0000000000000000000000000000000000000000 --- a/src/lagrangian/basic/InteractionLists/referralLists/sendingReferralList.H +++ /dev/null @@ -1,125 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Class - Foam::sendingReferralList - -Description - Contains the list of the real cells on the current processor to be - referred to the destination processor - -SourceFiles - sendingReferralListI.H - sendingReferralList.C - sendingReferralListIO.C - -\*---------------------------------------------------------------------------*/ - -#ifndef sendingReferralList_H -#define sendingReferralList_H - -#include "labelList.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class sendingReferralList Declaration -\*---------------------------------------------------------------------------*/ - -class sendingReferralList -: - public labelList -{ - // Private data - - label destinationProc_; - - -public: - - // Constructors - - //- Construct null - sendingReferralList(); - - //- Construct from components - sendingReferralList - ( - const label destinationProc, - const labelList& cellsToSend - ); - - //- Construct as copy - sendingReferralList(const sendingReferralList&); - - - // Destructor - - ~sendingReferralList(); - - - // Member Functions - - // Access - - inline label destinationProc() const; - - - // Member Operators - - void operator=(const sendingReferralList&); - - - // IOstream Operators - - friend Istream& operator>> - ( - Istream&, - sendingReferralList& - ); - - friend Ostream& operator<< - ( - Ostream&, - const sendingReferralList& - ); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "sendingReferralListI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/basic/InteractionLists/referralLists/sendingReferralListI.H b/src/lagrangian/basic/InteractionLists/referralLists/sendingReferralListI.H deleted file mode 100644 index 4843f7ab17e7751af58fe185b0cc9c7a2cca4e43..0000000000000000000000000000000000000000 --- a/src/lagrangian/basic/InteractionLists/referralLists/sendingReferralListI.H +++ /dev/null @@ -1,35 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -inline Foam::label Foam::sendingReferralList::destinationProc() const -{ - return destinationProc_; -} - - -// ************************************************************************* //