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

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