added PackedBoolList typedef (used everywhere) and improved PackedList

- new members:  capacity(), two-argument resize()/setSize(), const storage()
- new static members: max_value(), packing(), etc.
This commit is contained in:
Mark Olesen
2009-01-21 11:30:10 +01:00
parent 4da086b141
commit 6d57bb4e7b
40 changed files with 513 additions and 259 deletions

View File

@ -119,7 +119,7 @@ scalar StCoNum = 0.0;
fvc::makeAbsolute(phi, rho, U); fvc::makeAbsolute(phi, rho, U);
// Test : disable refinement for some cells // Test : disable refinement for some cells
PackedList<1>& protectedCell = PackedBoolList& protectedCell =
refCast<dynamicRefineFvMesh>(mesh).protectedCell(); refCast<dynamicRefineFvMesh>(mesh).protectedCell();
if (protectedCell.empty()) if (protectedCell.empty())

View File

@ -0,0 +1,3 @@
PackedListTest.C
EXE = $(FOAM_USER_APPBIN)/PackedListTest

View File

@ -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;
}
// ************************************************************************* //

View File

@ -48,7 +48,7 @@ Description
#include "polyMesh.H" #include "polyMesh.H"
#include "mapPolyMesh.H" #include "mapPolyMesh.H"
#include "mathematicalConstants.H" #include "mathematicalConstants.H"
#include "PackedList.H" #include "PackedBoolList.H"
#include "SortableList.H" #include "SortableList.H"
using namespace Foam; using namespace Foam;
@ -177,7 +177,7 @@ label mergeEdges
// Return master point edge needs to be collapsed to (or -1) // 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; label masterPoint = -1;
@ -215,7 +215,7 @@ label edgeMaster(const PackedList<1>& boundaryPoint, const edge& e)
label collapseSmallEdges label collapseSmallEdges
( (
const polyMesh& mesh, const polyMesh& mesh,
const PackedList<1>& boundaryPoint, const PackedBoolList& boundaryPoint,
const scalar minLen, const scalar minLen,
edgeCollapser& collapser edgeCollapser& collapser
) )
@ -254,7 +254,7 @@ label collapseSmallEdges
label collapseHighAspectFaces label collapseHighAspectFaces
( (
const polyMesh& mesh, const polyMesh& mesh,
const PackedList<1>& boundaryPoint, const PackedBoolList& boundaryPoint,
const scalar areaFac, const scalar areaFac,
const scalar edgeRatio, const scalar edgeRatio,
edgeCollapser& collapser edgeCollapser& collapser
@ -346,7 +346,7 @@ void set(const labelList& elems, const bool val, boolList& status)
label simplifyFaces label simplifyFaces
( (
const polyMesh& mesh, const polyMesh& mesh,
const PackedList<1>& boundaryPoint, const PackedBoolList& boundaryPoint,
const label minSize, const label minSize,
const scalar lenGap, const scalar lenGap,
edgeCollapser& collapser edgeCollapser& collapser
@ -485,7 +485,7 @@ int main(int argc, char *argv[])
const faceList& faces = mesh.faces(); const faceList& faces = mesh.faces();
// Get all points on the boundary // Get all points on the boundary
PackedList<1> boundaryPoint(mesh.nPoints(), false); PackedBoolList boundaryPoint(mesh.nPoints());
label nIntFaces = mesh.nInternalFaces(); label nIntFaces = mesh.nInternalFaces();
for (label faceI = nIntFaces; faceI < mesh.nFaces(); faceI++) for (label faceI = nIntFaces; faceI < mesh.nFaces(); faceI++)

View File

@ -49,7 +49,7 @@ Description
#include "mathematicalConstants.H" #include "mathematicalConstants.H"
#include "polyTopoChange.H" #include "polyTopoChange.H"
#include "mapPolyMesh.H" #include "mapPolyMesh.H"
#include "PackedList.H" #include "PackedBoolList.H"
#include "meshTools.H" #include "meshTools.H"
#include "OFstream.H" #include "OFstream.H"
#include "meshDualiser.H" #include "meshDualiser.H"
@ -67,7 +67,7 @@ using namespace Foam;
void simpleMarkFeatures void simpleMarkFeatures
( (
const polyMesh& mesh, const polyMesh& mesh,
const PackedList<1>& isBoundaryEdge, const PackedBoolList& isBoundaryEdge,
const scalar featureAngle, const scalar featureAngle,
const bool doNotPreserveFaceZones, const bool doNotPreserveFaceZones,
@ -358,7 +358,7 @@ int main(int argc, char *argv[])
// Mark boundary edges and points. // Mark boundary edges and points.
// (Note: in 1.4.2 we can use the built-in mesh point ordering // (Note: in 1.4.2 we can use the built-in mesh point ordering
// facility instead) // facility instead)
PackedList<1> isBoundaryEdge(mesh.nEdges()); PackedBoolList isBoundaryEdge(mesh.nEdges());
for (label faceI = mesh.nInternalFaces(); faceI < mesh.nFaces(); faceI++) for (label faceI = mesh.nInternalFaces(); faceI < mesh.nFaces(); faceI++)
{ {
const labelList& fEdges = mesh.faceEdges()[faceI]; const labelList& fEdges = mesh.faceEdges()[faceI];

View File

@ -155,7 +155,7 @@ Foam::label Foam::meshDualiser::findDualCell
// from (boundary & feature) point // from (boundary & feature) point
void Foam::meshDualiser::generateDualBoundaryEdges void Foam::meshDualiser::generateDualBoundaryEdges
( (
const PackedList<1>& isBoundaryEdge, const PackedBoolList& isBoundaryEdge,
const label pointI, const label pointI,
polyTopoChange& meshMod polyTopoChange& meshMod
) )
@ -388,7 +388,7 @@ Foam::label Foam::meshDualiser::addBoundaryFace
void Foam::meshDualiser::createFacesAroundEdge void Foam::meshDualiser::createFacesAroundEdge
( (
const bool splitFace, const bool splitFace,
const PackedList<1>& isBoundaryEdge, const PackedBoolList& isBoundaryEdge,
const label edgeI, const label edgeI,
const label startFaceI, const label startFaceI,
polyTopoChange& meshMod, polyTopoChange& meshMod,
@ -907,7 +907,7 @@ void Foam::meshDualiser::setRefinement
// Mark boundary edges and points. // Mark boundary edges and points.
// (Note: in 1.4.2 we can use the built-in mesh point ordering // (Note: in 1.4.2 we can use the built-in mesh point ordering
// facility instead) // facility instead)
PackedList<1> isBoundaryEdge(mesh_.nEdges()); PackedBoolList isBoundaryEdge(mesh_.nEdges());
for (label faceI = mesh_.nInternalFaces(); faceI < mesh_.nFaces(); faceI++) for (label faceI = mesh_.nInternalFaces(); faceI < mesh_.nFaces(); faceI++)
{ {
const labelList& fEdges = mesh_.faceEdges()[faceI]; const labelList& fEdges = mesh_.faceEdges()[faceI];

View File

@ -49,7 +49,7 @@ SourceFiles
#define meshDualiser_H #define meshDualiser_H
#include "DynamicList.H" #include "DynamicList.H"
#include "PackedList.H" #include "PackedBoolList.H"
#include "boolList.H" #include "boolList.H"
#include "typeInfo.H" #include "typeInfo.H"
@ -101,7 +101,7 @@ class meshDualiser
// emanating from (boundary & feature) point // emanating from (boundary & feature) point
void generateDualBoundaryEdges void generateDualBoundaryEdges
( (
const PackedList<1>&, const PackedBoolList&,
const label pointI, const label pointI,
polyTopoChange& polyTopoChange&
); );
@ -144,7 +144,7 @@ class meshDualiser
void createFacesAroundEdge void createFacesAroundEdge
( (
const bool splitFace, const bool splitFace,
const PackedList<1>&, const PackedBoolList&,
const label edgeI, const label edgeI,
const label startFaceI, const label startFaceI,
polyTopoChange&, polyTopoChange&,

View File

@ -31,7 +31,7 @@ License
template<int nBits> template<int nBits>
Foam::PackedList<nBits>::PackedList(const label size, const unsigned int val) Foam::PackedList<nBits>::PackedList(const label size, const unsigned int val)
: :
List<unsigned int>(intSize(size)), List<unsigned int>(storageSize(size)),
size_(size) size_(size)
{ {
operator=(val); operator=(val);
@ -56,7 +56,7 @@ Foam::PackedList<nBits>::PackedList(const Xfer<PackedList<nBits> >& lst)
template<int nBits> template<int nBits>
Foam::PackedList<nBits>::PackedList(const UList<label>& lst) 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()) size_(lst.size())
{ {
forAll(lst, i) forAll(lst, i)
@ -76,10 +76,36 @@ Foam::autoPtr<Foam::PackedList<nBits> > Foam::PackedList<nBits>::clone() const
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<int nBits> 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)); List<unsigned int>::setSize(storageSize(newSize), 0);
size_ = size; 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;
} }

View File

@ -27,8 +27,14 @@ Class
Description Description
List of packed unsigned ints. List of packed unsigned ints.
Gets given the number of bits per item. 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 SourceFiles
PackedListI.H PackedListI.H
PackedList.C PackedList.C
@ -54,45 +60,55 @@ TemplateName(PackedList);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class PackedList Declaration Class PackedBitRef Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
//- For PackedList //- The PackedBitRef is used for PackedList
class reference class PackedBitRef
{ {
private:
// private data // private data
unsigned int& elem_; unsigned int& elem_;
unsigned int mask_; const label startBit_;
label startBit_; const unsigned int mask_;
public: public:
inline reference(unsigned int& elem, unsigned int mask, label startBit) inline PackedBitRef(unsigned int& elem, label startBit, unsigned int mask)
: :
elem_(elem), elem_(elem),
mask_(mask), startBit_(startBit),
startBit_(startBit) mask_(mask)
{} {}
inline void operator=(const unsigned int val) inline void operator=(const unsigned int val)
{ {
unsigned int shiftedMask = mask_ << startBit_; unsigned int shiftedMask = mask_ << startBit_;
unsigned int shiftedVal = (val & mask_) << startBit_;
unsigned int shiftedVal = val << startBit_;
elem_ = (elem_ & ~shiftedMask) | shiftedVal; elem_ = (elem_ & ~shiftedMask) | shiftedVal;
} }
inline operator unsigned int () const 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> template <int nBits>
class PackedList class PackedList
: :
@ -103,23 +119,36 @@ class PackedList
//- Number of nBits entries //- Number of nBits entries
label size_; label size_;
// Private Member Functions // Private Member Functions
//- Calculate underlying list size //- Calculate underlying list size
inline static label intSize(const label sz); inline static label storageSize(const label);
//- Calculate index into underlying List. //- Calculate element index and offset (start) bit within storage
inline static label intIndex(const label i); inline static label location(const label, label& offset);
//- Check if value is representable in nBits
inline static void checkValue(const unsigned int);
//- Check index i is within valid range (0 ... size-1). //- Check index i is within valid range (0 ... size-1).
inline void checkIndex(const label i) const; inline void checkIndex(const label) const;
//- Check value is representable in nBits
inline void checkValue(const unsigned int val) const;
public: 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 // Constructors
//- Null constructor //- Null constructor
@ -129,7 +158,7 @@ public:
inline PackedList(const label size); inline PackedList(const label size);
//- Construct with given size and value for all elements. //- 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. //- Copy constructor.
PackedList(const PackedList<nBits>& PList); PackedList(const PackedList<nBits>& PList);
@ -145,27 +174,11 @@ public:
// Member Functions // 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 // Access
//- The number of elements that can be stored before resizing
inline label capacity() const;
//- Number of packed elements //- Number of packed elements
inline label size() const; inline label size() const;
@ -181,20 +194,51 @@ public:
//- Underlying storage //- Underlying storage
inline List<unsigned int>& 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 // Member operators
//- Get value at index i //- Get value at index i
inline unsigned int operator[](const label i) const; inline unsigned int operator[](const label i) const;
//- Set value at index i. Returns proxy which does actual operation //- Set value at index i.
inline ::Foam::reference operator[](const label i); // Returns proxy to perform the actual operation
inline ::Foam::PackedBitRef operator[](const label i);
//- Assignment operator. Takes linear time. //- Assignment operator. Takes linear time.
void operator=(const PackedList<nBits>&); void operator=(const PackedList<nBits>&);
//- Assignment of all entries to the given value. Does set on all //- Assignment of all entries to the given value.
// elements. // Does set on all elements.
inline void operator=(const unsigned int val); inline void operator=(const unsigned int val);
//- Return as labelList //- Return as labelList
@ -207,7 +251,6 @@ public:
// friend Ostream& operator<< <nBits> (Ostream&, const PackedList<nBits>&); // friend Ostream& operator<< <nBits> (Ostream&, const PackedList<nBits>&);
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

View File

@ -25,33 +25,67 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef PackedList_I #ifndef PackedListI_H
#define PackedList_I #define PackedListI_H
#include "IOstreams.H" #include "IOstreams.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Calculate underlying list size
template<int nBits> 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;
} }
// Convert index into index in integer array
template<int nBits> template<int nBits>
inline Foam::label Foam::PackedList<nBits>::intIndex(const label i) inline unsigned int Foam::PackedList<nBits>::max_value()
{ {
const label nElemsPerLabel = sizeof(unsigned int)*8/nBits; return ((1u << nBits) - 1);
}
// Index in underlying int array
label elemI = i/nElemsPerLabel;
return elemI; template<int nBits>
inline unsigned int Foam::PackedList<nBits>::packing()
{
return sizeof(unsigned int)*8 / nBits;
}
// 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,7 +96,7 @@ inline void Foam::PackedList<nBits>::checkIndex(const label i) const
if (!size_) if (!size_)
{ {
FatalErrorIn("PackedList<nBits>::checkIndex(const label)") FatalErrorIn("PackedList<nBits>::checkIndex(const label)")
<< "attempt to access element from zero sized list" << "attempt to access element from zero-sized list"
<< abort(FatalError); << abort(FatalError);
} }
else if (i < 0 || i >= size_) else if (i < 0 || i >= size_)
@ -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 * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor // Null constructor
@ -103,7 +123,7 @@ inline Foam::PackedList<nBits>::PackedList()
template<int nBits> template<int nBits>
inline Foam::PackedList<nBits>::PackedList(const label size) inline Foam::PackedList<nBits>::PackedList(const label size)
: :
List<unsigned int>(intSize(size), 0u), List<unsigned int>(storageSize(size), 0u),
size_(size) size_(size)
{} {}
@ -111,9 +131,27 @@ inline Foam::PackedList<nBits>::PackedList(const label size)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<int nBits> template<int nBits>
inline void Foam::PackedList<nBits>::resize(const label size) inline void Foam::PackedList<nBits>::resize(const label newSize)
{ {
this->setSize(size); setSize(newSize);
}
template<int nBits>
inline void Foam::PackedList<nBits>::resize
(
const label newSize,
const unsigned int& val
)
{
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> template<int nBits>
inline bool Foam::PackedList<nBits>::empty() const 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); checkIndex(i);
# endif # endif
// Constant: number of elements that fit in an unsigned int label startBit;
const label nElemsPerLabel = sizeof(unsigned int)*8/nBits; const unsigned int& elem = List<unsigned int>::operator[]
(
location(i, startBit)
);
unsigned int mask = ((1u << nBits) - 1); return (elem >> startBit) & max_value();
label indexInLabel = i % nElemsPerLabel;
// Starting bit in int.
label startBit = nBits*indexInLabel;
return (List<unsigned int>::operator[](intIndex(i)) >> startBit) & mask;
} }
@ -169,24 +203,17 @@ inline bool Foam::PackedList<nBits>::set(const label i, const unsigned int val)
checkValue(val); checkValue(val);
# endif # endif
// Constant: number of elements that fit in an unsigned int label startBit;
const label nElemsPerLabel = sizeof(unsigned int)*8/nBits; unsigned int& elem = List<unsigned int>::operator[]
(
unsigned int mask = ((1u << nBits) - 1); location(i, startBit)
);
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));
unsigned int oldElem = elem; unsigned int oldElem = elem;
unsigned int shiftedMask = max_value() << startBit;
unsigned int shiftedVal = (val & max_value()) << startBit;
elem = (elem & ~shiftedMask) | shiftedVal; elem = (elem & ~shiftedMask) | shiftedVal;
return elem != oldElem; 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> template<int nBits>
inline Foam::Xfer<Foam::PackedList<nBits> > inline Foam::Xfer<Foam::PackedList<nBits> >
Foam::PackedList<nBits>::xfer() Foam::PackedList<nBits>::xfer()
@ -210,25 +244,20 @@ Foam::PackedList<nBits>::xfer()
template<int nBits> 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 # ifdef DEBUGList
checkIndex(i); checkIndex(i);
# endif # endif
// Constant: number of elements that fit in an unsigned int label startBit;
const label nElemsPerLabel = sizeof(unsigned int)*8/nBits; unsigned int& elem = List<unsigned int>::operator[]
(
location(i, startBit)
);
unsigned int mask = ((1u << nBits) - 1); return ::Foam::PackedBitRef(elem, startBit, max_value());
label indexInLabel = i % nElemsPerLabel;
// Starting bit in int.
label startBit = nBits*indexInLabel;
unsigned int& elem = List<unsigned int>::operator[](intIndex(i));
return ::Foam::reference(elem, mask, startBit);
} }

View File

@ -73,11 +73,10 @@ void Foam::syncTools::checkTransform
// Determines for every point whether it is coupled and if so sets only one. // 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); PackedBoolList isMasterPoint(mesh.nPoints(), 0);
PackedBoolList donePoint(mesh.nPoints(), 0);
PackedList<1> donePoint(mesh.nPoints(), 0);
// Do multiple shared points. Min. proc is master // 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. // 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); PackedBoolList isMasterEdge(mesh.nEdges(), 0);
PackedBoolList doneEdge(mesh.nEdges(), 0);
PackedList<1> doneEdge(mesh.nEdges(), 0);
// Do multiple shared edges. Min. proc is master // 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. // 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(); const polyBoundaryMesh& patches = mesh.boundaryMesh();

View File

@ -51,7 +51,7 @@ SourceFiles
#include "transformList.H" #include "transformList.H"
#include "Map.H" #include "Map.H"
#include "EdgeMap.H" #include "EdgeMap.H"
#include "PackedList.H" #include "PackedBoolList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -259,13 +259,13 @@ public:
// Other // Other
//- Get per point whether is it master (of a coupled set of points) //- 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) //- 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) //- Get per face whether is it master (of a coupled set of faces)
static PackedList<1> getMasterFaces(const polyMesh&); static PackedBoolList getMasterFaces(const polyMesh&);
}; };

View File

@ -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
// ************************************************************************* //

View File

@ -370,7 +370,7 @@ class autoLayerDriver
static void averageNeighbours static void averageNeighbours
( (
const polyMesh& mesh, const polyMesh& mesh,
const PackedList<1>& isMasterEdge, const PackedBoolList& isMasterEdge,
const labelList& meshEdges, const labelList& meshEdges,
const labelList& meshPoints, const labelList& meshPoints,
const edgeList& edges, const edgeList& edges,
@ -382,7 +382,7 @@ class autoLayerDriver
//- Calculate inverse sum of edge weights (currently always 1.0) //- Calculate inverse sum of edge weights (currently always 1.0)
void sumWeights void sumWeights
( (
const PackedList<1>& isMasterEdge, const PackedBoolList& isMasterEdge,
const labelList& meshEdges, const labelList& meshEdges,
const labelList& meshPoints, const labelList& meshPoints,
const edgeList& edges, const edgeList& edges,
@ -393,7 +393,7 @@ class autoLayerDriver
void smoothField void smoothField
( (
const motionSmoother& meshMover, const motionSmoother& meshMover,
const PackedList<1>& isMasterEdge, const PackedBoolList& isMasterEdge,
const labelList& meshEdges, const labelList& meshEdges,
const scalarField& fieldMin, const scalarField& fieldMin,
const label& nSmoothDisp, const label& nSmoothDisp,
@ -404,7 +404,7 @@ class autoLayerDriver
void smoothPatchNormals void smoothPatchNormals
( (
const motionSmoother& meshMover, const motionSmoother& meshMover,
const PackedList<1>& isMasterEdge, const PackedBoolList& isMasterEdge,
const labelList& meshEdges, const labelList& meshEdges,
const label nSmoothDisp, const label nSmoothDisp,
pointField& normals pointField& normals
@ -414,7 +414,7 @@ class autoLayerDriver
void smoothNormals void smoothNormals
( (
const label nSmoothDisp, const label nSmoothDisp,
const PackedList<1>& isMasterEdge, const PackedBoolList& isMasterEdge,
const labelList& fixedPoints, const labelList& fixedPoints,
pointVectorField& normals pointVectorField& normals
) const; ) const;
@ -444,7 +444,7 @@ class autoLayerDriver
void findIsolatedRegions void findIsolatedRegions
( (
const indirectPrimitivePatch& pp, const indirectPrimitivePatch& pp,
const PackedList<1>& isMasterEdge, const PackedBoolList& isMasterEdge,
const labelList& meshEdges, const labelList& meshEdges,
const scalar minCosLayerTermination, const scalar minCosLayerTermination,
scalarField& field, scalarField& field,

View File

@ -43,7 +43,7 @@ Description
// Calculate inverse sum of edge weights (currently always 1.0) // Calculate inverse sum of edge weights (currently always 1.0)
void Foam::autoLayerDriver::sumWeights void Foam::autoLayerDriver::sumWeights
( (
const PackedList<1>& isMasterEdge, const PackedBoolList& isMasterEdge,
const labelList& meshEdges, const labelList& meshEdges,
const labelList& meshPoints, const labelList& meshPoints,
const edgeList& edges, const edgeList& edges,
@ -91,7 +91,7 @@ void Foam::autoLayerDriver::sumWeights
void Foam::autoLayerDriver::smoothField void Foam::autoLayerDriver::smoothField
( (
const motionSmoother& meshMover, const motionSmoother& meshMover,
const PackedList<1>& isMasterEdge, const PackedBoolList& isMasterEdge,
const labelList& meshEdges, const labelList& meshEdges,
const scalarField& fieldMin, const scalarField& fieldMin,
const label& nSmoothDisp, const label& nSmoothDisp,
@ -163,7 +163,7 @@ void Foam::autoLayerDriver::smoothField
void Foam::autoLayerDriver::smoothPatchNormals void Foam::autoLayerDriver::smoothPatchNormals
( (
const motionSmoother& meshMover, const motionSmoother& meshMover,
const PackedList<1>& isMasterEdge, const PackedBoolList& isMasterEdge,
const labelList& meshEdges, const labelList& meshEdges,
const label nSmoothDisp, const label nSmoothDisp,
pointField& normals pointField& normals
@ -228,7 +228,7 @@ void Foam::autoLayerDriver::smoothPatchNormals
void Foam::autoLayerDriver::smoothNormals void Foam::autoLayerDriver::smoothNormals
( (
const label nSmoothDisp, const label nSmoothDisp,
const PackedList<1>& isMasterEdge, const PackedBoolList& isMasterEdge,
const labelList& fixedPoints, const labelList& fixedPoints,
pointVectorField& normals pointVectorField& normals
) const ) const
@ -240,7 +240,7 @@ void Foam::autoLayerDriver::smoothNormals
const edgeList& edges = mesh.edges(); const edgeList& edges = mesh.edges();
// Points that do not change. // Points that do not change.
PackedList<1> isFixedPoint(mesh.nPoints(), 0); PackedBoolList isFixedPoint(mesh.nPoints(), 0);
// Internal points that are fixed // Internal points that are fixed
forAll(fixedPoints, i) forAll(fixedPoints, i)
@ -452,7 +452,7 @@ void Foam::autoLayerDriver::handleFeatureAngleLayerTerminations
void Foam::autoLayerDriver::findIsolatedRegions void Foam::autoLayerDriver::findIsolatedRegions
( (
const indirectPrimitivePatch& pp, const indirectPrimitivePatch& pp,
const PackedList<1>& isMasterEdge, const PackedBoolList& isMasterEdge,
const labelList& meshEdges, const labelList& meshEdges,
const scalar minCosLayerTermination, const scalar minCosLayerTermination,
scalarField& field, scalarField& field,
@ -684,7 +684,7 @@ void Foam::autoLayerDriver::medialAxisSmoothingInfo
// ~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~
// Precalulate master edge (only relevant for shared edges) // Precalulate master edge (only relevant for shared edges)
PackedList<1> isMasterEdge(syncTools::getMasterEdges(mesh)); PackedBoolList isMasterEdge(syncTools::getMasterEdges(mesh));
// Precalculate meshEdge per pp edge // Precalculate meshEdge per pp edge
labelList meshEdges(pp.nEdges()); labelList meshEdges(pp.nEdges());
@ -979,7 +979,7 @@ void Foam::autoLayerDriver::shrinkMeshMedialDistance
const labelList& meshPoints = pp.meshPoints(); const labelList& meshPoints = pp.meshPoints();
// Precalulate master edge (only relevant for shared edges) // Precalulate master edge (only relevant for shared edges)
PackedList<1> isMasterEdge(syncTools::getMasterEdges(mesh)); PackedBoolList isMasterEdge(syncTools::getMasterEdges(mesh));
// Precalculate meshEdge per pp edge // Precalculate meshEdge per pp edge
labelList meshEdges(pp.nEdges()); labelList meshEdges(pp.nEdges());

View File

@ -33,7 +33,7 @@ template<class Type>
void Foam::autoLayerDriver::averageNeighbours void Foam::autoLayerDriver::averageNeighbours
( (
const polyMesh& mesh, const polyMesh& mesh,
const PackedList<1>& isMasterEdge, const PackedBoolList& isMasterEdge,
const labelList& meshEdges, const labelList& meshEdges,
const labelList& meshPoints, const labelList& meshPoints,
const edgeList& edges, const edgeList& edges,

View File

@ -153,12 +153,12 @@ Foam::Map<Foam::label> Foam::autoSnapDriver::getZoneBafflePatches
// Calculate geometrically collocated points, Requires PackedList to be // Calculate geometrically collocated points, Requires PackedList to be
// sizes and initalised! // sized and initalised!
Foam::label Foam::autoSnapDriver::getCollocatedPoints Foam::label Foam::autoSnapDriver::getCollocatedPoints
( (
const scalar tol, const scalar tol,
const pointField& points, const pointField& points,
PackedList<1>& isCollocatedPoint PackedBoolList& isCollocatedPoint
) )
{ {
labelList pointMap; labelList pointMap;
@ -225,7 +225,7 @@ Foam::pointField Foam::autoSnapDriver::smoothPatchDisplacement
const indirectPrimitivePatch& pp = meshMover.patch(); const indirectPrimitivePatch& pp = meshMover.patch();
// Calculate geometrically non-manifold points on the patch to be moved. // Calculate geometrically non-manifold points on the patch to be moved.
PackedList<1> nonManifoldPoint(pp.nPoints()); PackedBoolList nonManifoldPoint(pp.nPoints());
label nNonManifoldPoints = getCollocatedPoints label nNonManifoldPoints = getCollocatedPoints
( (
SMALL, SMALL,
@ -255,7 +255,7 @@ Foam::pointField Foam::autoSnapDriver::smoothPatchDisplacement
const polyMesh& mesh = meshMover.mesh(); const polyMesh& mesh = meshMover.mesh();
// Get labels of faces to count (master of coupled faces and baffle pairs) // 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) forAll(baffles, i)
@ -1374,7 +1374,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::autoSnapDriver::repatchToSurface
// Faces that do not move // Faces that do not move
PackedList<1> isZonedFace(mesh.nFaces(), 0); PackedBoolList isZonedFace(mesh.nFaces(), 0);
{ {
// 1. All faces on zoned surfaces // 1. All faces on zoned surfaces
const wordList& faceZoneNames = surfaces.faceZoneNames(); const wordList& faceZoneNames = surfaces.faceZoneNames();

View File

@ -95,7 +95,7 @@ class autoSnapDriver
( (
const scalar tol, const scalar tol,
const pointField&, const pointField&,
PackedList<1>& PackedBoolList&
); );
//- Calculate displacement per patch point to smooth out patch. //- Calculate displacement per patch point to smooth out patch.

View File

@ -126,7 +126,7 @@ void Foam::meshRefinement::updateIntersections(const labelList& changedFaces)
const pointField& cellCentres = mesh_.cellCentres(); const pointField& cellCentres = mesh_.cellCentres();
// Stats on edges to test. Count proc faces only once. // Stats on edges to test. Count proc faces only once.
PackedList<1> isMasterFace(syncTools::getMasterFaces(mesh_)); PackedBoolList isMasterFace(syncTools::getMasterFaces(mesh_));
{ {
label nMasterFaces = 0; label nMasterFaces = 0;
@ -865,7 +865,7 @@ Foam::meshRefinement::meshRefinement
Foam::label Foam::meshRefinement::countHits() const Foam::label Foam::meshRefinement::countHits() const
{ {
// Stats on edges to test. Count proc faces only once. // Stats on edges to test. Count proc faces only once.
PackedList<1> isMasterFace(syncTools::getMasterFaces(mesh_)); PackedBoolList isMasterFace(syncTools::getMasterFaces(mesh_));
label nHits = 0; label nHits = 0;
@ -1201,7 +1201,7 @@ Foam::labelList Foam::meshRefinement::intersectedPoints
const faceList& faces = mesh_.faces(); const faceList& faces = mesh_.faces();
// Mark all points on faces that will become baffles // Mark all points on faces that will become baffles
PackedList<1> isBoundaryPoint(mesh_.nPoints(), 0u); PackedBoolList isBoundaryPoint(mesh_.nPoints(), 0u);
label nBoundaryPoints = 0; label nBoundaryPoints = 0;
forAll(surfaceIndex_, faceI) forAll(surfaceIndex_, faceI)

View File

@ -431,7 +431,7 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
// point will only have 4 cells connected to it) // point will only have 4 cells connected to it)
// Does cell have exactly 7 of its 8 anchor points on the boundary? // 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? // If so what is the remaining non-boundary anchor point?
labelHashSet nonBoundaryAnchors(mesh_.nCells()/10000); labelHashSet nonBoundaryAnchors(mesh_.nCells()/10000);

View File

@ -68,7 +68,7 @@ Foam::labelList Foam::meshRefinement::getChangedFaces
const label nInternalFaces = mesh.nInternalFaces(); const label nInternalFaces = mesh.nInternalFaces();
// Mark refined cells on old mesh // Mark refined cells on old mesh
PackedList<1> oldRefineCell(map.nOldCells(), 0u); PackedBoolList oldRefineCell(map.nOldCells());
forAll(oldCellsToRefine, i) forAll(oldCellsToRefine, i)
{ {
@ -76,7 +76,7 @@ Foam::labelList Foam::meshRefinement::getChangedFaces
} }
// Mark refined faces // Mark refined faces
PackedList<1> refinedInternalFace(nInternalFaces, 0u); PackedBoolList refinedInternalFace(nInternalFaces);
// 1. Internal faces // 1. Internal faces
@ -335,7 +335,7 @@ Foam::label Foam::meshRefinement::markFeatureRefinement
maxFeatureLevel = -1; maxFeatureLevel = -1;
// Whether edge has been visited. // Whether edge has been visited.
List<PackedList<1> > featureEdgeVisited(featureMeshes.size()); List<PackedBoolList> featureEdgeVisited(featureMeshes.size());
forAll(featureMeshes, featI) forAll(featureMeshes, featI)
{ {

View File

@ -38,7 +38,7 @@ SourceFiles
#ifndef refinementSurfaces_H #ifndef refinementSurfaces_H
#define refinementSurfaces_H #define refinementSurfaces_H
#include "PackedList.H" #include "PackedBoolList.H"
#include "triSurfaceGeoMesh.H" #include "triSurfaceGeoMesh.H"
#include "triSurfaceFields.H" #include "triSurfaceFields.H"
#include "vectorList.H" #include "vectorList.H"

View File

@ -47,7 +47,7 @@ addToRunTimeSelectionTable(dynamicFvMesh, dynamicRefineFvMesh, IOobject);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * 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; label n = 0;
forAll(l, i) forAll(l, i)
@ -63,7 +63,7 @@ label dynamicRefineFvMesh::count(const PackedList<1>& l, const unsigned int val)
void dynamicRefineFvMesh::calculateProtectedCells void dynamicRefineFvMesh::calculateProtectedCells
( (
PackedList<1>& unrefineableCell PackedBoolList& unrefineableCell
) const ) const
{ {
if (protectedCell_.empty()) if (protectedCell_.empty())
@ -385,7 +385,7 @@ autoPtr<mapPolyMesh> dynamicRefineFvMesh::refine
// Update numbering of protectedCell_ // Update numbering of protectedCell_
if (protectedCell_.size()) if (protectedCell_.size())
{ {
PackedList<1> newProtectedCell(nCells(), 0); PackedBoolList newProtectedCell(nCells());
forAll(newProtectedCell, cellI) forAll(newProtectedCell, cellI)
{ {
@ -538,7 +538,7 @@ autoPtr<mapPolyMesh> dynamicRefineFvMesh::unrefine
// Update numbering of protectedCell_ // Update numbering of protectedCell_
if (protectedCell_.size()) if (protectedCell_.size())
{ {
PackedList<1> newProtectedCell(nCells(), 0); PackedBoolList newProtectedCell(nCells());
forAll(newProtectedCell, cellI) forAll(newProtectedCell, cellI)
{ {
@ -642,7 +642,7 @@ void dynamicRefineFvMesh::selectRefineCandidates
const scalar lowerRefineLevel, const scalar lowerRefineLevel,
const scalar upperRefineLevel, const scalar upperRefineLevel,
const scalarField& vFld, const scalarField& vFld,
PackedList<1>& candidateCell PackedBoolList& candidateCell
) const ) const
{ {
// Get error per cell. Is -1 (not to be refined) to >0 (to be refined, // 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 maxCells,
const label maxRefinement, const label maxRefinement,
const PackedList<1>& candidateCell const PackedBoolList& candidateCell
) const ) const
{ {
// Every refined cell causes 7 extra cells // 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 // Mark cells that cannot be refined since they would trigger refinement
// of protected cells (since 2:1 cascade) // of protected cells (since 2:1 cascade)
PackedList<1> unrefineableCell; PackedBoolList unrefineableCell;
calculateProtectedCells(unrefineableCell); calculateProtectedCells(unrefineableCell);
// Count current selection // Count current selection
@ -761,7 +761,7 @@ labelList dynamicRefineFvMesh::selectRefineCells
labelList dynamicRefineFvMesh::selectUnrefinePoints labelList dynamicRefineFvMesh::selectUnrefinePoints
( (
const scalar unrefineLevel, const scalar unrefineLevel,
const PackedList<1>& markedCell, const PackedBoolList& markedCell,
const scalarField& pFld const scalarField& pFld
) const ) 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 // Mark faces using any marked cell
boolList markedFace(nFaces(), false); boolList markedFace(nFaces(), false);
@ -1078,7 +1078,7 @@ bool dynamicRefineFvMesh::update()
readLabel(refineDict.lookup("nBufferLayers")); readLabel(refineDict.lookup("nBufferLayers"));
// Cells marked for refinement or otherwise protected from unrefinement. // Cells marked for refinement or otherwise protected from unrefinement.
PackedList<1> refineCell(nCells(), 0); PackedBoolList refineCell(nCells());
if (globalData().nTotalCells() < maxCells) if (globalData().nTotalCells() < maxCells)
{ {
@ -1119,7 +1119,7 @@ bool dynamicRefineFvMesh::update()
const labelList& cellMap = map().cellMap(); const labelList& cellMap = map().cellMap();
const labelList& reverseCellMap = map().reverseCellMap(); const labelList& reverseCellMap = map().reverseCellMap();
PackedList<1> newRefineCell(cellMap.size()); PackedBoolList newRefineCell(cellMap.size());
forAll(cellMap, cellI) forAll(cellMap, cellI)
{ {

View File

@ -40,7 +40,7 @@ SourceFiles
#include "dynamicFvMesh.H" #include "dynamicFvMesh.H"
#include "hexRef8.H" #include "hexRef8.H"
#include "PackedList.H" #include "PackedBoolList.H"
#include "Switch.H" #include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -71,17 +71,17 @@ protected:
label nRefinementIterations_; label nRefinementIterations_;
//- Protected cells (usually since not hexes) //- Protected cells (usually since not hexes)
PackedList<1> protectedCell_; PackedBoolList protectedCell_;
// Private Member Functions // Private Member Functions
//- Count set/unset elements in packedlist. //- 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 //- Calculate cells that cannot be refined since would trigger
// refinement of protectedCell_ (since 2:1 refinement cascade) // 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 //- Read the projection parameters from dictionary
void readDict(); void readDict();
@ -127,7 +127,7 @@ protected:
const scalar lowerRefineLevel, const scalar lowerRefineLevel,
const scalar upperRefineLevel, const scalar upperRefineLevel,
const scalarField& vFld, const scalarField& vFld,
PackedList<1>& candidateCell PackedBoolList& candidateCell
) const; ) const;
//- Subset candidate cells for refinement //- Subset candidate cells for refinement
@ -135,19 +135,19 @@ protected:
( (
const label maxCells, const label maxCells,
const label maxRefinement, const label maxRefinement,
const PackedList<1>& candidateCell const PackedBoolList& candidateCell
) const; ) const;
//- Select points that can be unrefined. //- Select points that can be unrefined.
virtual labelList selectUnrefinePoints virtual labelList selectUnrefinePoints
( (
const scalar unrefineLevel, const scalar unrefineLevel,
const PackedList<1>& markedCell, const PackedBoolList& markedCell,
const scalarField& pFld const scalarField& pFld
) const; ) const;
//- Extend markedCell with cell-face-cell. //- Extend markedCell with cell-face-cell.
void extendMarkedCells(PackedList<1>& markedCell) const; void extendMarkedCells(PackedBoolList& markedCell) const;
private: private:
@ -184,13 +184,13 @@ public:
} }
//- Cells which should not be refined/unrefined //- Cells which should not be refined/unrefined
const PackedList<1>& protectedCell() const const PackedBoolList& protectedCell() const
{ {
return protectedCell_; return protectedCell_;
} }
//- Cells which should not be refined/unrefined //- Cells which should not be refined/unrefined
PackedList<1>& protectedCell() PackedBoolList& protectedCell()
{ {
return protectedCell_; return protectedCell_;
} }

View File

@ -206,7 +206,7 @@ Foam::labelHashSet Foam::motionSmoother::getPoints
// Smooth on selected points (usually patch points) // Smooth on selected points (usually patch points)
void Foam::motionSmoother::minSmooth void Foam::motionSmoother::minSmooth
( (
const PackedList<1>& isAffectedPoint, const PackedBoolList& isAffectedPoint,
const labelList& meshPoints, const labelList& meshPoints,
const pointScalarField& fld, const pointScalarField& fld,
pointScalarField& newFld pointScalarField& newFld
@ -241,7 +241,7 @@ void Foam::motionSmoother::minSmooth
// Smooth on all internal points // Smooth on all internal points
void Foam::motionSmoother::minSmooth void Foam::motionSmoother::minSmooth
( (
const PackedList<1>& isAffectedPoint, const PackedBoolList& isAffectedPoint,
const pointScalarField& fld, const pointScalarField& fld,
pointScalarField& newFld pointScalarField& newFld
) const ) const
@ -324,7 +324,7 @@ void Foam::motionSmoother::getAffectedFacesAndPoints
const faceSet& wrongFaces, const faceSet& wrongFaces,
labelList& affectedFaces, labelList& affectedFaces,
PackedList<1>& isAffectedPoint PackedBoolList& isAffectedPoint
) const ) const
{ {
isAffectedPoint.setSize(mesh_.nPoints()); isAffectedPoint.setSize(mesh_.nPoints());
@ -976,7 +976,7 @@ bool Foam::motionSmoother::scaleMesh
// Grow a few layers to determine // Grow a few layers to determine
// - points to be smoothed // - points to be smoothed
// - faces to be checked in next iteration // - faces to be checked in next iteration
PackedList<1> isAffectedPoint(mesh_.nPoints(), 0); PackedBoolList isAffectedPoint(mesh_.nPoints());
getAffectedFacesAndPoints getAffectedFacesAndPoints
( (
nSmoothScale, // smoothing iterations nSmoothScale, // smoothing iterations

View File

@ -76,7 +76,7 @@ SourceFiles
#include "pointFields.H" #include "pointFields.H"
#include "HashSet.H" #include "HashSet.H"
#include "PackedList.H" #include "PackedBoolList.H"
#include "indirectPrimitivePatch.H" #include "indirectPrimitivePatch.H"
#include "className.H" #include "className.H"
#include "twoDPointCorrector.H" #include "twoDPointCorrector.H"
@ -159,11 +159,11 @@ class motionSmoother
pointField oldPoints_; pointField oldPoints_;
//- Is mesh point on boundary or not //- Is mesh point on boundary or not
PackedList<1> isInternalPoint_; PackedBoolList isInternalPoint_;
//- Is edge master (always except if on coupled boundary and on //- Is edge master (always except if on coupled boundary and on
// lower processor) // lower processor)
PackedList<1> isMasterEdge_; PackedBoolList isMasterEdge_;
//- 2-D motion corrector //- 2-D motion corrector
twoDPointCorrector twoDCorrector_; twoDPointCorrector twoDCorrector_;
@ -220,7 +220,7 @@ class motionSmoother
//- explicit smoothing and min on all affected internal points //- explicit smoothing and min on all affected internal points
void minSmooth void minSmooth
( (
const PackedList<1>& isAffectedPoint, const PackedBoolList& isAffectedPoint,
const pointScalarField& fld, const pointScalarField& fld,
pointScalarField& newFld pointScalarField& newFld
) const; ) const;
@ -228,7 +228,7 @@ class motionSmoother
//- same but only on selected points (usually patch points) //- same but only on selected points (usually patch points)
void minSmooth void minSmooth
( (
const PackedList<1>& isAffectedPoint, const PackedBoolList& isAffectedPoint,
const labelList& meshPoints, const labelList& meshPoints,
const pointScalarField& fld, const pointScalarField& fld,
pointScalarField& newFld pointScalarField& newFld
@ -264,7 +264,7 @@ class motionSmoother
const faceSet& wrongFaces, const faceSet& wrongFaces,
labelList& affectedFaces, labelList& affectedFaces,
PackedList<1>& isAffectedPoint PackedBoolList& isAffectedPoint
) const; ) const;
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct

View File

@ -56,7 +56,7 @@ Foam::labelListList Foam::addPatchCellLayer::calcGlobalEdgeFaces
//// Determine coupled edges just so we don't have to have storage //// Determine coupled edges just so we don't have to have storage
//// for all non-coupled edges. //// for all non-coupled edges.
// //
//PackedList<1> isCoupledEdge(mesh.nEdges(), 0); //PackedBoolList isCoupledEdge(mesh.nEdges());
// //
//const polyBoundaryMesh& patches = mesh.boundaryMesh(); //const polyBoundaryMesh& patches = mesh.boundaryMesh();
// //

View File

@ -1554,7 +1554,7 @@ void Foam::hexRef8::walkFaceFromMid
Foam::label Foam::hexRef8::faceConsistentRefinement Foam::label Foam::hexRef8::faceConsistentRefinement
( (
const bool maxSet, const bool maxSet,
PackedList<1>& refineCell PackedBoolList& refineCell
) const ) const
{ {
label nChanged = 0; label nChanged = 0;
@ -1643,7 +1643,7 @@ void Foam::hexRef8::checkWantedRefinementLevels
const labelList& cellsToRefine const labelList& cellsToRefine
) const ) const
{ {
PackedList<1> refineCell(mesh_.nCells(), 0); PackedBoolList refineCell(mesh_.nCells());
forAll(cellsToRefine, i) forAll(cellsToRefine, i)
{ {
refineCell.set(cellsToRefine[i], 1); refineCell.set(cellsToRefine[i], 1);
@ -2028,7 +2028,7 @@ Foam::labelList Foam::hexRef8::consistentRefinement
// maxSet = true : select cells to refine // maxSet = true : select cells to refine
// Go to straight boolList. // Go to straight boolList.
PackedList<1> refineCell(mesh_.nCells(), 0); PackedBoolList refineCell(mesh_.nCells());
forAll(cellsToRefine, i) forAll(cellsToRefine, i)
{ {
refineCell.set(cellsToRefine[i], 1); 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. 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 // 2. Extend to 2:1. For non-cube cells the scalar distance does not work
// so make sure it at least provides 2:1. // so make sure it at least provides 2:1.
PackedList<1> refineCell(mesh_.nCells(), 0); PackedBoolList refineCell(mesh_.nCells());
forAll(allCellInfo, cellI) forAll(allCellInfo, cellI)
{ {
label wanted = allCellInfo[cellI].wantedLevel(cc[cellI]); label wanted = allCellInfo[cellI].wantedLevel(cc[cellI]);
@ -2953,12 +2953,12 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement2
} }
// Extend to 2:1 // Extend to 2:1
PackedList<1> refineCell(mesh_.nCells(), 0); PackedBoolList refineCell(mesh_.nCells());
forAll(newCellsToRefine, i) forAll(newCellsToRefine, i)
{ {
refineCell.set(newCellsToRefine[i], 1); refineCell.set(newCellsToRefine[i], 1);
} }
const PackedList<1> savedRefineCell(refineCell); const PackedBoolList savedRefineCell(refineCell);
label nChanged = faceConsistentRefinement(true, refineCell); label nChanged = faceConsistentRefinement(true, refineCell);
@ -3583,7 +3583,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
} }
// Get all affected faces. // Get all affected faces.
PackedList<1> affectedFace(mesh_.nFaces(), 0); PackedBoolList affectedFace(mesh_.nFaces());
{ {
forAll(cellMidPoint, cellI) forAll(cellMidPoint, cellI)
@ -5084,7 +5084,7 @@ Foam::labelList Foam::hexRef8::consistentUnrefinement
// maxSet = true: select points to refine // maxSet = true: select points to refine
// Maintain boolList for pointsToUnrefine and cellsToUnrefine // Maintain boolList for pointsToUnrefine and cellsToUnrefine
PackedList<1> unrefinePoint(mesh_.nPoints(), 0); PackedBoolList unrefinePoint(mesh_.nPoints());
forAll(pointsToUnrefine, i) forAll(pointsToUnrefine, i)
{ {
@ -5099,7 +5099,7 @@ Foam::labelList Foam::hexRef8::consistentUnrefinement
// Construct cells to unrefine // Construct cells to unrefine
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~
PackedList<1> unrefineCell(mesh_.nCells(), 0); PackedBoolList unrefineCell(mesh_.nCells());
forAll(unrefinePoint, pointI) forAll(unrefinePoint, pointI)
{ {

View File

@ -43,7 +43,7 @@ SourceFiles
#include "primitivePatch.H" #include "primitivePatch.H"
#include "removeFaces.H" #include "removeFaces.H"
#include "refinementHistory.H" #include "refinementHistory.H"
#include "PackedList.H" #include "PackedBoolList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -298,7 +298,7 @@ class hexRef8
label faceConsistentRefinement label faceConsistentRefinement
( (
const bool maxSet, const bool maxSet,
PackedList<1>& refineCell PackedBoolList& refineCell
) const; ) const;
//- Check wanted refinement for 2:1 consistency //- Check wanted refinement for 2:1 consistency

View File

@ -522,7 +522,7 @@ Foam::label Foam::polyTopoChange::getCellOrder
SLList<label> nextCell; SLList<label> nextCell;
// Whether cell has been done already // Whether cell has been done already
PackedList<1> visited(cellCellAddressing.size(), 0); PackedBoolList visited(cellCellAddressing.size());
label cellInOrder = 0; label cellInOrder = 0;

View File

@ -76,7 +76,7 @@ SourceFiles
#include "HashSet.H" #include "HashSet.H"
#include "mapPolyMesh.H" #include "mapPolyMesh.H"
#include "CompactListList.H" #include "CompactListList.H"
#include "PackedList.H" #include "PackedBoolList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -39,7 +39,7 @@ SourceFiles
#include "face.H" #include "face.H"
#include "indexedOctree.H" #include "indexedOctree.H"
#include "treeBoundBoxList.H" #include "treeBoundBoxList.H"
#include "PackedList.H" #include "PackedBoolList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -72,7 +72,7 @@ class treeDataFace
const labelList faceLabels_; const labelList faceLabels_;
//- Inverse of faceLabels. For every mesh whether face is in 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 //- Whether to precalculate and store face bounding box
const bool cacheBb_; const bool cacheBb_;

View File

@ -31,6 +31,7 @@ License
#include "triangleFuncs.H" #include "triangleFuncs.H"
#include "matchPoints.H" #include "matchPoints.H"
#include "globalIndex.H" #include "globalIndex.H"
#include "PackedBoolList.H"
#include "Time.H" #include "Time.H"
@ -774,8 +775,7 @@ void Foam::distributedTriSurfaceMesh::calcBounds
// Unfortunately nPoints constructs meshPoints() so do compact version // Unfortunately nPoints constructs meshPoints() so do compact version
// ourselves // ourselves
PackedList<1> pointIsUsed(points().size()); PackedBoolList pointIsUsed(points().size());
pointIsUsed = 0U;
nPoints = 0; nPoints = 0;
bb = boundBox::invertedBox; bb = boundBox::invertedBox;

View File

@ -537,7 +537,7 @@ void Foam::isoSurface::calcSnappedCc
// to a single point // to a single point
void Foam::isoSurface::calcSnappedPoint void Foam::isoSurface::calcSnappedPoint
( (
const PackedList<1>& isBoundaryPoint, const PackedBoolList& isBoundaryPoint,
const labelList& boundaryRegion, const labelList& boundaryRegion,
const volScalarField& cVals, const volScalarField& cVals,
const scalarField& pVals, const scalarField& pVals,
@ -1382,7 +1382,7 @@ Foam::isoSurface::isoSurface
// Determine if point is on boundary. Points on boundaries are never // Determine if point is on boundary. Points on boundaries are never
// snapped. Coupled boundaries are handled explicitly so not marked here. // 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()); labelList boundaryRegion(mesh_.nFaces()-mesh_.nInternalFaces());

View File

@ -56,7 +56,7 @@ SourceFiles
#include "triSurface.H" #include "triSurface.H"
#include "labelPair.H" #include "labelPair.H"
#include "pointIndexHit.H" #include "pointIndexHit.H"
#include "PackedList.H" #include "PackedBoolList.H"
#include "volFields.H" #include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -181,7 +181,7 @@ class isoSurface
// point. // point.
void calcSnappedPoint void calcSnappedPoint
( (
const PackedList<1>& isBoundaryPoint, const PackedBoolList& isBoundaryPoint,
const labelList& boundaryRegion, const labelList& boundaryRegion,
const volScalarField& cVals, const volScalarField& cVals,
const scalarField& pVals, const scalarField& pVals,

View File

@ -81,7 +81,7 @@ Foam::scalar Foam::isoSurfaceCell::isoFraction
Foam::isoSurfaceCell::cellCutType Foam::isoSurfaceCell::calcCutType Foam::isoSurfaceCell::cellCutType Foam::isoSurfaceCell::calcCutType
( (
const PackedList<1>& isTet, const PackedBoolList& isTet,
const scalarField& cellValues, const scalarField& cellValues,
const scalarField& pointValues, const scalarField& pointValues,
const label cellI const label cellI
@ -203,7 +203,7 @@ Foam::isoSurfaceCell::cellCutType Foam::isoSurfaceCell::calcCutType
void Foam::isoSurfaceCell::calcCutTypes void Foam::isoSurfaceCell::calcCutTypes
( (
const PackedList<1>& isTet, const PackedBoolList& isTet,
const scalarField& cVals, const scalarField& cVals,
const scalarField& pVals const scalarField& pVals
) )
@ -348,7 +348,7 @@ Foam::pointIndexHit Foam::isoSurfaceCell::collapseSurface
void Foam::isoSurfaceCell::calcSnappedCc void Foam::isoSurfaceCell::calcSnappedCc
( (
const PackedList<1>& isTet, const PackedBoolList& isTet,
const scalarField& cVals, const scalarField& cVals,
const scalarField& pVals, const scalarField& pVals,
@ -621,8 +621,8 @@ void Foam::isoSurfaceCell::genPointTris
void Foam::isoSurfaceCell::calcSnappedPoint void Foam::isoSurfaceCell::calcSnappedPoint
( (
const PackedList<1>& isBoundaryPoint, const PackedBoolList& isBoundaryPoint,
const PackedList<1>& isTet, const PackedBoolList& isTet,
const scalarField& cVals, const scalarField& cVals,
const scalarField& pVals, const scalarField& pVals,
@ -1402,7 +1402,7 @@ Foam::isoSurfaceCell::isoSurfaceCell
mergeDistance_(mergeTol*mesh.bounds().mag()) mergeDistance_(mergeTol*mesh.bounds().mag())
{ {
// Determine if cell is tet // Determine if cell is tet
PackedList<1> isTet(mesh_.nCells()); PackedBoolList isTet(mesh_.nCells());
{ {
tetMatcher tet; tetMatcher tet;
@ -1417,7 +1417,7 @@ Foam::isoSurfaceCell::isoSurfaceCell
// Determine if point is on boundary. Points on boundaries are never // Determine if point is on boundary. Points on boundaries are never
// snapped. Coupled boundaries are handled explicitly so not marked here. // snapped. Coupled boundaries are handled explicitly so not marked here.
PackedList<1> isBoundaryPoint(mesh_.nPoints()); PackedBoolList isBoundaryPoint(mesh_.nPoints());
const polyBoundaryMesh& patches = mesh_.boundaryMesh(); const polyBoundaryMesh& patches = mesh_.boundaryMesh();
forAll(patches, patchI) forAll(patches, patchI)
{ {

View File

@ -48,7 +48,7 @@ SourceFiles
#include "triSurface.H" #include "triSurface.H"
#include "labelPair.H" #include "labelPair.H"
#include "pointIndexHit.H" #include "pointIndexHit.H"
#include "PackedList.H" #include "PackedBoolList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -118,7 +118,7 @@ class isoSurfaceCell
//- Determine whether cell is cut //- Determine whether cell is cut
cellCutType calcCutType cellCutType calcCutType
( (
const PackedList<1>&, const PackedBoolList&,
const scalarField& cellValues, const scalarField& cellValues,
const scalarField& pointValues, const scalarField& pointValues,
const label const label
@ -126,7 +126,7 @@ class isoSurfaceCell
void calcCutTypes void calcCutTypes
( (
const PackedList<1>&, const PackedBoolList&,
const scalarField& cellValues, const scalarField& cellValues,
const scalarField& pointValues const scalarField& pointValues
); );
@ -149,7 +149,7 @@ class isoSurfaceCell
// point. // point.
void calcSnappedCc void calcSnappedCc
( (
const PackedList<1>& isTet, const PackedBoolList& isTet,
const scalarField& cVals, const scalarField& cVals,
const scalarField& pVals, const scalarField& pVals,
DynamicList<point>& triPoints, DynamicList<point>& triPoints,
@ -180,8 +180,8 @@ class isoSurfaceCell
// point. // point.
void calcSnappedPoint void calcSnappedPoint
( (
const PackedList<1>& isBoundaryPoint, const PackedBoolList& isBoundaryPoint,
const PackedList<1>& isTet, const PackedBoolList& isTet,
const scalarField& cVals, const scalarField& cVals,
const scalarField& pVals, const scalarField& pVals,
DynamicList<point>& triPoints, DynamicList<point>& triPoints,

View File

@ -31,7 +31,7 @@ License
#include "Time.H" #include "Time.H"
#include "boundBox.H" #include "boundBox.H"
#include "SortableList.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 // Unfortunately nPoints constructs meshPoints() so do compact version
// ourselves. // ourselves.
PackedList<1> pointIsUsed(points().size()); PackedBoolList pointIsUsed(points().size());
pointIsUsed = 0U;
label nPoints = 0; label nPoints = 0;
boundBox bb = boundBox::invertedBox; boundBox bb = boundBox::invertedBox;