diff --git a/applications/test/Distribution/DistributionTest.C b/applications/test/Distribution/DistributionTest.C new file mode 100644 index 0000000000..cdbbc4e469 --- /dev/null +++ b/applications/test/Distribution/DistributionTest.C @@ -0,0 +1,81 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 + +Application + DistributionTest + +Description + Test the Distribution class + +\*---------------------------------------------------------------------------*/ + +#include "vector.H" +#include "labelVector.H" +#include "tensor.H" +#include "Distribution.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +using namespace Foam; + +int main(int argc, char *argv[]) +{ + Distribution dS(scalar(3.0)); + Distribution dV(vector(0.1, 0.24, 0.18)); + Distribution dLV(labelVector(2,3,4)); + + dS.add(1.0); + dS.add(2.0); + dS.add(12.0); + dS.add(1.3); + + Info<< dS << nl << dS.raw() << endl; + + vector vA(1.2, 1.3, 1.1); + vector vB(1.3, 1.5, 1.6); + vector vC(0.5, 5.3, 1.1); + + dV.add(vA); + dV.add(vB); + dV.add(vC); + + Info<< dV << nl << dV.raw() << endl; + + labelVector lVA(6, 8, 11); + labelVector lVB(-12, -3, 6); + labelVector lVC(-4, -2, 5); + + dLV.add(lVA); + dLV.add(lVB); + dLV.add(lVC); + + Info<< dLV << nl << dLV.raw() << endl; + + Info<< nl << "End" << nl << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/test/Distribution/Make/files b/applications/test/Distribution/Make/files new file mode 100644 index 0000000000..629268ee55 --- /dev/null +++ b/applications/test/Distribution/Make/files @@ -0,0 +1,3 @@ +DistributionTest.C + +EXE = $(FOAM_USER_APPBIN)/DistributionTest diff --git a/applications/test/Distribution/Make/options b/applications/test/Distribution/Make/options new file mode 100644 index 0000000000..b28b04f643 --- /dev/null +++ b/applications/test/Distribution/Make/options @@ -0,0 +1,3 @@ + + + diff --git a/etc/controlDict b/etc/controlDict index ef72407eaf..65b3214f41 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -377,7 +377,7 @@ DebugSwitches displacementLaplacian 0; displacementSBRStress 0; distanceSurface 0; - distribution 0; + Distribution 0; downwind 0; dragModel 0; duplicatePoints 0; diff --git a/src/OpenFOAM/containers/HashTables/Map/Distribution/Distribution.C b/src/OpenFOAM/containers/HashTables/Map/Distribution/Distribution.C new file mode 100644 index 0000000000..3a0defe22c --- /dev/null +++ b/src/OpenFOAM/containers/HashTables/Map/Distribution/Distribution.C @@ -0,0 +1,227 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 "Distribution.H" + +// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::Distribution::Distribution() +: + List< Map