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);
// Test : disable refinement for some cells
PackedList<1>& protectedCell =
PackedBoolList& protectedCell =
refCast<dynamicRefineFvMesh>(mesh).protectedCell();
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 "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++)

View File

@ -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];

View File

@ -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];

View File

@ -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&,

View File

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

View File

@ -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 if value is representable in nBits
inline static void checkValue(const unsigned int);
//- Check index i is within valid range (0 ... size-1).
inline void checkIndex(const label i) const;
//- Check value is representable in nBits
inline void checkValue(const unsigned int val) const;
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

View File

@ -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 (sz+nElemsPerLabel-1)/nElemsPerLabel;
return sizeof(unsigned int)*8 - 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>::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,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)
{
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>
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;
label startBit;
const unsigned int& elem = List<unsigned int>::operator[]
(
location(i, startBit)
);
unsigned int mask = ((1u << nBits) - 1);
label indexInLabel = i % nElemsPerLabel;
// Starting bit in int.
label startBit = nBits*indexInLabel;
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;
label startBit;
unsigned int& elem = List<unsigned int>::operator[]
(
location(i, startBit)
);
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));
return ::Foam::reference(elem, mask, startBit);
return ::Foam::PackedBitRef(elem, startBit, max_value());
}

View File

@ -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();

View File

@ -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&);
};

View File

@ -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);
}
}

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
(
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,

View File

@ -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());

View File

@ -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,

View File

@ -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();

View File

@ -95,7 +95,7 @@ class autoSnapDriver
(
const scalar tol,
const pointField&,
PackedList<1>&
PackedBoolList&
);
//- 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();
// 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)

View File

@ -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())

View File

@ -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)
{

View File

@ -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"

View File

@ -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)
{

View File

@ -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_;
}

View File

@ -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)
{

View File

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

View File

@ -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();
//

View File

@ -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)
{

View File

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

View File

@ -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;

View File

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

View File

@ -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_;

View File

@ -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;

View File

@ -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());

View File

@ -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,

View File

@ -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)
{

View File

@ -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,

View File

@ -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;