From 394b05a7ab109e3d8043f9ed4220b3d97899d4f2 Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@Germany> Date: Mon, 7 Jun 2010 14:25:08 +0200 Subject: [PATCH] ENH: drop polyMeshAdderTemplates.C in favour of using DynamicList::append --- src/dynamicMesh/polyMeshAdder/polyMeshAdder.C | 28 ++++++------- src/dynamicMesh/polyMeshAdder/polyMeshAdder.H | 10 ----- .../polyMeshAdder/polyMeshAdderTemplates.C | 41 ------------------- 3 files changed, 12 insertions(+), 67 deletions(-) delete mode 100644 src/dynamicMesh/polyMeshAdder/polyMeshAdderTemplates.C diff --git a/src/dynamicMesh/polyMeshAdder/polyMeshAdder.C b/src/dynamicMesh/polyMeshAdder/polyMeshAdder.C index 76e0bd0f894..80b3ab92986 100644 --- a/src/dynamicMesh/polyMeshAdder/polyMeshAdder.C +++ b/src/dynamicMesh/polyMeshAdder/polyMeshAdder.C @@ -38,7 +38,7 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -//- Append all mapped elements of a list to a DynamicList +// Append all mapped elements of a list to a DynamicList void Foam::polyMeshAdder::append ( const labelList& map, @@ -50,7 +50,7 @@ void Foam::polyMeshAdder::append forAll(lst, i) { - label newElem = map[lst[i]]; + const label newElem = map[lst[i]]; if (newElem != -1) { @@ -60,7 +60,7 @@ void Foam::polyMeshAdder::append } -//- Append all mapped elements of a list to a DynamicList +// Append all mapped elements of a list to a DynamicList void Foam::polyMeshAdder::append ( const labelList& map, @@ -73,7 +73,7 @@ void Foam::polyMeshAdder::append forAll(lst, i) { - label newElem = map[lst[i]]; + const label newElem = map[lst[i]]; if (newElem != -1 && findSortedIndex(sortedLst, newElem) == -1) { @@ -170,8 +170,8 @@ void Foam::polyMeshAdder::mergePatchNames ) { // Insert the mesh0 patches and zones - append(patches0.names(), allPatchNames); - append(patches0.types(), allPatchTypes); + allPatchNames.append(patches0.names()); + allPatchTypes.append(patches0.types()); // Patches @@ -924,9 +924,7 @@ void Foam::polyMeshAdder::mergePointZones ) { zoneNames.setCapacity(pz0.size() + pz1.size()); - - // Names - append(pz0.names(), zoneNames); + zoneNames.append(pz0.names()); from1ToAll.setSize(pz1.size()); @@ -959,7 +957,7 @@ void Foam::polyMeshAdder::mergePointZones forAll(pz1, zoneI) { // Relabel all points of zone and add to correct pzPoints. - label allZoneI = from1ToAll[zoneI]; + const label allZoneI = from1ToAll[zoneI]; append ( @@ -991,8 +989,7 @@ void Foam::polyMeshAdder::mergeFaceZones ) { zoneNames.setCapacity(fz0.size() + fz1.size()); - - append(fz0.names(), zoneNames); + zoneNames.append(fz0.names()); from1ToAll.setSize(fz1.size()); @@ -1092,8 +1089,7 @@ void Foam::polyMeshAdder::mergeCellZones ) { zoneNames.setCapacity(cz0.size() + cz1.size()); - - append(cz0.names(), zoneNames); + zoneNames.append(cz0.names()); from1ToAll.setSize(cz1.size()); forAll(cz1, zoneI) @@ -1108,14 +1104,14 @@ void Foam::polyMeshAdder::mergeCellZones forAll(cz0, zoneI) { // Insert mesh0 cells - append(cz0[zoneI], czCells[zoneI]); + czCells[zoneI].append(cz0[zoneI]); } // Cell mapping is trivial. forAll(cz1, zoneI) { - label allZoneI = from1ToAll[zoneI]; + const label allZoneI = from1ToAll[zoneI]; append(from1ToAllCells, cz1[zoneI], czCells[allZoneI]); } diff --git a/src/dynamicMesh/polyMeshAdder/polyMeshAdder.H b/src/dynamicMesh/polyMeshAdder/polyMeshAdder.H index 90612cad909..1283da8b577 100644 --- a/src/dynamicMesh/polyMeshAdder/polyMeshAdder.H +++ b/src/dynamicMesh/polyMeshAdder/polyMeshAdder.H @@ -66,10 +66,6 @@ private: // Private Member Functions - //- Append all elements of a list to a DynamicList - template<class T> - static void append(const List<T>&, DynamicList<T>&); - //- Append all mapped elements of a list to a DynamicList static void append ( @@ -315,12 +311,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#ifdef NoRepository -# include "polyMeshAdderTemplates.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - #endif // ************************************************************************* // diff --git a/src/dynamicMesh/polyMeshAdder/polyMeshAdderTemplates.C b/src/dynamicMesh/polyMeshAdder/polyMeshAdderTemplates.C deleted file mode 100644 index a5a4ff4e80d..00000000000 --- a/src/dynamicMesh/polyMeshAdder/polyMeshAdderTemplates.C +++ /dev/null @@ -1,41 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -//- Append all elements of a list to a DynamicList -template<class T> -void Foam::polyMeshAdder::append(const List<T>& lst, DynamicList<T>& dynLst) -{ - dynLst.setCapacity(dynLst.size() + lst.size()); - - forAll(lst, i) - { - dynLst.append(lst[i]); - } -} - -// ************************************************************************* // -- GitLab