Fixed bug in usage of dynamic list

This commit is contained in:
Hrvoje Jasak 2010-10-12 18:46:57 +01:00
parent 8597846dc1
commit 7c80ada340
2 changed files with 21 additions and 19 deletions

View file

@ -577,7 +577,7 @@ Foam::label Foam::directTopoChange::getCellOrder
// Now we have new-to-old in newOrder. // Now we have new-to-old in newOrder.
newOrder.setSize(cellInOrder); newOrder.setSize(cellInOrder);
// Invert to get old-to-new. Make sure removed (i.e. unmapped) cells are -1. // Invert to get old-to-new. Make sure removed (i.e. unmapped) cells are -1
oldToNew = invert(cellCellAddressing.size(), newOrder); oldToNew = invert(cellCellAddressing.size(), newOrder);
return cellInOrder; return cellInOrder;
@ -904,7 +904,7 @@ void Foam::directTopoChange::compact
<< " at position " << faceI << endl << " at position " << faceI << endl
<< "Probably face has not been adapted for" << "Probably face has not been adapted for"
<< " removed points." << abort(FatalError); << " removed points." << abort(FatalError);
} }
localPointMap[pointI] = newPointI++; localPointMap[pointI] = newPointI++;
} }
} }
@ -1487,7 +1487,8 @@ void Foam::directTopoChange::resetZones
{ {
if (newZoneAddr[i] < pointMap_.size()) if (newZoneAddr[i] < pointMap_.size())
{ {
curPzRnb[i] = oldZone.whichPoint(pointMap_[newZoneAddr[i]]); curPzRnb[i] =
oldZone.whichPoint(pointMap_[newZoneAddr[i]]);
} }
else else
{ {
@ -1719,13 +1720,13 @@ void Foam::directTopoChange::calcFaceZonePointMap
curFzPointRnb.setSize(newZoneMeshPoints.size()); curFzPointRnb.setSize(newZoneMeshPoints.size());
if( zoneI < oldFaceZoneMeshPointMaps.size() ) if( zoneI < oldFaceZoneMeshPointMaps.size() )
{ {
//HR 22.11.09: cannot take reference to zero element of //HR 22.11.09: cannot take reference to zero element of
// oldFaceZoneMeshPointMaps. It may be empty. Hence this // oldFaceZoneMeshPointMaps. It may be empty. Hence this
// if-statement needs to move out of the loop // if-statement needs to move out of the loop
const Map<label>& oldZoneMeshPointMap = const Map<label>& oldZoneMeshPointMap =
oldFaceZoneMeshPointMaps[zoneI]; oldFaceZoneMeshPointMaps[zoneI];
forAll (newZoneMeshPoints, pointI) forAll (newZoneMeshPoints, pointI)
{ {
@ -2034,7 +2035,8 @@ void Foam::directTopoChange::compactAndReorder
{ {
//HR 22.11.09: Fixes error when faceZone is empty //HR 22.11.09: Fixes error when faceZone is empty
label maxFaceIndex = -1; label maxFaceIndex = -1;
if ( mesh.faceZones()[zoneI].size() > 0 )
if ( mesh.faceZones()[zoneI].size() > 0 )
{ {
maxFaceIndex = max(mesh.faceZones()[zoneI]); maxFaceIndex = max(mesh.faceZones()[zoneI]);
} }
@ -2211,8 +2213,8 @@ void Foam::directTopoChange::addMesh
const pointZoneMesh& pointZones = mesh.pointZones(); const pointZoneMesh& pointZones = mesh.pointZones();
// Resize // Resize
points_.setSize(points_.size() + points.size()); points_.setCapacity(points_.size() + points.size());
pointMap_.setSize(pointMap_.size() + points.size()); pointMap_.setCapacity(pointMap_.size() + points.size());
pointZone_.resize(pointZone_.size() + points.size()/100); pointZone_.resize(pointZone_.size() + points.size()/100);
// Precalc offset zones // Precalc offset zones
@ -2251,11 +2253,11 @@ void Foam::directTopoChange::addMesh
// always equals nCells // always equals nCells
label nAllCells = mesh.nCells(); label nAllCells = mesh.nCells();
cellMap_.setSize(cellMap_.size() + nAllCells); cellMap_.setCapacity(cellMap_.size() + nAllCells);
cellFromPoint_.resize(cellFromPoint_.size() + nAllCells/100); cellFromPoint_.resize(cellFromPoint_.size() + nAllCells/100);
cellFromEdge_.resize(cellFromEdge_.size() + nAllCells/100); cellFromEdge_.resize(cellFromEdge_.size() + nAllCells/100);
cellFromFace_.resize(cellFromFace_.size() + nAllCells/100); cellFromFace_.resize(cellFromFace_.size() + nAllCells/100);
cellZone_.setSize(cellZone_.size() + nAllCells); cellZone_.setCapacity(cellZone_.size() + nAllCells);
// Precalc offset zones // Precalc offset zones
@ -2311,11 +2313,11 @@ void Foam::directTopoChange::addMesh
// Resize // Resize
label nAllFaces = mesh.faces().size(); label nAllFaces = mesh.faces().size();
faces_.setSize(faces_.size() + nAllFaces); faces_.setCapacity(faces_.size() + nAllFaces);
region_.setSize(region_.size() + nAllFaces); region_.setCapacity(region_.size() + nAllFaces);
faceOwner_.setSize(faceOwner_.size() + nAllFaces); faceOwner_.setCapacity(faceOwner_.size() + nAllFaces);
faceNeighbour_.setSize(faceNeighbour_.size() + nAllFaces); faceNeighbour_.setCapacity(faceNeighbour_.size() + nAllFaces);
faceMap_.setSize(faceMap_.size() + nAllFaces); faceMap_.setCapacity(faceMap_.size() + nAllFaces);
faceFromPoint_.resize(faceFromPoint_.size() + nAllFaces/100); faceFromPoint_.resize(faceFromPoint_.size() + nAllFaces/100);
faceFromEdge_.resize(faceFromEdge_.size() + nAllFaces/100); faceFromEdge_.resize(faceFromEdge_.size() + nAllFaces/100);
flipFaceFlux_.resize(flipFaceFlux_.size() + nAllFaces/100); flipFaceFlux_.resize(flipFaceFlux_.size() + nAllFaces/100);

View file

@ -28,7 +28,7 @@ Class
Description Description
A mesh which allows changes in the patch distribution of the A mesh which allows changes in the patch distribution of the
boundary faces. The change in patching is set using changePatchID. For a boundary faces. The change in patching is set using changePatchID. For a
boundary face, a new patch ID is given. boundary face, a new patch ID is given.
SourceFiles SourceFiles
repatchPolyTopoChanger.C repatchPolyTopoChanger.C
@ -47,7 +47,7 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class repatchPolyTopoChanger Declaration Class repatchPolyTopoChanger Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class repatchPolyTopoChanger class repatchPolyTopoChanger