From e325814c80be220a6ecd8f43c379c681e87def10 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 15 Dec 2009 16:00:47 +0000 Subject: [PATCH] Test application for syncTools functionality --- applications/test/syncTools/Make/files | 3 + applications/test/syncTools/Make/options | 1 + applications/test/syncTools/syncToolsTest.C | 629 ++++++++++++++++++++ 3 files changed, 633 insertions(+) create mode 100644 applications/test/syncTools/Make/files create mode 100644 applications/test/syncTools/Make/options create mode 100644 applications/test/syncTools/syncToolsTest.C 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