BUG: primitiveMesh: cellPoints, cellEdges inconsistent API. Fixes #703.

This commit is contained in:
mattijs
2018-01-15 14:10:09 +00:00
parent ad82072d0f
commit effe4ce217
5 changed files with 20 additions and 14 deletions

View File

@ -822,6 +822,7 @@ public:
const labelList& cellPoints
(
const label celli,
labelHashSet&,
DynamicList<label>&
) const;
@ -876,6 +877,7 @@ public:
const labelList& cellEdges
(
const label celli,
labelHashSet&,
DynamicList<label>&
) const;

View File

@ -58,6 +58,7 @@ const Foam::labelListList& Foam::primitiveMesh::cellPoints() const
const Foam::labelList& Foam::primitiveMesh::cellPoints
(
const label celli,
labelHashSet& set,
DynamicList<label>& storage
) const
{
@ -70,7 +71,7 @@ const Foam::labelList& Foam::primitiveMesh::cellPoints
const faceList& fcs = faces();
const labelList& cFaces = cells()[celli];
labelSet_.clear();
set.clear();
forAll(cFaces, i)
{
@ -78,17 +79,17 @@ const Foam::labelList& Foam::primitiveMesh::cellPoints
forAll(f, fp)
{
labelSet_.insert(f[fp]);
set.insert(f[fp]);
}
}
storage.clear();
if (labelSet_.size() > storage.capacity())
if (set.size() > storage.capacity())
{
storage.setCapacity(labelSet_.size());
storage.setCapacity(set.size());
}
forAllConstIter(labelHashSet, labelSet_, iter)
forAllConstIter(labelHashSet, set, iter)
{
storage.append(iter.key());
}
@ -100,7 +101,7 @@ const Foam::labelList& Foam::primitiveMesh::cellPoints
const Foam::labelList& Foam::primitiveMesh::cellPoints(const label celli) const
{
return cellPoints(celli, labels_);
return cellPoints(celli, labelSet_, labels_);
}

View File

@ -630,6 +630,7 @@ const Foam::labelList& Foam::primitiveMesh::faceEdges(const label facei) const
const Foam::labelList& Foam::primitiveMesh::cellEdges
(
const label celli,
labelHashSet& set,
DynamicList<label>& storage
) const
{
@ -641,7 +642,7 @@ const Foam::labelList& Foam::primitiveMesh::cellEdges
{
const labelList& cFaces = cells()[celli];
labelSet_.clear();
set.clear();
forAll(cFaces, i)
{
@ -649,18 +650,18 @@ const Foam::labelList& Foam::primitiveMesh::cellEdges
forAll(fe, feI)
{
labelSet_.insert(fe[feI]);
set.insert(fe[feI]);
}
}
storage.clear();
if (labelSet_.size() > storage.capacity())
if (set.size() > storage.capacity())
{
storage.setCapacity(labelSet_.size());
storage.setCapacity(set.size());
}
forAllConstIter(labelHashSet, labelSet_, iter)
forAllConstIter(labelHashSet, set, iter)
{
storage.append(iter.key());
}
@ -672,7 +673,7 @@ const Foam::labelList& Foam::primitiveMesh::cellEdges
const Foam::labelList& Foam::primitiveMesh::cellEdges(const label celli) const
{
return cellEdges(celli, labels_);
return cellEdges(celli, labelSet_, labels_);
}

View File

@ -305,6 +305,7 @@ Foam::labelListList Foam::combineFaces::getMergeSets
// Lists of faces that can be merged.
DynamicList<labelList> allFaceSets(boundaryCells.size() / 10);
// Storage for on-the-fly cell-edge addressing.
labelHashSet set;
DynamicList<label> storage;
// On all cells regionise the faces
@ -314,7 +315,7 @@ Foam::labelListList Foam::combineFaces::getMergeSets
const cell& cFaces = mesh_.cells()[celli];
const labelList& cEdges = mesh_.cellEdges(celli, storage);
const labelList& cEdges = mesh_.cellEdges(celli, set, storage);
// Region per face
Map<label> faceRegion(cFaces.size());

View File

@ -718,10 +718,11 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
// On-the-fly addressing storage.
DynamicList<label> dynFEdges;
DynamicList<label> dynCPoints;
labelHashSet pSet;
forAll(cellLevel, celli)
{
const labelList& cPoints = mesh_.cellPoints(celli, dynCPoints);
const labelList& cPoints = mesh_.cellPoints(celli, pSet, dynCPoints);
// Get number of anchor points (pointLevel <= cellLevel)