diff --git a/applications/solvers/combustion/PDRFoam/Make/options b/applications/solvers/combustion/PDRFoam/Make/options index 4e5b8fb9a0..a1469d0ef0 100644 --- a/applications/solvers/combustion/PDRFoam/Make/options +++ b/applications/solvers/combustion/PDRFoam/Make/options @@ -15,8 +15,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/triSurface/lnInclude + -I$(LIB_SRC)/meshTools/lnInclude EXE_LIBS = \ -lengine \ diff --git a/applications/test/globalMeshData/Make/files b/applications/test/globalMeshData/Make/files new file mode 100644 index 0000000000..dc5877e383 --- /dev/null +++ b/applications/test/globalMeshData/Make/files @@ -0,0 +1,3 @@ +globalMeshDataTest.C + +EXE = $(FOAM_USER_APPBIN)/globalMeshDataTest diff --git a/applications/test/globalMeshData/Make/options b/applications/test/globalMeshData/Make/options new file mode 100644 index 0000000000..4c3dd783cb --- /dev/null +++ b/applications/test/globalMeshData/Make/options @@ -0,0 +1,3 @@ +EXE_INC = + +EXE_LIBS = diff --git a/applications/test/globalMeshData/globalMeshDataTest.C b/applications/test/globalMeshData/globalMeshDataTest.C new file mode 100644 index 0000000000..75f98b1b9c --- /dev/null +++ b/applications/test/globalMeshData/globalMeshDataTest.C @@ -0,0 +1,221 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-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 + +Application + globalMeshDataTest + +Description + Test global point communication + +\*---------------------------------------------------------------------------*/ + +#include "globalMeshData.H" +#include "argList.H" +#include "polyMesh.H" +#include "Time.H" +#include "mapDistribute.H" + +using namespace Foam; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Main program: + +int main(int argc, char *argv[]) +{ +# include "setRootCase.H" +# include "createTime.H" +# include "createPolyMesh.H" + + const globalMeshData& globalData = mesh.globalData(); + const indirectPrimitivePatch& coupledPatch = globalData.coupledPatch(); + + + // Test:print shared points + { + const labelListList& globalPointSlaves = + globalData.globalPointSlaves(); + const mapDistribute& globalPointSlavesMap = + globalData.globalPointSlavesMap(); + + pointField coords(globalPointSlavesMap.constructSize()); + SubList(coords, coupledPatch.nPoints()).assign + ( + coupledPatch.localPoints() + ); + + // Exchange data + globalPointSlavesMap.distribute(coords); + + // Print + forAll(globalPointSlaves, pointI) + { + const labelList& slavePoints = globalPointSlaves[pointI]; + + if (slavePoints.size() > 0) + { + Pout<< "Master point:" << pointI + << " coord:" << coords[pointI] + << " connected to slave points:" << endl; + + forAll(slavePoints, i) + { + Pout<< " " << coords[slavePoints[i]] << endl; + } + } + } + } + + + + // Test: point to faces addressing + { + const labelListList& globalPointBoundaryFaces = + globalData.globalPointBoundaryFaces(); + const mapDistribute& globalPointBoundaryFacesMap = + globalData.globalPointBoundaryFacesMap(); + + label nBnd = mesh.nFaces()-mesh.nInternalFaces(); + + pointField fc(globalPointBoundaryFacesMap.constructSize()); + SubList(fc, nBnd).assign + ( + primitivePatch + ( + SubList + ( + mesh.faces(), + nBnd, + mesh.nInternalFaces() + ), + mesh.points() + ).faceCentres() + ); + + // Exchange data + globalPointBoundaryFacesMap.distribute(fc); + + // Print + forAll(globalPointBoundaryFaces, pointI) + { + const labelList& bFaces = globalPointBoundaryFaces[pointI]; + + Pout<< "Point:" << pointI + << " at:" << coupledPatch.localPoints()[pointI] + << " connected to faces:" << endl; + + forAll(bFaces, i) + { + Pout<< " " << fc[bFaces[i]] << endl; + } + } + } + + + + + + // Test:point to cells addressing + { + const labelList& boundaryCells = globalData.boundaryCells(); + const labelListList& globalPointBoundaryCells = + globalData.globalPointBoundaryCells(); + const mapDistribute& globalPointBoundaryCellsMap = + globalData.globalPointBoundaryCellsMap(); + + pointField cc(globalPointBoundaryCellsMap.constructSize()); + forAll(boundaryCells, i) + { + cc[i] = mesh.cellCentres()[boundaryCells[i]]; + } + + // Exchange data + globalPointBoundaryCellsMap.distribute(cc); + + // Print + forAll(globalPointBoundaryCells, pointI) + { + const labelList& bCells = globalPointBoundaryCells[pointI]; + + Pout<< "Point:" << pointI + << " at:" << coupledPatch.localPoints()[pointI] + << " connected to cells:" << endl; + + forAll(bCells, i) + { + Pout<< " " << cc[bCells[i]] << endl; + } + } + } + + + + // Test:print shared edges + { + const labelListList& globalEdgeSlaves = + globalData.globalEdgeSlaves(); + const mapDistribute& globalEdgeSlavesMap = + globalData.globalEdgeSlavesMap(); + + // Test: distribute edge centres + pointField ec(globalEdgeSlavesMap.constructSize()); + forAll(coupledPatch.edges(), edgeI) + { + ec[edgeI] = coupledPatch.edges()[edgeI].centre + ( + coupledPatch.localPoints() + ); + } + + // Exchange data + globalEdgeSlavesMap.distribute(ec); + + // Print + forAll(globalEdgeSlaves, edgeI) + { + const labelList& slaveEdges = globalEdgeSlaves[edgeI]; + + if (slaveEdges.size() > 0) + { + Pout<< "Master edge:" << edgeI + << " centre:" << ec[edgeI] + << " connected to slave edges:" << endl; + + forAll(slaveEdges, i) + { + Pout<< " " << ec[slaveEdges[i]] << endl; + } + } + } + } + + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/test/syncTools/Make/files b/applications/test/syncTools/Make/files new file mode 100644 index 0000000000..6a186ca84a --- /dev/null +++ b/applications/test/syncTools/Make/files @@ -0,0 +1,3 @@ +syncToolsTest.C + +EXE = $(FOAM_USER_APPBIN)/syncToolsTest diff --git a/applications/test/syncTools/Make/options b/applications/test/syncTools/Make/options new file mode 100644 index 0000000000..41306609f2 --- /dev/null +++ b/applications/test/syncTools/Make/options @@ -0,0 +1 @@ +EXE_INC = diff --git a/applications/test/syncTools/syncToolsTest.C b/applications/test/syncTools/syncToolsTest.C new file mode 100644 index 0000000000..320b4e6f61 --- /dev/null +++ b/applications/test/syncTools/syncToolsTest.C @@ -0,0 +1,629 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 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 + +Application + syncToolsTest + +Description + Test some functionality in syncTools. + +\*---------------------------------------------------------------------------*/ + + +#include "argList.H" +#include "polyMesh.H" +#include "Time.H" +#include "Random.H" +#include "PackedList.H" +#include "syncTools.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +void testPackedList(const polyMesh& mesh, Random& rndGen) +{ + Info<< nl << "Testing PackedList synchronisation." << endl; + + { + PackedList<3> bits(mesh.nEdges()); + forAll(bits, i) + { + bits.set(i, rndGen.integer(0,3)); + } + + labelList edgeValues(mesh.nEdges()); + forAll(bits, i) + { + edgeValues[i] = bits.get(i); + } + + PackedList<3> maxBits(bits); + labelList maxEdgeValues(edgeValues); + + syncTools::syncEdgeList(mesh, bits, minEqOp(), 0); + syncTools::syncEdgeList(mesh, edgeValues, minEqOp