diff --git a/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C b/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C index 7573b8f537..53ae8af8be 100644 --- a/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C +++ b/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C @@ -119,7 +119,7 @@ scalar StCoNum = 0.0; fvc::makeAbsolute(phi, rho, U); // Test : disable refinement for some cells - PackedList<1>& protectedCell = + PackedBoolList& protectedCell = refCast(mesh).protectedCell(); if (protectedCell.empty()) diff --git a/applications/test/PackedList/Make/files b/applications/test/PackedList/Make/files new file mode 100644 index 0000000000..e06685c8b3 --- /dev/null +++ b/applications/test/PackedList/Make/files @@ -0,0 +1,3 @@ +PackedListTest.C + +EXE = $(FOAM_USER_APPBIN)/PackedListTest diff --git a/applications/test/PackedList/Make/options b/applications/test/PackedList/Make/options new file mode 100644 index 0000000000..e69de29bb2 diff --git a/applications/test/PackedList/PackedListTest.C b/applications/test/PackedList/PackedListTest.C new file mode 100644 index 0000000000..a3767e8680 --- /dev/null +++ b/applications/test/PackedList/PackedListTest.C @@ -0,0 +1,106 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 + +Description + +\*---------------------------------------------------------------------------*/ + +#include "OSspecific.H" + +#include "IOstreams.H" +#include "IStringStream.H" +#include "scalar.H" +#include "vector.H" +#include "ListOps.H" +#include "List.H" +#include "PackedBoolList.H" +#include + +using namespace Foam; + +template +void printPackedList(const PackedList& L) +{ + const List& stor = L.storage(); + + cout<< "PackedList<" << nBits << ">" + << " max_bits:" << L.max_bits() + << " max_value:" << L.max_value() + << " packing:" << L.packing() << nl; + + cout<< "values: " << L.size() << "/" << L.capacity() << " ( "; + forAll(L, i) + { + cout<< L[i] << ' '; + } + cout<< ")\n\n"; + + cout<< "storage: " << stor.size() << "( "; + forAll(stor, i) + { + cout<< std::bitset<32>(stor[i]) << ' '; + } + cout<< ")\n" << nl; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Main program: + +int main(int argc, char *argv[]) +{ + cout<< "PackedList::max_bits() = " << PackedList<0>::max_bits() << nl; + + PackedList<3> list1(5,1); + + printPackedList(list1); + + list1 = 2; + printPackedList(list1); + + list1.resize(6, 3); + printPackedList(list1); + + list1 = false; + printPackedList(list1); + + list1 = true; + printPackedList(list1); + + list1.resize(12); + printPackedList(list1); + + list1.resize(25, list1.max_value()); + printPackedList(list1); + + list1.resize(8); + printPackedList(list1); + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C index e2eb989905..c92418dc80 100644 --- a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C +++ b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C @@ -48,7 +48,7 @@ Description #include "polyMesh.H" #include "mapPolyMesh.H" #include "mathematicalConstants.H" -#include "PackedList.H" +#include "PackedBoolList.H" #include "SortableList.H" using namespace Foam; @@ -177,7 +177,7 @@ label mergeEdges // Return master point edge needs to be collapsed to (or -1) -label edgeMaster(const PackedList<1>& boundaryPoint, const edge& e) +label edgeMaster(const PackedBoolList& boundaryPoint, const edge& e) { label masterPoint = -1; @@ -215,7 +215,7 @@ label edgeMaster(const PackedList<1>& boundaryPoint, const edge& e) label collapseSmallEdges ( const polyMesh& mesh, - const PackedList<1>& boundaryPoint, + const PackedBoolList& boundaryPoint, const scalar minLen, edgeCollapser& collapser ) @@ -254,7 +254,7 @@ label collapseSmallEdges label collapseHighAspectFaces ( const polyMesh& mesh, - const PackedList<1>& boundaryPoint, + const PackedBoolList& boundaryPoint, const scalar areaFac, const scalar edgeRatio, edgeCollapser& collapser @@ -346,7 +346,7 @@ void set(const labelList& elems, const bool val, boolList& status) label simplifyFaces ( const polyMesh& mesh, - const PackedList<1>& boundaryPoint, + const PackedBoolList& boundaryPoint, const label minSize, const scalar lenGap, edgeCollapser& collapser @@ -485,7 +485,7 @@ int main(int argc, char *argv[]) const faceList& faces = mesh.faces(); // Get all points on the boundary - PackedList<1> boundaryPoint(mesh.nPoints(), false); + PackedBoolList boundaryPoint(mesh.nPoints()); label nIntFaces = mesh.nInternalFaces(); for (label faceI = nIntFaces; faceI < mesh.nFaces(); faceI++) diff --git a/applications/utilities/mesh/conversion/polyDualMesh/makePolyDualMesh.C b/applications/utilities/mesh/conversion/polyDualMesh/makePolyDualMesh.C index 3470fd71cc..b647ec8d13 100644 --- a/applications/utilities/mesh/conversion/polyDualMesh/makePolyDualMesh.C +++ b/applications/utilities/mesh/conversion/polyDualMesh/makePolyDualMesh.C @@ -49,7 +49,7 @@ Description #include "mathematicalConstants.H" #include "polyTopoChange.H" #include "mapPolyMesh.H" -#include "PackedList.H" +#include "PackedBoolList.H" #include "meshTools.H" #include "OFstream.H" #include "meshDualiser.H" @@ -67,7 +67,7 @@ using namespace Foam; void simpleMarkFeatures ( const polyMesh& mesh, - const PackedList<1>& isBoundaryEdge, + const PackedBoolList& isBoundaryEdge, const scalar featureAngle, const bool doNotPreserveFaceZones, @@ -358,7 +358,7 @@ int main(int argc, char *argv[]) // Mark boundary edges and points. // (Note: in 1.4.2 we can use the built-in mesh point ordering // facility instead) - PackedList<1> isBoundaryEdge(mesh.nEdges()); + PackedBoolList isBoundaryEdge(mesh.nEdges()); for (label faceI = mesh.nInternalFaces(); faceI < mesh.nFaces(); faceI++) { const labelList& fEdges = mesh.faceEdges()[faceI]; diff --git a/applications/utilities/mesh/conversion/polyDualMesh/meshDualiser.C b/applications/utilities/mesh/conversion/polyDualMesh/meshDualiser.C index 2a307e5df2..08b7d7c9b8 100644 --- a/applications/utilities/mesh/conversion/polyDualMesh/meshDualiser.C +++ b/applications/utilities/mesh/conversion/polyDualMesh/meshDualiser.C @@ -155,7 +155,7 @@ Foam::label Foam::meshDualiser::findDualCell // from (boundary & feature) point void Foam::meshDualiser::generateDualBoundaryEdges ( - const PackedList<1>& isBoundaryEdge, + const PackedBoolList& isBoundaryEdge, const label pointI, polyTopoChange& meshMod ) @@ -388,7 +388,7 @@ Foam::label Foam::meshDualiser::addBoundaryFace void Foam::meshDualiser::createFacesAroundEdge ( const bool splitFace, - const PackedList<1>& isBoundaryEdge, + const PackedBoolList& isBoundaryEdge, const label edgeI, const label startFaceI, polyTopoChange& meshMod, @@ -907,7 +907,7 @@ void Foam::meshDualiser::setRefinement // Mark boundary edges and points. // (Note: in 1.4.2 we can use the built-in mesh point ordering // facility instead) - PackedList<1> isBoundaryEdge(mesh_.nEdges()); + PackedBoolList isBoundaryEdge(mesh_.nEdges()); for (label faceI = mesh_.nInternalFaces(); faceI < mesh_.nFaces(); faceI++) { const labelList& fEdges = mesh_.faceEdges()[faceI]; diff --git a/applications/utilities/mesh/conversion/polyDualMesh/meshDualiser.H b/applications/utilities/mesh/conversion/polyDualMesh/meshDualiser.H index ee5599816c..dafcd0a74d 100644 --- a/applications/utilities/mesh/conversion/polyDualMesh/meshDualiser.H +++ b/applications/utilities/mesh/conversion/polyDualMesh/meshDualiser.H @@ -49,7 +49,7 @@ SourceFiles #define meshDualiser_H #include "DynamicList.H" -#include "PackedList.H" +#include "PackedBoolList.H" #include "boolList.H" #include "typeInfo.H" @@ -101,7 +101,7 @@ class meshDualiser // emanating from (boundary & feature) point void generateDualBoundaryEdges ( - const PackedList<1>&, + const PackedBoolList&, const label pointI, polyTopoChange& ); @@ -144,7 +144,7 @@ class meshDualiser void createFacesAroundEdge ( const bool splitFace, - const PackedList<1>&, + const PackedBoolList&, const label edgeI, const label startFaceI, polyTopoChange&, diff --git a/src/OpenFOAM/containers/Lists/PackedList/PackedList.C b/src/OpenFOAM/containers/Lists/PackedList/PackedList.C index 252b369067..ff006523fc 100644 --- a/src/OpenFOAM/containers/Lists/PackedList/PackedList.C +++ b/src/OpenFOAM/containers/Lists/PackedList/PackedList.C @@ -31,7 +31,7 @@ License template Foam::PackedList::PackedList(const label size, const unsigned int val) : - List(intSize(size)), + List(storageSize(size)), size_(size) { operator=(val); @@ -56,7 +56,7 @@ Foam::PackedList::PackedList(const Xfer >& lst) template Foam::PackedList::PackedList(const UList