diff --git a/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C b/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C index 7573b8f53708ed8462774ff9bfa6927600e670e6..53ae8af8befb8a5d1db32635c3b4c83773e2f7a4 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<dynamicRefineFvMesh>(mesh).protectedCell(); if (protectedCell.empty()) diff --git a/applications/test/PackedList/Make/files b/applications/test/PackedList/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..e06685c8b384dc32a4f6c0f645129282f18c6320 --- /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 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/applications/test/PackedList/PackedListTest.C b/applications/test/PackedList/PackedListTest.C new file mode 100644 index 0000000000000000000000000000000000000000..a3767e86803ce5964c88424041ca4ee9bcd53889 --- /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 <bitset> + +using namespace Foam; + +template <int nBits> +void printPackedList(const PackedList<nBits>& L) +{ + const List<unsigned int>& 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 e2eb989905e5f610ac3d6add9193b221c42902df..c92418dc803e98f119ed83d90801a0074dd8a619 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 3470fd71cc71e56c07cc0d087beef364f3c0d58d..b647ec8d13b74980718727fdba437cbb6b0a07c2 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 2a307e5df2aaeb7045fa08d11a475eb9c2870aa1..08b7d7c9b8c6ffbd7bdca03022c819f290e4b952 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 ee5599816c3c81fa9431af8c4929bd0ff5277cb6..dafcd0a74d7b5be16d4f7daa3b7dbba0ff447895 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 252b3690671a864d64eb269a80701414aad016a3..ff006523fce6098fabacd9d9d77db0f8223ad145 100644 --- a/src/OpenFOAM/containers/Lists/PackedList/PackedList.C +++ b/src/OpenFOAM/containers/Lists/PackedList/PackedList.C @@ -31,7 +31,7 @@ License template<int nBits> Foam::PackedList<nBits>::PackedList(const label size, const unsigned int val) : - List<unsigned int>(intSize(size)), + List<unsigned int>(storageSize(size)), size_(size) { operator=(val); @@ -56,7 +56,7 @@ Foam::PackedList<nBits>::PackedList(const Xfer<PackedList<nBits> >& lst) template<int nBits> Foam::PackedList<nBits>::PackedList(const UList<label>& lst) : - List<unsigned int>(intSize(lst.size()), 0), + List<unsigned int>(storageSize(lst.size()), 0), size_(lst.size()) { forAll(lst, i) @@ -76,10 +76,36 @@ Foam::autoPtr<Foam::PackedList<nBits> > Foam::PackedList<nBits>::clone() const // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<int nBits> -void Foam::PackedList<nBits>::setSize(const label size) +void Foam::PackedList<nBits>::setSize(const label newSize) { - List<unsigned int>::setSize(intSize(size)); - size_ = size; + List<unsigned int>::setSize(storageSize(newSize), 0); + size_ = newSize; +} + + +template<int nBits> +void Foam::PackedList<nBits>::setSize +( + const label newSize, + const unsigned int& val +) +{ +# ifdef DEBUGList + checkValue(val); +# endif + + List<unsigned int>::setSize(storageSize(newSize), 0); + + if (val && newSize > size_) + { + // fill new elements + for (label i = size_; i < newSize; i++) + { + set(i, val); + } + } + + size_ = newSize; } diff --git a/src/OpenFOAM/containers/Lists/PackedList/PackedList.H b/src/OpenFOAM/containers/Lists/PackedList/PackedList.H index 92493d557db2bb1fe9691d5b6f714d9cd3fd09cb..a6544b59a49fee82b3742fc588efc56c2124d3a4 100644 --- a/src/OpenFOAM/containers/Lists/PackedList/PackedList.H +++ b/src/OpenFOAM/containers/Lists/PackedList/PackedList.H @@ -27,8 +27,14 @@ Class Description List of packed unsigned ints. + Gets given the number of bits per item. +ToDo + Add checks for bad template parameters (ie, nBits=0, nBits too large). + Could make PackedBitRef an iterator and use for traversing as well. + It could be useful to make PackedList behave a bit like DynamicList. + SourceFiles PackedListI.H PackedList.C @@ -54,45 +60,55 @@ TemplateName(PackedList); /*---------------------------------------------------------------------------*\ - Class PackedList Declaration + Class PackedBitRef Declaration \*---------------------------------------------------------------------------*/ -//- For PackedList -class reference +//- The PackedBitRef is used for PackedList +class PackedBitRef { +private: + // private data unsigned int& elem_; - unsigned int mask_; + const label startBit_; - label startBit_; + const unsigned int mask_; public: - inline reference(unsigned int& elem, unsigned int mask, label startBit) + inline PackedBitRef(unsigned int& elem, label startBit, unsigned int mask) : elem_(elem), - mask_(mask), - startBit_(startBit) + startBit_(startBit), + mask_(mask) {} inline void operator=(const unsigned int val) { unsigned int shiftedMask = mask_ << startBit_; - - unsigned int shiftedVal = val << startBit_; + unsigned int shiftedVal = (val & mask_) << startBit_; elem_ = (elem_ & ~shiftedMask) | shiftedVal; } inline operator unsigned int () const { - return (elem_ >> startBit_) & mask_; + return ((elem_ >> startBit_) & mask_); + } + + inline operator bool() const + { + return !!((elem_ >> startBit_) & mask_); } }; +/*---------------------------------------------------------------------------*\ + Class PackedList Declaration +\*---------------------------------------------------------------------------*/ + template <int nBits> class PackedList : @@ -103,23 +119,36 @@ class PackedList //- Number of nBits entries label size_; - // Private Member Functions //- Calculate underlying list size - inline static label intSize(const label sz); + inline static label storageSize(const label); - //- Calculate index into underlying List. - inline static label intIndex(const label i); + //- Calculate element index and offset (start) bit within storage + inline static label location(const label, label& offset); - //- Check index i is within valid range (0 ... size-1). - inline void checkIndex(const label i) const; + //- Check if value is representable in nBits + inline static void checkValue(const unsigned int); - //- Check value is representable in nBits - inline void checkValue(const unsigned int val) const; + //- Check index i is within valid range (0 ... size-1). + inline void checkIndex(const label) const; public: + // Public data + + //- The max. number of bits that can be templated. + // Might someday be useful for a template assert. + inline static unsigned int max_bits(); + + //- The max. value for an entry, can also be used as the mask + // eg, ((1 << 2) - 1) yields 0b0011 + inline static unsigned int max_value(); + + //- The number of entries per storage entry + inline static unsigned int packing(); + + // Constructors //- Null constructor @@ -129,7 +158,7 @@ public: inline PackedList(const label size); //- Construct with given size and value for all elements. - PackedList(const label size, const unsigned int val); + PackedList(const label size, const unsigned val); //- Copy constructor. PackedList(const PackedList<nBits>& PList); @@ -145,27 +174,11 @@ public: // Member Functions - // Edit - - //- Reset size of List. - void setSize(const label); - - //- Reset size of List. - inline void resize(const label); - - //- Clear the list, i.e. set size to zero. - void clear(); - - //- Transfer the contents of the argument List into this List - // and annull the argument list. - void transfer(PackedList<nBits>&); - - //- Transfer contents to the Xfer container - inline Xfer<PackedList<nBits> > xfer(); - - // Access + //- The number of elements that can be stored before resizing + inline label capacity() const; + //- Number of packed elements inline label size() const; @@ -181,20 +194,51 @@ public: //- Underlying storage inline List<unsigned int>& storage(); + //- Underlying storage + inline const List<unsigned int>& storage() const; + + + // Edit + + //- Reset size of List, setting zero for any new elements. + void setSize(const label); + + //- Reset size of List and value for new elements. + void setSize(const label, const unsigned int& val); + + //- Reset size of List, setting zero for any new elements. + inline void resize(const label); + + //- Reset size of List and value for new elements. + inline void resize(const label, const unsigned int& val); + + //- Construct with given size and value for all elements. + + //- Clear the list, i.e. set size to zero. + void clear(); + + //- Transfer the contents of the argument List into this List + // and annull the argument list. + void transfer(PackedList<nBits>&); + + //- Transfer contents to the Xfer container + inline Xfer<PackedList<nBits> > xfer(); + // Member operators //- Get value at index i inline unsigned int operator[](const label i) const; - //- Set value at index i. Returns proxy which does actual operation - inline ::Foam::reference operator[](const label i); + //- Set value at index i. + // Returns proxy to perform the actual operation + inline ::Foam::PackedBitRef operator[](const label i); //- Assignment operator. Takes linear time. void operator=(const PackedList<nBits>&); - //- Assignment of all entries to the given value. Does set on all - // elements. + //- Assignment of all entries to the given value. + // Does set on all elements. inline void operator=(const unsigned int val); //- Return as labelList @@ -207,7 +251,6 @@ public: // friend Ostream& operator<< <nBits> (Ostream&, const PackedList<nBits>&); }; - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/containers/Lists/PackedList/PackedListI.H b/src/OpenFOAM/containers/Lists/PackedList/PackedListI.H index 3ccd2578139897d86bc0c3cd5213fbcd2e40f502..d753a89426c1eab1c2d624e61bfaa6ab28f3caec 100644 --- a/src/OpenFOAM/containers/Lists/PackedList/PackedListI.H +++ b/src/OpenFOAM/containers/Lists/PackedList/PackedListI.H @@ -25,33 +25,67 @@ License \*---------------------------------------------------------------------------*/ -#ifndef PackedList_I -#define PackedList_I +#ifndef PackedListI_H +#define PackedListI_H #include "IOstreams.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Calculate underlying list size template<int nBits> -inline Foam::label Foam::PackedList<nBits>::intSize(const label sz) +inline unsigned int Foam::PackedList<nBits>::max_bits() { - const label nElemsPerLabel = sizeof(unsigned int)*8/nBits; + return sizeof(unsigned int)*8 - 1; +} + - return (sz+nElemsPerLabel-1)/nElemsPerLabel; +template<int nBits> +inline unsigned int Foam::PackedList<nBits>::max_value() +{ + return ((1u << nBits) - 1); } -// Convert index into index in integer array template<int nBits> -inline Foam::label Foam::PackedList<nBits>::intIndex(const label i) +inline unsigned int Foam::PackedList<nBits>::packing() { - const label nElemsPerLabel = sizeof(unsigned int)*8/nBits; + return sizeof(unsigned int)*8 / nBits; +} - // Index in underlying int array - label elemI = i/nElemsPerLabel; - return elemI; +// Calculate underlying list size +template<int nBits> +inline Foam::label Foam::PackedList<nBits>::storageSize(const label sz) +{ + return (sz + packing() - 1) / packing(); +} + + +template<int nBits> +inline Foam::label Foam::PackedList<nBits>::location +( + const label i, + label& offset +) +{ + // the offset is the start bit within the storage element + offset = nBits * (i % packing()); + return i / packing(); +} + + +// Check value is representable in nBits +template<int nBits> +inline void Foam::PackedList<nBits>::checkValue(const unsigned int val) +{ + if (val > max_value()) + { + FatalErrorIn("PackedList<T>::checkValue(const unsigned int)") + << "value " << label(val) << " out of range 0 ... " + << label(max_value()) + << " representable by " << nBits << " bits" + << abort(FatalError); + } } @@ -62,10 +96,10 @@ inline void Foam::PackedList<nBits>::checkIndex(const label i) const if (!size_) { FatalErrorIn("PackedList<nBits>::checkIndex(const label)") - << "attempt to access element from zero sized list" + << "attempt to access element from zero-sized list" << abort(FatalError); } - else if (i<0 || i>=size_) + else if (i < 0 || i >= size_) { FatalErrorIn("PackedList<nBits>::checkIndex(const label)") << "index " << i << " out of range 0 ... " << size_-1 @@ -74,20 +108,6 @@ inline void Foam::PackedList<nBits>::checkIndex(const label i) const } -// Check value is representable in nBits -template<int nBits> -inline void Foam::PackedList<nBits>::checkValue(const unsigned int val) const -{ - if (val>=(1u << nBits)) - { - FatalErrorIn("PackedList<T>::checkValue(const unsigned int)") - << "value " << label(val) << " out of range 0 ... " - << label((1u << nBits)-1) - << " representable by " << nBits << " bits" - << abort(FatalError); - } -} - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // Null constructor @@ -103,7 +123,7 @@ inline Foam::PackedList<nBits>::PackedList() template<int nBits> inline Foam::PackedList<nBits>::PackedList(const label size) : - List<unsigned int>(intSize(size), 0u), + List<unsigned int>(storageSize(size), 0u), size_(size) {} @@ -111,9 +131,27 @@ inline Foam::PackedList<nBits>::PackedList(const label size) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<int nBits> -inline void Foam::PackedList<nBits>::resize(const label size) +inline void Foam::PackedList<nBits>::resize(const label newSize) +{ + setSize(newSize); +} + + +template<int nBits> +inline void Foam::PackedList<nBits>::resize +( + const label newSize, + const unsigned int& val +) { - this->setSize(size); + setSize(newSize, val); +} + + +template<int nBits> +inline Foam::label Foam::PackedList<nBits>::capacity() const +{ + return packing() * List<unsigned int>::size(); } @@ -127,7 +165,7 @@ inline Foam::label Foam::PackedList<nBits>::size() const template<int nBits> inline bool Foam::PackedList<nBits>::empty() const { - return (size_ == 0); + return !size_; } @@ -139,17 +177,13 @@ inline unsigned int Foam::PackedList<nBits>::get(const label i) const checkIndex(i); # endif - // Constant: number of elements that fit in an unsigned int - const label nElemsPerLabel = sizeof(unsigned int)*8/nBits; - - unsigned int mask = ((1u << nBits) - 1); - - label indexInLabel = i % nElemsPerLabel; - - // Starting bit in int. - label startBit = nBits*indexInLabel; + label startBit; + const unsigned int& elem = List<unsigned int>::operator[] + ( + location(i, startBit) + ); - return (List<unsigned int>::operator[](intIndex(i)) >> startBit) & mask; + return (elem >> startBit) & max_value(); } @@ -169,24 +203,17 @@ inline bool Foam::PackedList<nBits>::set(const label i, const unsigned int val) checkValue(val); # endif - // Constant: number of elements that fit in an unsigned int - const label nElemsPerLabel = sizeof(unsigned int)*8/nBits; - - unsigned int mask = ((1u << nBits) - 1); - - label indexInLabel = i % nElemsPerLabel; - - // Starting bit in int. - label startBit = nBits*indexInLabel; - - - unsigned int shiftedMask = mask << startBit; - unsigned int shiftedVal = val << startBit; - - unsigned int& elem = List<unsigned int>::operator[](intIndex(i)); + label startBit; + unsigned int& elem = List<unsigned int>::operator[] + ( + location(i, startBit) + ); unsigned int oldElem = elem; + unsigned int shiftedMask = max_value() << startBit; + unsigned int shiftedVal = (val & max_value()) << startBit; + elem = (elem & ~shiftedMask) | shiftedVal; return elem != oldElem; @@ -200,6 +227,13 @@ inline Foam::List<unsigned int>& Foam::PackedList<nBits>::storage() } +template<int nBits> +inline const Foam::List<unsigned int>& Foam::PackedList<nBits>::storage() const +{ + return static_cast<const List<unsigned int>&>(*this); +} + + template<int nBits> inline Foam::Xfer<Foam::PackedList<nBits> > Foam::PackedList<nBits>::xfer() @@ -210,25 +244,20 @@ Foam::PackedList<nBits>::xfer() template<int nBits> -inline Foam::reference Foam::PackedList<nBits>::operator[](const label i) +inline Foam::PackedBitRef +Foam::PackedList<nBits>::operator[](const label i) { # ifdef DEBUGList checkIndex(i); # endif - // Constant: number of elements that fit in an unsigned int - const label nElemsPerLabel = sizeof(unsigned int)*8/nBits; - - unsigned int mask = ((1u << nBits) - 1); - - label indexInLabel = i % nElemsPerLabel; - - // Starting bit in int. - label startBit = nBits*indexInLabel; - - unsigned int& elem = List<unsigned int>::operator[](intIndex(i)); + label startBit; + unsigned int& elem = List<unsigned int>::operator[] + ( + location(i, startBit) + ); - return ::Foam::reference(elem, mask, startBit); + return ::Foam::PackedBitRef(elem, startBit, max_value()); } diff --git a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.C b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.C index e8d9099d8d9e79bb3b87b5f14bdf4c70e4e0d304..4cf3d54ebbd6fc214c3d5e24f9283af54d6df4a6 100644 --- a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.C +++ b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.C @@ -73,11 +73,10 @@ void Foam::syncTools::checkTransform // Determines for every point whether it is coupled and if so sets only one. -Foam::PackedList<1> Foam::syncTools::getMasterPoints(const polyMesh& mesh) +Foam::PackedBoolList Foam::syncTools::getMasterPoints(const polyMesh& mesh) { - PackedList<1> isMasterPoint(mesh.nPoints(), 0); - - PackedList<1> donePoint(mesh.nPoints(), 0); + PackedBoolList isMasterPoint(mesh.nPoints(), 0); + PackedBoolList donePoint(mesh.nPoints(), 0); // Do multiple shared points. Min. proc is master @@ -194,11 +193,10 @@ Foam::PackedList<1> Foam::syncTools::getMasterPoints(const polyMesh& mesh) // Determines for every edge whether it is coupled and if so sets only one. -Foam::PackedList<1> Foam::syncTools::getMasterEdges(const polyMesh& mesh) +Foam::PackedBoolList Foam::syncTools::getMasterEdges(const polyMesh& mesh) { - PackedList<1> isMasterEdge(mesh.nEdges(), 0); - - PackedList<1> doneEdge(mesh.nEdges(), 0); + PackedBoolList isMasterEdge(mesh.nEdges(), 0); + PackedBoolList doneEdge(mesh.nEdges(), 0); // Do multiple shared edges. Min. proc is master @@ -315,9 +313,9 @@ Foam::PackedList<1> Foam::syncTools::getMasterEdges(const polyMesh& mesh) // Determines for every face whether it is coupled and if so sets only one. -Foam::PackedList<1> Foam::syncTools::getMasterFaces(const polyMesh& mesh) +Foam::PackedBoolList Foam::syncTools::getMasterFaces(const polyMesh& mesh) { - PackedList<1> isMasterFace(mesh.nFaces(), 1); + PackedBoolList isMasterFace(mesh.nFaces(), 1); const polyBoundaryMesh& patches = mesh.boundaryMesh(); diff --git a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H index cd8c9ba3489fc11a6c6413bf4476776737d813a5..8841fe9870f37fb5406a01bb5ed5ba9c0ee9e16e 100644 --- a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H +++ b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H @@ -28,7 +28,7 @@ Class Description Various tools to aid synchronizing lists across coupled patches. - Require + Require - combineOperator (e.g. sumEqOp - not sumOp!) that is defined for the type and combineReduce(UList\<T\>, combineOperator) should be defined. - null value which gets overridden by any valid value. @@ -51,7 +51,7 @@ SourceFiles #include "transformList.H" #include "Map.H" #include "EdgeMap.H" -#include "PackedList.H" +#include "PackedBoolList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -259,13 +259,13 @@ public: // Other //- Get per point whether is it master (of a coupled set of points) - static PackedList<1> getMasterPoints(const polyMesh&); + static PackedBoolList getMasterPoints(const polyMesh&); //- Get per edge whether is it master (of a coupled set of edges) - static PackedList<1> getMasterEdges(const polyMesh&); + static PackedBoolList getMasterEdges(const polyMesh&); //- Get per face whether is it master (of a coupled set of faces) - static PackedList<1> getMasterFaces(const polyMesh&); + static PackedBoolList getMasterFaces(const polyMesh&); }; diff --git a/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C b/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C index eac0ba024023b19708f4ae70865d4ae5ad15a734..acca055b61ef5226207eee78903745b6b92cda43 100644 --- a/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C +++ b/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C @@ -1203,7 +1203,7 @@ void Foam::syncTools::syncEdgeList const labelList& meshEdges = procPatch.meshEdges(); // Receive from neighbour. Is per patch edge the region of the - // neighbouring patch edge. + // neighbouring patch edge. List<T> nbrPatchInfo(procPatch.nEdges()); { @@ -1402,7 +1402,7 @@ void Foam::syncTools::syncBoundaryFaceList else { OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo()); - toNbr << + toNbr << SubList<T>(faceValues, procPatch.size(), patchStart); } } @@ -1683,7 +1683,7 @@ void Foam::syncTools::syncFaceList cop(t, val1); faceValues.set(meshFace0, t); - cop(val1, val0); + cop(val1, val0); faceValues.set(meshFace1, val1); } } diff --git a/src/OpenFOAM/primitives/Lists/PackedBoolList.H b/src/OpenFOAM/primitives/Lists/PackedBoolList.H new file mode 100644 index 0000000000000000000000000000000000000000..84d99561362dec03dbeecaf34154f9f97ba3e686 --- /dev/null +++ b/src/OpenFOAM/primitives/Lists/PackedBoolList.H @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 + +Typedef + Foam::PackedBoolList + +Description + A bit-packed bool list + +\*---------------------------------------------------------------------------*/ + +#ifndef PackedBoolList_H +#define PackedBoolList_H + +#include "bool.H" +#include "PackedList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef PackedList<1> PackedBoolList; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.H b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.H index 1aae76626c7fcbd5ecf43479ef4c5517df1e8f96..41662df8c92b42f1d66a5466e76fe18cd884b3ee 100644 --- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.H +++ b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.H @@ -370,7 +370,7 @@ class autoLayerDriver static void averageNeighbours ( const polyMesh& mesh, - const PackedList<1>& isMasterEdge, + const PackedBoolList& isMasterEdge, const labelList& meshEdges, const labelList& meshPoints, const edgeList& edges, @@ -382,7 +382,7 @@ class autoLayerDriver //- Calculate inverse sum of edge weights (currently always 1.0) void sumWeights ( - const PackedList<1>& isMasterEdge, + const PackedBoolList& isMasterEdge, const labelList& meshEdges, const labelList& meshPoints, const edgeList& edges, @@ -393,7 +393,7 @@ class autoLayerDriver void smoothField ( const motionSmoother& meshMover, - const PackedList<1>& isMasterEdge, + const PackedBoolList& isMasterEdge, const labelList& meshEdges, const scalarField& fieldMin, const label& nSmoothDisp, @@ -404,7 +404,7 @@ class autoLayerDriver void smoothPatchNormals ( const motionSmoother& meshMover, - const PackedList<1>& isMasterEdge, + const PackedBoolList& isMasterEdge, const labelList& meshEdges, const label nSmoothDisp, pointField& normals @@ -414,7 +414,7 @@ class autoLayerDriver void smoothNormals ( const label nSmoothDisp, - const PackedList<1>& isMasterEdge, + const PackedBoolList& isMasterEdge, const labelList& fixedPoints, pointVectorField& normals ) const; @@ -444,7 +444,7 @@ class autoLayerDriver void findIsolatedRegions ( const indirectPrimitivePatch& pp, - const PackedList<1>& isMasterEdge, + const PackedBoolList& isMasterEdge, const labelList& meshEdges, const scalar minCosLayerTermination, scalarField& field, diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C index 81524c71fae4faa9c4721687e02130ebac032a93..615978a308a973f611bf8455a822a81c57cbc392 100644 --- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C +++ b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C @@ -43,7 +43,7 @@ Description // Calculate inverse sum of edge weights (currently always 1.0) void Foam::autoLayerDriver::sumWeights ( - const PackedList<1>& isMasterEdge, + const PackedBoolList& isMasterEdge, const labelList& meshEdges, const labelList& meshPoints, const edgeList& edges, @@ -91,7 +91,7 @@ void Foam::autoLayerDriver::sumWeights void Foam::autoLayerDriver::smoothField ( const motionSmoother& meshMover, - const PackedList<1>& isMasterEdge, + const PackedBoolList& isMasterEdge, const labelList& meshEdges, const scalarField& fieldMin, const label& nSmoothDisp, @@ -163,7 +163,7 @@ void Foam::autoLayerDriver::smoothField void Foam::autoLayerDriver::smoothPatchNormals ( const motionSmoother& meshMover, - const PackedList<1>& isMasterEdge, + const PackedBoolList& isMasterEdge, const labelList& meshEdges, const label nSmoothDisp, pointField& normals @@ -228,7 +228,7 @@ void Foam::autoLayerDriver::smoothPatchNormals void Foam::autoLayerDriver::smoothNormals ( const label nSmoothDisp, - const PackedList<1>& isMasterEdge, + const PackedBoolList& isMasterEdge, const labelList& fixedPoints, pointVectorField& normals ) const @@ -240,7 +240,7 @@ void Foam::autoLayerDriver::smoothNormals const edgeList& edges = mesh.edges(); // Points that do not change. - PackedList<1> isFixedPoint(mesh.nPoints(), 0); + PackedBoolList isFixedPoint(mesh.nPoints(), 0); // Internal points that are fixed forAll(fixedPoints, i) @@ -452,7 +452,7 @@ void Foam::autoLayerDriver::handleFeatureAngleLayerTerminations void Foam::autoLayerDriver::findIsolatedRegions ( const indirectPrimitivePatch& pp, - const PackedList<1>& isMasterEdge, + const PackedBoolList& isMasterEdge, const labelList& meshEdges, const scalar minCosLayerTermination, scalarField& field, @@ -684,7 +684,7 @@ void Foam::autoLayerDriver::medialAxisSmoothingInfo // ~~~~~~~~~~~~~~~~~~~~~~~ // Precalulate master edge (only relevant for shared edges) - PackedList<1> isMasterEdge(syncTools::getMasterEdges(mesh)); + PackedBoolList isMasterEdge(syncTools::getMasterEdges(mesh)); // Precalculate meshEdge per pp edge labelList meshEdges(pp.nEdges()); @@ -979,7 +979,7 @@ void Foam::autoLayerDriver::shrinkMeshMedialDistance const labelList& meshPoints = pp.meshPoints(); // Precalulate master edge (only relevant for shared edges) - PackedList<1> isMasterEdge(syncTools::getMasterEdges(mesh)); + PackedBoolList isMasterEdge(syncTools::getMasterEdges(mesh)); // Precalculate meshEdge per pp edge labelList meshEdges(pp.nEdges()); diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverTemplates.C b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverTemplates.C index 88fa627eac7c9918f2ad288895428b31da20a48b..7c4e8386fb599e4f502bb0fb93cfa6dc99ad61bc 100644 --- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverTemplates.C +++ b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverTemplates.C @@ -33,7 +33,7 @@ template<class Type> void Foam::autoLayerDriver::averageNeighbours ( const polyMesh& mesh, - const PackedList<1>& isMasterEdge, + const PackedBoolList& isMasterEdge, const labelList& meshEdges, const labelList& meshPoints, const edgeList& edges, diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C index a4cd0a504dd35d54f619fb1080b904de0386930d..0c6655862c911bb7785d548d14b692d763e24995 100644 --- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C +++ b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C @@ -153,12 +153,12 @@ Foam::Map<Foam::label> Foam::autoSnapDriver::getZoneBafflePatches // Calculate geometrically collocated points, Requires PackedList to be -// sizes and initalised! +// sized and initalised! Foam::label Foam::autoSnapDriver::getCollocatedPoints ( const scalar tol, const pointField& points, - PackedList<1>& isCollocatedPoint + PackedBoolList& isCollocatedPoint ) { labelList pointMap; @@ -225,7 +225,7 @@ Foam::pointField Foam::autoSnapDriver::smoothPatchDisplacement const indirectPrimitivePatch& pp = meshMover.patch(); // Calculate geometrically non-manifold points on the patch to be moved. - PackedList<1> nonManifoldPoint(pp.nPoints()); + PackedBoolList nonManifoldPoint(pp.nPoints()); label nNonManifoldPoints = getCollocatedPoints ( SMALL, @@ -255,7 +255,7 @@ Foam::pointField Foam::autoSnapDriver::smoothPatchDisplacement const polyMesh& mesh = meshMover.mesh(); // Get labels of faces to count (master of coupled faces and baffle pairs) - PackedList<1> isMasterFace(syncTools::getMasterFaces(mesh)); + PackedBoolList isMasterFace(syncTools::getMasterFaces(mesh)); { forAll(baffles, i) @@ -1374,7 +1374,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::autoSnapDriver::repatchToSurface // Faces that do not move - PackedList<1> isZonedFace(mesh.nFaces(), 0); + PackedBoolList isZonedFace(mesh.nFaces(), 0); { // 1. All faces on zoned surfaces const wordList& faceZoneNames = surfaces.faceZoneNames(); diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H index 18afdc46d36e515436bcd8bb2daae27f4326f714..b2d0f28911b42720e751929687e016868a0e3972 100644 --- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H +++ b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H @@ -95,7 +95,7 @@ class autoSnapDriver ( const scalar tol, const pointField&, - PackedList<1>& + PackedBoolList& ); //- Calculate displacement per patch point to smooth out patch. diff --git a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C b/src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C index 4b10b84763ade9dd403aed308ec5534710d20516..6a021f9e8a75d0628a811eefa3623f8c77c8b767 100644 --- a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C +++ b/src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C @@ -126,7 +126,7 @@ void Foam::meshRefinement::updateIntersections(const labelList& changedFaces) const pointField& cellCentres = mesh_.cellCentres(); // Stats on edges to test. Count proc faces only once. - PackedList<1> isMasterFace(syncTools::getMasterFaces(mesh_)); + PackedBoolList isMasterFace(syncTools::getMasterFaces(mesh_)); { label nMasterFaces = 0; @@ -865,7 +865,7 @@ Foam::meshRefinement::meshRefinement Foam::label Foam::meshRefinement::countHits() const { // Stats on edges to test. Count proc faces only once. - PackedList<1> isMasterFace(syncTools::getMasterFaces(mesh_)); + PackedBoolList isMasterFace(syncTools::getMasterFaces(mesh_)); label nHits = 0; @@ -1201,7 +1201,7 @@ Foam::labelList Foam::meshRefinement::intersectedPoints const faceList& faces = mesh_.faces(); // Mark all points on faces that will become baffles - PackedList<1> isBoundaryPoint(mesh_.nPoints(), 0u); + PackedBoolList isBoundaryPoint(mesh_.nPoints(), 0u); label nBoundaryPoints = 0; forAll(surfaceIndex_, faceI) diff --git a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C b/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C index fd5a7bdffa919c00ac4906df1ad93bd7f1930c9c..859c76020c0d7f7e751b226209d0c31d7bc4438f 100644 --- a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C +++ b/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C @@ -431,7 +431,7 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells // point will only have 4 cells connected to it) // Does cell have exactly 7 of its 8 anchor points on the boundary? - PackedList<1> hasSevenBoundaryAnchorPoints(mesh_.nCells(), 0u); + PackedBoolList hasSevenBoundaryAnchorPoints(mesh_.nCells()); // If so what is the remaining non-boundary anchor point? labelHashSet nonBoundaryAnchors(mesh_.nCells()/10000); @@ -727,7 +727,7 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCellsGeometric hitSurface, hitInfo ); - + forAll(hitInfo, i) { if (hitInfo[i].hit()) diff --git a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C b/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C index 446da0956d4de93d73bfe08a6c8a45c75979fd9b..24c7819d8d6b50ec92b4b8d6ccd97bc0356f7d1c 100644 --- a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C +++ b/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C @@ -68,7 +68,7 @@ Foam::labelList Foam::meshRefinement::getChangedFaces const label nInternalFaces = mesh.nInternalFaces(); // Mark refined cells on old mesh - PackedList<1> oldRefineCell(map.nOldCells(), 0u); + PackedBoolList oldRefineCell(map.nOldCells()); forAll(oldCellsToRefine, i) { @@ -76,7 +76,7 @@ Foam::labelList Foam::meshRefinement::getChangedFaces } // Mark refined faces - PackedList<1> refinedInternalFace(nInternalFaces, 0u); + PackedBoolList refinedInternalFace(nInternalFaces); // 1. Internal faces @@ -335,7 +335,7 @@ Foam::label Foam::meshRefinement::markFeatureRefinement maxFeatureLevel = -1; // Whether edge has been visited. - List<PackedList<1> > featureEdgeVisited(featureMeshes.size()); + List<PackedBoolList> featureEdgeVisited(featureMeshes.size()); forAll(featureMeshes, featI) { diff --git a/src/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.H b/src/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.H index e9adef8e5f4f9be17097b3ba65d12a395d4b17b8..2c6fbbe8f2bd52053bfe97c7040f834241a1998a 100644 --- a/src/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.H +++ b/src/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.H @@ -38,7 +38,7 @@ SourceFiles #ifndef refinementSurfaces_H #define refinementSurfaces_H -#include "PackedList.H" +#include "PackedBoolList.H" #include "triSurfaceGeoMesh.H" #include "triSurfaceFields.H" #include "vectorList.H" diff --git a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C index 2cb639cb63d623b708cd958cef67537515a1aef3..1eee295db09383c882af43763dc9978453e7178c 100644 --- a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C +++ b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C @@ -47,7 +47,7 @@ addToRunTimeSelectionTable(dynamicFvMesh, dynamicRefineFvMesh, IOobject); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -label dynamicRefineFvMesh::count(const PackedList<1>& l, const unsigned int val) +label dynamicRefineFvMesh::count(const PackedBoolList& l, const unsigned int val) { label n = 0; forAll(l, i) @@ -63,7 +63,7 @@ label dynamicRefineFvMesh::count(const PackedList<1>& l, const unsigned int val) void dynamicRefineFvMesh::calculateProtectedCells ( - PackedList<1>& unrefineableCell + PackedBoolList& unrefineableCell ) const { if (protectedCell_.empty()) @@ -385,7 +385,7 @@ autoPtr<mapPolyMesh> dynamicRefineFvMesh::refine // Update numbering of protectedCell_ if (protectedCell_.size()) { - PackedList<1> newProtectedCell(nCells(), 0); + PackedBoolList newProtectedCell(nCells()); forAll(newProtectedCell, cellI) { @@ -538,7 +538,7 @@ autoPtr<mapPolyMesh> dynamicRefineFvMesh::unrefine // Update numbering of protectedCell_ if (protectedCell_.size()) { - PackedList<1> newProtectedCell(nCells(), 0); + PackedBoolList newProtectedCell(nCells()); forAll(newProtectedCell, cellI) { @@ -642,7 +642,7 @@ void dynamicRefineFvMesh::selectRefineCandidates const scalar lowerRefineLevel, const scalar upperRefineLevel, const scalarField& vFld, - PackedList<1>& candidateCell + PackedBoolList& candidateCell ) const { // Get error per cell. Is -1 (not to be refined) to >0 (to be refined, @@ -675,7 +675,7 @@ labelList dynamicRefineFvMesh::selectRefineCells ( const label maxCells, const label maxRefinement, - const PackedList<1>& candidateCell + const PackedBoolList& candidateCell ) const { // Every refined cell causes 7 extra cells @@ -685,7 +685,7 @@ labelList dynamicRefineFvMesh::selectRefineCells // Mark cells that cannot be refined since they would trigger refinement // of protected cells (since 2:1 cascade) - PackedList<1> unrefineableCell; + PackedBoolList unrefineableCell; calculateProtectedCells(unrefineableCell); // Count current selection @@ -761,7 +761,7 @@ labelList dynamicRefineFvMesh::selectRefineCells labelList dynamicRefineFvMesh::selectUnrefinePoints ( const scalar unrefineLevel, - const PackedList<1>& markedCell, + const PackedBoolList& markedCell, const scalarField& pFld ) const { @@ -818,7 +818,7 @@ labelList dynamicRefineFvMesh::selectUnrefinePoints } -void dynamicRefineFvMesh::extendMarkedCells(PackedList<1>& markedCell) const +void dynamicRefineFvMesh::extendMarkedCells(PackedBoolList& markedCell) const { // Mark faces using any marked cell boolList markedFace(nFaces(), false); @@ -1078,7 +1078,7 @@ bool dynamicRefineFvMesh::update() readLabel(refineDict.lookup("nBufferLayers")); // Cells marked for refinement or otherwise protected from unrefinement. - PackedList<1> refineCell(nCells(), 0); + PackedBoolList refineCell(nCells()); if (globalData().nTotalCells() < maxCells) { @@ -1119,7 +1119,7 @@ bool dynamicRefineFvMesh::update() const labelList& cellMap = map().cellMap(); const labelList& reverseCellMap = map().reverseCellMap(); - PackedList<1> newRefineCell(cellMap.size()); + PackedBoolList newRefineCell(cellMap.size()); forAll(cellMap, cellI) { diff --git a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.H b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.H index fbde240a0c0a8f4457b577bf13f4e130a8290160..f8bf0ec3e9b8245182e4922c91723c67a65ba301 100644 --- a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.H +++ b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.H @@ -40,7 +40,7 @@ SourceFiles #include "dynamicFvMesh.H" #include "hexRef8.H" -#include "PackedList.H" +#include "PackedBoolList.H" #include "Switch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -71,17 +71,17 @@ protected: label nRefinementIterations_; //- Protected cells (usually since not hexes) - PackedList<1> protectedCell_; + PackedBoolList protectedCell_; // Private Member Functions //- Count set/unset elements in packedlist. - static label count(const PackedList<1>&, const unsigned int); + static label count(const PackedBoolList&, const unsigned int); //- Calculate cells that cannot be refined since would trigger // refinement of protectedCell_ (since 2:1 refinement cascade) - void calculateProtectedCells(PackedList<1>& unrefineableCell) const; + void calculateProtectedCells(PackedBoolList& unrefineableCell) const; //- Read the projection parameters from dictionary void readDict(); @@ -127,7 +127,7 @@ protected: const scalar lowerRefineLevel, const scalar upperRefineLevel, const scalarField& vFld, - PackedList<1>& candidateCell + PackedBoolList& candidateCell ) const; //- Subset candidate cells for refinement @@ -135,19 +135,19 @@ protected: ( const label maxCells, const label maxRefinement, - const PackedList<1>& candidateCell + const PackedBoolList& candidateCell ) const; //- Select points that can be unrefined. virtual labelList selectUnrefinePoints ( const scalar unrefineLevel, - const PackedList<1>& markedCell, + const PackedBoolList& markedCell, const scalarField& pFld ) const; //- Extend markedCell with cell-face-cell. - void extendMarkedCells(PackedList<1>& markedCell) const; + void extendMarkedCells(PackedBoolList& markedCell) const; private: @@ -184,13 +184,13 @@ public: } //- Cells which should not be refined/unrefined - const PackedList<1>& protectedCell() const + const PackedBoolList& protectedCell() const { return protectedCell_; } //- Cells which should not be refined/unrefined - PackedList<1>& protectedCell() + PackedBoolList& protectedCell() { return protectedCell_; } diff --git a/src/dynamicMesh/motionSmoother/motionSmoother.C b/src/dynamicMesh/motionSmoother/motionSmoother.C index 5307352302ffd0001f8240139ed237d23358bf09..18f5c85478e301085d49ca0eb05980d00a96e333 100644 --- a/src/dynamicMesh/motionSmoother/motionSmoother.C +++ b/src/dynamicMesh/motionSmoother/motionSmoother.C @@ -130,10 +130,10 @@ void Foam::motionSmoother::makePatchPatchAddressing() { if (patchPatchPointConstraints[i].first() != 0) { - patchPatchPointConstraintPoints_[nConstraints] = + patchPatchPointConstraintPoints_[nConstraints] = patchPatchPoints[i]; - patchPatchPointConstraintTensors_[nConstraints] = + patchPatchPointConstraintTensors_[nConstraints] = patchPatchPointConstraints[i].constraintTransformation(); nConstraints++; @@ -206,7 +206,7 @@ Foam::labelHashSet Foam::motionSmoother::getPoints // Smooth on selected points (usually patch points) void Foam::motionSmoother::minSmooth ( - const PackedList<1>& isAffectedPoint, + const PackedBoolList& isAffectedPoint, const labelList& meshPoints, const pointScalarField& fld, pointScalarField& newFld @@ -241,7 +241,7 @@ void Foam::motionSmoother::minSmooth // Smooth on all internal points void Foam::motionSmoother::minSmooth ( - const PackedList<1>& isAffectedPoint, + const PackedBoolList& isAffectedPoint, const pointScalarField& fld, pointScalarField& newFld ) const @@ -324,7 +324,7 @@ void Foam::motionSmoother::getAffectedFacesAndPoints const faceSet& wrongFaces, labelList& affectedFaces, - PackedList<1>& isAffectedPoint + PackedBoolList& isAffectedPoint ) const { isAffectedPoint.setSize(mesh_.nPoints()); @@ -763,7 +763,7 @@ Foam::tmp<Foam::scalarField> Foam::motionSmoother::movePoints // Correct tangentially twoDCorrector_.correctPoints(newPoints); Info<< " ...done" << endl; - } + } if (debug) { @@ -846,7 +846,7 @@ bool Foam::motionSmoother::scaleMesh { if (patches[patchI].coupled()) { - const coupledPolyPatch& pp = + const coupledPolyPatch& pp = refCast<const coupledPolyPatch>(patches[patchI]); Pout<< '\t' << patchI << '\t' << pp.name() @@ -976,7 +976,7 @@ bool Foam::motionSmoother::scaleMesh // Grow a few layers to determine // - points to be smoothed // - faces to be checked in next iteration - PackedList<1> isAffectedPoint(mesh_.nPoints(), 0); + PackedBoolList isAffectedPoint(mesh_.nPoints()); getAffectedFacesAndPoints ( nSmoothScale, // smoothing iterations @@ -1035,7 +1035,7 @@ bool Foam::motionSmoother::scaleMesh -GREAT, // null value false // no separation ); - + if (debug) { diff --git a/src/dynamicMesh/motionSmoother/motionSmoother.H b/src/dynamicMesh/motionSmoother/motionSmoother.H index e5b35040acfd2c204931975a5ece13bcf7eaeaa8..e5777a366459e75bde147a3e7e420a719ea3a361 100644 --- a/src/dynamicMesh/motionSmoother/motionSmoother.H +++ b/src/dynamicMesh/motionSmoother/motionSmoother.H @@ -76,7 +76,7 @@ SourceFiles #include "pointFields.H" #include "HashSet.H" -#include "PackedList.H" +#include "PackedBoolList.H" #include "indirectPrimitivePatch.H" #include "className.H" #include "twoDPointCorrector.H" @@ -159,11 +159,11 @@ class motionSmoother pointField oldPoints_; //- Is mesh point on boundary or not - PackedList<1> isInternalPoint_; + PackedBoolList isInternalPoint_; //- Is edge master (always except if on coupled boundary and on // lower processor) - PackedList<1> isMasterEdge_; + PackedBoolList isMasterEdge_; //- 2-D motion corrector twoDPointCorrector twoDCorrector_; @@ -220,7 +220,7 @@ class motionSmoother //- explicit smoothing and min on all affected internal points void minSmooth ( - const PackedList<1>& isAffectedPoint, + const PackedBoolList& isAffectedPoint, const pointScalarField& fld, pointScalarField& newFld ) const; @@ -228,7 +228,7 @@ class motionSmoother //- same but only on selected points (usually patch points) void minSmooth ( - const PackedList<1>& isAffectedPoint, + const PackedBoolList& isAffectedPoint, const labelList& meshPoints, const pointScalarField& fld, pointScalarField& newFld @@ -264,7 +264,7 @@ class motionSmoother const faceSet& wrongFaces, labelList& affectedFaces, - PackedList<1>& isAffectedPoint + PackedBoolList& isAffectedPoint ) const; //- Disallow default bitwise copy construct diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C index 6015f1b64a00a3f9601bc55f496c4e44b29e4ebb..b3902762ef62c25821eb2d90081b672ea4443427 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C @@ -56,7 +56,7 @@ Foam::labelListList Foam::addPatchCellLayer::calcGlobalEdgeFaces //// Determine coupled edges just so we don't have to have storage //// for all non-coupled edges. // - //PackedList<1> isCoupledEdge(mesh.nEdges(), 0); + //PackedBoolList isCoupledEdge(mesh.nEdges()); // //const polyBoundaryMesh& patches = mesh.boundaryMesh(); // diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C index fa5ae3ae9d5fae369303360c4e592b0516cda7fb..8b00bb93d6a6f5c43783d185b7a4b278fb07b8b7 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C @@ -1554,7 +1554,7 @@ void Foam::hexRef8::walkFaceFromMid Foam::label Foam::hexRef8::faceConsistentRefinement ( const bool maxSet, - PackedList<1>& refineCell + PackedBoolList& refineCell ) const { label nChanged = 0; @@ -1643,7 +1643,7 @@ void Foam::hexRef8::checkWantedRefinementLevels const labelList& cellsToRefine ) const { - PackedList<1> refineCell(mesh_.nCells(), 0); + PackedBoolList refineCell(mesh_.nCells()); forAll(cellsToRefine, i) { refineCell.set(cellsToRefine[i], 1); @@ -2028,7 +2028,7 @@ Foam::labelList Foam::hexRef8::consistentRefinement // maxSet = true : select cells to refine // Go to straight boolList. - PackedList<1> refineCell(mesh_.nCells(), 0); + PackedBoolList refineCell(mesh_.nCells()); forAll(cellsToRefine, i) { refineCell.set(cellsToRefine[i], 1); @@ -2876,7 +2876,7 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement2 // 2. Extend to 2:1. I don't understand yet why this is not done // 2. Extend to 2:1. For non-cube cells the scalar distance does not work // so make sure it at least provides 2:1. - PackedList<1> refineCell(mesh_.nCells(), 0); + PackedBoolList refineCell(mesh_.nCells()); forAll(allCellInfo, cellI) { label wanted = allCellInfo[cellI].wantedLevel(cc[cellI]); @@ -2953,12 +2953,12 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement2 } // Extend to 2:1 - PackedList<1> refineCell(mesh_.nCells(), 0); + PackedBoolList refineCell(mesh_.nCells()); forAll(newCellsToRefine, i) { refineCell.set(newCellsToRefine[i], 1); } - const PackedList<1> savedRefineCell(refineCell); + const PackedBoolList savedRefineCell(refineCell); label nChanged = faceConsistentRefinement(true, refineCell); @@ -3583,7 +3583,7 @@ Foam::labelListList Foam::hexRef8::setRefinement } // Get all affected faces. - PackedList<1> affectedFace(mesh_.nFaces(), 0); + PackedBoolList affectedFace(mesh_.nFaces()); { forAll(cellMidPoint, cellI) @@ -5084,7 +5084,7 @@ Foam::labelList Foam::hexRef8::consistentUnrefinement // maxSet = true: select points to refine // Maintain boolList for pointsToUnrefine and cellsToUnrefine - PackedList<1> unrefinePoint(mesh_.nPoints(), 0); + PackedBoolList unrefinePoint(mesh_.nPoints()); forAll(pointsToUnrefine, i) { @@ -5099,7 +5099,7 @@ Foam::labelList Foam::hexRef8::consistentUnrefinement // Construct cells to unrefine // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ - PackedList<1> unrefineCell(mesh_.nCells(), 0); + PackedBoolList unrefineCell(mesh_.nCells()); forAll(unrefinePoint, pointI) { diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.H index fff6d1b44a85a431f3efed4732832d0b519d0a32..71bfdbe92816ee196930ebe8505b4409ceda0608 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.H @@ -43,7 +43,7 @@ SourceFiles #include "primitivePatch.H" #include "removeFaces.H" #include "refinementHistory.H" -#include "PackedList.H" +#include "PackedBoolList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -298,7 +298,7 @@ class hexRef8 label faceConsistentRefinement ( const bool maxSet, - PackedList<1>& refineCell + PackedBoolList& refineCell ) const; //- Check wanted refinement for 2:1 consistency diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C index 05204fb1b00c4e913a060c6bcde492a0d4bb3612..f317573d8a0bdb8bad9908df187841ad100e3c65 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C @@ -522,7 +522,7 @@ Foam::label Foam::polyTopoChange::getCellOrder SLList<label> nextCell; // Whether cell has been done already - PackedList<1> visited(cellCellAddressing.size(), 0); + PackedBoolList visited(cellCellAddressing.size()); label cellInOrder = 0; diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.H index 819b39fa9d3998b3d13b2ea272ed1f1fa141d6dc..9d0dce468c6cb288b2659587a5a5100931195fb8 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.H @@ -76,7 +76,7 @@ SourceFiles #include "HashSet.H" #include "mapPolyMesh.H" #include "CompactListList.H" -#include "PackedList.H" +#include "PackedBoolList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/meshTools/indexedOctree/treeDataFace.H b/src/meshTools/indexedOctree/treeDataFace.H index 49bffea01d78c616e32d7f984db92db18d4886ad..7db10513e40163e6cf2ba14193fe52fd312cf6ca 100644 --- a/src/meshTools/indexedOctree/treeDataFace.H +++ b/src/meshTools/indexedOctree/treeDataFace.H @@ -39,7 +39,7 @@ SourceFiles #include "face.H" #include "indexedOctree.H" #include "treeBoundBoxList.H" -#include "PackedList.H" +#include "PackedBoolList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -72,7 +72,7 @@ class treeDataFace const labelList faceLabels_; //- Inverse of faceLabels. For every mesh whether face is in faceLabels. - PackedList<1> isTreeFace_; + PackedBoolList isTreeFace_; //- Whether to precalculate and store face bounding box const bool cacheBb_; diff --git a/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C b/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C index 4b14609efa4ffd352d989357ebde1ff9794a233f..0f44333b6ee94313ac77d73f93a2597d4d6a9295 100644 --- a/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C +++ b/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C @@ -31,6 +31,7 @@ License #include "triangleFuncs.H" #include "matchPoints.H" #include "globalIndex.H" +#include "PackedBoolList.H" #include "Time.H" @@ -774,8 +775,7 @@ void Foam::distributedTriSurfaceMesh::calcBounds // Unfortunately nPoints constructs meshPoints() so do compact version // ourselves - PackedList<1> pointIsUsed(points().size()); - pointIsUsed = 0U; + PackedBoolList pointIsUsed(points().size()); nPoints = 0; bb = boundBox::invertedBox; diff --git a/src/sampling/sampledSurface/isoSurface/isoSurface.C b/src/sampling/sampledSurface/isoSurface/isoSurface.C index 3571df4a4972b763b74a3a1fe92be0f0d0641388..e146c90f7a73ea6eb2b4b92d86045118245b8c1c 100644 --- a/src/sampling/sampledSurface/isoSurface/isoSurface.C +++ b/src/sampling/sampledSurface/isoSurface/isoSurface.C @@ -537,7 +537,7 @@ void Foam::isoSurface::calcSnappedCc // to a single point void Foam::isoSurface::calcSnappedPoint ( - const PackedList<1>& isBoundaryPoint, + const PackedBoolList& isBoundaryPoint, const labelList& boundaryRegion, const volScalarField& cVals, const scalarField& pVals, @@ -1382,7 +1382,7 @@ Foam::isoSurface::isoSurface // Determine if point is on boundary. Points on boundaries are never // snapped. Coupled boundaries are handled explicitly so not marked here. - PackedList<1> isBoundaryPoint(mesh_.nPoints()); + PackedBoolList isBoundaryPoint(mesh_.nPoints()); labelList boundaryRegion(mesh_.nFaces()-mesh_.nInternalFaces()); diff --git a/src/sampling/sampledSurface/isoSurface/isoSurface.H b/src/sampling/sampledSurface/isoSurface/isoSurface.H index abe3d51b56c6f09f59a3d5100dd201c7e19eea5e..7dc0588a1c0d0ccb448f5e00e693d09de2dbe721 100644 --- a/src/sampling/sampledSurface/isoSurface/isoSurface.H +++ b/src/sampling/sampledSurface/isoSurface/isoSurface.H @@ -32,7 +32,7 @@ Description Note: - not possible on patches of type 'empty'. There are no values on - 'empty' patch fields so even the api would have to change + 'empty' patch fields so even the api would have to change (no volScalarField as argument). Too messy. - in parallel the regularisation (coarsening) always takes place and slightly different surfaces will be created compared to non-parallel. @@ -56,7 +56,7 @@ SourceFiles #include "triSurface.H" #include "labelPair.H" #include "pointIndexHit.H" -#include "PackedList.H" +#include "PackedBoolList.H" #include "volFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -181,7 +181,7 @@ class isoSurface // point. void calcSnappedPoint ( - const PackedList<1>& isBoundaryPoint, + const PackedBoolList& isBoundaryPoint, const labelList& boundaryRegion, const volScalarField& cVals, const scalarField& pVals, diff --git a/src/sampling/sampledSurface/isoSurface/isoSurfaceCell.C b/src/sampling/sampledSurface/isoSurface/isoSurfaceCell.C index 52398eafa4dd97531dc2db37f3b059c27ebed9d6..542d31a37661f85aa49491d10b78496b74e6891c 100644 --- a/src/sampling/sampledSurface/isoSurface/isoSurfaceCell.C +++ b/src/sampling/sampledSurface/isoSurface/isoSurfaceCell.C @@ -81,7 +81,7 @@ Foam::scalar Foam::isoSurfaceCell::isoFraction Foam::isoSurfaceCell::cellCutType Foam::isoSurfaceCell::calcCutType ( - const PackedList<1>& isTet, + const PackedBoolList& isTet, const scalarField& cellValues, const scalarField& pointValues, const label cellI @@ -203,7 +203,7 @@ Foam::isoSurfaceCell::cellCutType Foam::isoSurfaceCell::calcCutType void Foam::isoSurfaceCell::calcCutTypes ( - const PackedList<1>& isTet, + const PackedBoolList& isTet, const scalarField& cVals, const scalarField& pVals ) @@ -348,7 +348,7 @@ Foam::pointIndexHit Foam::isoSurfaceCell::collapseSurface void Foam::isoSurfaceCell::calcSnappedCc ( - const PackedList<1>& isTet, + const PackedBoolList& isTet, const scalarField& cVals, const scalarField& pVals, @@ -621,8 +621,8 @@ void Foam::isoSurfaceCell::genPointTris void Foam::isoSurfaceCell::calcSnappedPoint ( - const PackedList<1>& isBoundaryPoint, - const PackedList<1>& isTet, + const PackedBoolList& isBoundaryPoint, + const PackedBoolList& isTet, const scalarField& cVals, const scalarField& pVals, @@ -1402,7 +1402,7 @@ Foam::isoSurfaceCell::isoSurfaceCell mergeDistance_(mergeTol*mesh.bounds().mag()) { // Determine if cell is tet - PackedList<1> isTet(mesh_.nCells()); + PackedBoolList isTet(mesh_.nCells()); { tetMatcher tet; @@ -1417,7 +1417,7 @@ Foam::isoSurfaceCell::isoSurfaceCell // Determine if point is on boundary. Points on boundaries are never // snapped. Coupled boundaries are handled explicitly so not marked here. - PackedList<1> isBoundaryPoint(mesh_.nPoints()); + PackedBoolList isBoundaryPoint(mesh_.nPoints()); const polyBoundaryMesh& patches = mesh_.boundaryMesh(); forAll(patches, patchI) { diff --git a/src/sampling/sampledSurface/isoSurface/isoSurfaceCell.H b/src/sampling/sampledSurface/isoSurface/isoSurfaceCell.H index 5acd468473f015a59988e980904bfc0108b6603f..ea96b42b3a75578f81974bf7008dfd266306c60d 100644 --- a/src/sampling/sampledSurface/isoSurface/isoSurfaceCell.H +++ b/src/sampling/sampledSurface/isoSurface/isoSurfaceCell.H @@ -48,7 +48,7 @@ SourceFiles #include "triSurface.H" #include "labelPair.H" #include "pointIndexHit.H" -#include "PackedList.H" +#include "PackedBoolList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -118,7 +118,7 @@ class isoSurfaceCell //- Determine whether cell is cut cellCutType calcCutType ( - const PackedList<1>&, + const PackedBoolList&, const scalarField& cellValues, const scalarField& pointValues, const label @@ -126,7 +126,7 @@ class isoSurfaceCell void calcCutTypes ( - const PackedList<1>&, + const PackedBoolList&, const scalarField& cellValues, const scalarField& pointValues ); @@ -149,7 +149,7 @@ class isoSurfaceCell // point. void calcSnappedCc ( - const PackedList<1>& isTet, + const PackedBoolList& isTet, const scalarField& cVals, const scalarField& pVals, DynamicList<point>& triPoints, @@ -180,8 +180,8 @@ class isoSurfaceCell // point. void calcSnappedPoint ( - const PackedList<1>& isBoundaryPoint, - const PackedList<1>& isTet, + const PackedBoolList& isBoundaryPoint, + const PackedBoolList& isTet, const scalarField& cVals, const scalarField& pVals, DynamicList<point>& triPoints, diff --git a/src/triSurface/triSurface/triSurface.C b/src/triSurface/triSurface/triSurface.C index c7a49263d7a78180adb910b6d6504150b1f4a3f4..e589ec61586a684e335d4135710414004e8960a1 100644 --- a/src/triSurface/triSurface/triSurface.C +++ b/src/triSurface/triSurface/triSurface.C @@ -31,7 +31,7 @@ License #include "Time.H" #include "boundBox.H" #include "SortableList.H" -#include "PackedList.H" +#include "PackedBoolList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -1207,8 +1207,7 @@ void Foam::triSurface::writeStats(Ostream& os) const { // Unfortunately nPoints constructs meshPoints() so do compact version // ourselves. - PackedList<1> pointIsUsed(points().size()); - pointIsUsed = 0U; + PackedBoolList pointIsUsed(points().size()); label nPoints = 0; boundBox bb = boundBox::invertedBox;