DynamicList changes.

- setSize() adjusts the addressable length only.
  Changed setSize(label) usage to setCapacity(label) or reserve(label)
  throughout. The final name (capacity vs. storageSize() vs. whatever) can
  easily be decided at a later date.
- added setSize(label, const T&), which may still not be really useful, but
  is at least now meaningful
- made shrink() a bit more legible.
- added append(UList<T>&)
- copying from a UList avoids reallocations where possible

The following bits of code continue to use the DynamicList::setSize(), but
appear to be legitimate (or the corresponding code itself needs rethinking).

  src/OpenFOAM/meshes/primitiveMesh/primitiveMeshPointCells.C:167: error: within this context
  src/OpenFOAM/lnInclude/faceTemplates.C:44: error: within this context
  src/surfMesh/surfaceFormats/tri/TRIsurfaceFormatCore.C:178: error: within this context
  src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:737: error: within this context
  src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:741: error: within this context
  src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:745: error: within this context
  src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:749: error: within this context
  src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:754: error: within this context
  src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:935: error: within this context
  src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:940: error: within this context
  src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:1041: error: within this context
  src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:1046: error: within this context
  src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:2161: error: within this context
  src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:2162: error: within this context
  src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:2201: error: within this context
  src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:2205: error: within this context
  src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:2261: error: within this context
  src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:2262: error: within this context
  src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:2263: error: within this context
  src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:2264: error: within this context
  src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:2265: error: within this context
  src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:3011: error: within this context
  src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:3076: error: within this context
  src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:3244: error: within this context
  src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C:3371: error: within this context
  src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C:73: error: within this context
  src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C:91: error: within this context
  src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C:73: error: within this context
  src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C:91: error: within this context
This commit is contained in:
Mark Olesen
2008-11-24 17:22:37 +01:00
parent b7e349a727
commit 41bbcb6337
25 changed files with 263 additions and 237 deletions

View File

@ -47,7 +47,7 @@ void Foam::polyMeshAdder::append
DynamicList<label>& dynLst
)
{
dynLst.setSize(dynLst.size() + lst.size());
dynLst.setCapacity(dynLst.size() + lst.size());
forAll(lst, i)
{
@ -902,7 +902,7 @@ void Foam::polyMeshAdder::mergePointZones
List<DynamicList<label> >& pzPoints
)
{
zoneNames.setSize(pz0.size() + pz1.size());
zoneNames.setCapacity(pz0.size() + pz1.size());
// Names
append(pz0.names(), zoneNames);
@ -922,7 +922,7 @@ void Foam::polyMeshAdder::mergePointZones
{
DynamicList<label>& newZone = pzPoints[zoneI];
newZone.setSize(pz0[zoneI].size());
newZone.setCapacity(pz0[zoneI].size());
append(from0ToAllPoints, pz0[zoneI], newZone);
}
@ -933,7 +933,7 @@ void Foam::polyMeshAdder::mergePointZones
// Relabel all points of zone and add to correct pzPoints.
DynamicList<label>& newZone = pzPoints[from1ToAll[zoneI]];
newZone.setSize(newZone.size() + pz1[zoneI].size());
newZone.setCapacity(newZone.size() + pz1[zoneI].size());
append(from1ToAllPoints, pz1[zoneI], newZone);
}
@ -958,7 +958,7 @@ void Foam::polyMeshAdder::mergeFaceZones
List<DynamicList<bool> >& fzFlips
)
{
zoneNames.setSize(fz0.size() + fz1.size());
zoneNames.setCapacity(fz0.size() + fz1.size());
append(fz0.names(), zoneNames);
@ -979,8 +979,8 @@ void Foam::polyMeshAdder::mergeFaceZones
DynamicList<label>& newZone = fzFaces[zoneI];
DynamicList<bool>& newFlip = fzFlips[zoneI];
newZone.setSize(fz0[zoneI].size());
newFlip.setSize(newZone.size());
newZone.setCapacity(fz0[zoneI].size());
newFlip.setCapacity(newZone.size());
const labelList& addressing = fz0[zoneI];
const boolList& flipMap = fz0[zoneI].flipMap();
@ -1003,8 +1003,8 @@ void Foam::polyMeshAdder::mergeFaceZones
DynamicList<label>& newZone = fzFaces[from1ToAll[zoneI]];
DynamicList<bool>& newFlip = fzFlips[from1ToAll[zoneI]];
newZone.setSize(newZone.size() + fz1[zoneI].size());
newFlip.setSize(newZone.size());
newZone.setCapacity(newZone.size() + fz1[zoneI].size());
newFlip.setCapacity(newZone.size());
const labelList& addressing = fz1[zoneI];
const boolList& flipMap = fz1[zoneI].flipMap();
@ -1040,7 +1040,7 @@ void Foam::polyMeshAdder::mergeCellZones
List<DynamicList<label> >& czCells
)
{
zoneNames.setSize(cz0.size() + cz1.size());
zoneNames.setCapacity(cz0.size() + cz1.size());
append(cz0.names(), zoneNames);
@ -1056,7 +1056,7 @@ void Foam::polyMeshAdder::mergeCellZones
czCells.setSize(zoneNames.size());
forAll(cz0, zoneI)
{
czCells[zoneI].setSize(cz0[zoneI].size());
czCells[zoneI].setCapacity(cz0[zoneI].size());
// Insert mesh0 cells
append(cz0[zoneI], czCells[zoneI]);
}
@ -1067,7 +1067,7 @@ void Foam::polyMeshAdder::mergeCellZones
{
DynamicList<label>& newZone = czCells[from1ToAll[zoneI]];
newZone.setSize(newZone.size() + cz1[zoneI].size());
newZone.setCapacity(newZone.size() + cz1[zoneI].size());
append(from1ToAllCells, cz1[zoneI], newZone);
}