From 41bbcb633749f2e35f45a78b34e01e1ed8d7e98e Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 24 Nov 2008 17:22:37 +0100 Subject: [PATCH] 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&) - 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 --- .../test/DynamicList/DynamicListTest.C | 51 +++++-- applications/test/xfer/xferListTest.C | 4 +- .../manipulation/mergeMeshes/mergePolyMesh.C | 6 +- .../decomposePar/domainDecomposition.C | 8 +- .../Lists/DynamicList/DynamicList.C | 14 +- .../Lists/DynamicList/DynamicList.H | 30 ++--- .../Lists/DynamicList/DynamicListI.H | 124 ++++++++++++------ src/OpenFOAM/containers/Lists/UList/UListI.H | 4 +- src/OpenFOAM/containers/Lists/UList/UListIO.C | 2 +- .../meshes/meshShapes/face/faceTemplates.C | 4 +- .../primitiveMesh/primitiveMeshCellPoints.C | 21 +-- .../meshes/primitiveMesh/primitiveMeshEdges.C | 47 +++---- .../primitiveMesh/primitiveMeshPointCells.C | 40 +++--- .../primitiveMesh/primitiveMeshPointPoints.C | 22 ++-- src/conversion/polyDualMesh/polyDualMesh.C | 8 +- src/dynamicMesh/boundaryMesh/boundaryMesh.C | 2 +- .../meshCut/cellLooper/topoCellLooper.C | 25 ++-- src/dynamicMesh/polyMeshAdder/polyMeshAdder.C | 24 ++-- .../polyMeshAdder/polyMeshAdderTemplates.C | 2 +- .../polyTopoChange/polyTopoChange/hexRef8.C | 4 +- .../polyTopoChange/polyTopoChange.C | 26 +--- .../polyTopoChange/refinementHistory.C | 2 +- src/meshTools/indexedOctree/indexedOctree.C | 2 +- .../surfaceFeatures/surfaceFeatures.C | 27 ++-- .../surfaceFormats/tri/TRIsurfaceFormatCore.C | 1 + 25 files changed, 263 insertions(+), 237 deletions(-) diff --git a/applications/test/DynamicList/DynamicListTest.C b/applications/test/DynamicList/DynamicListTest.C index f08f2d54a7..2d4efa5e1f 100644 --- a/applications/test/DynamicList/DynamicListTest.C +++ b/applications/test/DynamicList/DynamicListTest.C @@ -43,11 +43,11 @@ int main(int argc, char *argv[]) ldl[0](3) = 3; ldl[0](1) = 1; - ldl[0].allocSize(5); // increase allocated size - ldl[1].allocSize(10); // increase allocated size - ldl[0].reserve(15); // should increase allocated size - ldl[1].reserve(5); // should not decrease allocated size - ldl[1](3) = 2; // allocates space and sets value + ldl[0].setCapacity(5); // increase allocated size + ldl[1].setCapacity(10); // increase allocated size + ldl[0].reserve(15); // should increase allocated size + ldl[1].reserve(5); // should not decrease allocated size + ldl[1](3) = 2; // allocates space and sets value // this works without a segfault, but doesn't change the list size ldl[0][4] = 4; @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) Info<< "" << ldl << "" << nl << "sizes: "; forAll(ldl, i) { - Info<< " " << ldl[i].size() << "/" << ldl[i].allocSize(); + Info<< " " << ldl[i].size() << "/" << ldl[i].capacity(); } Info<< endl; @@ -68,7 +68,7 @@ int main(int argc, char *argv[]) Info<< "" << ldl << "" << nl << "sizes: "; forAll(ldl, i) { - Info<< " " << ldl[i].size() << "/" << ldl[i].allocSize(); + Info<< " " << ldl[i].size() << "/" << ldl[i].capacity(); } Info<< endl; @@ -83,10 +83,10 @@ int main(int argc, char *argv[]) { dlA.append(i); } - dlA.allocSize(10); + dlA.setCapacity(10); Info<< "" << dlA << "" << nl << "sizes: " - << " " << dlA.size() << "/" << dlA.allocSize() << endl; + << " " << dlA.size() << "/" << dlA.capacity() << endl; dlB.transfer(dlA); @@ -96,9 +96,9 @@ int main(int argc, char *argv[]) Info<< "Transferred to dlB" << endl; Info<< "" << dlA << "" << nl << "sizes: " - << " " << dlA.size() << "/" << dlA.allocSize() << endl; + << " " << dlA.size() << "/" << dlA.capacity() << endl; Info<< "" << dlB << "" << nl << "sizes: " - << " " << dlB.size() << "/" << dlB.allocSize() << endl; + << " " << dlB.size() << "/" << dlB.capacity() << endl; // try with a normal list: List