ENH: drop polyMeshAdderTemplates.C in favour of using DynamicList::append

This commit is contained in:
Mark Olesen
2010-06-07 14:25:08 +02:00
parent 297a8b7d6c
commit 394b05a7ab
3 changed files with 12 additions and 67 deletions

View File

@ -38,7 +38,7 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * 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 void Foam::polyMeshAdder::append
( (
const labelList& map, const labelList& map,
@ -50,7 +50,7 @@ void Foam::polyMeshAdder::append
forAll(lst, i) forAll(lst, i)
{ {
label newElem = map[lst[i]]; const label newElem = map[lst[i]];
if (newElem != -1) 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 void Foam::polyMeshAdder::append
( (
const labelList& map, const labelList& map,
@ -73,7 +73,7 @@ void Foam::polyMeshAdder::append
forAll(lst, i) forAll(lst, i)
{ {
label newElem = map[lst[i]]; const label newElem = map[lst[i]];
if (newElem != -1 && findSortedIndex(sortedLst, newElem) == -1) if (newElem != -1 && findSortedIndex(sortedLst, newElem) == -1)
{ {
@ -170,8 +170,8 @@ void Foam::polyMeshAdder::mergePatchNames
) )
{ {
// Insert the mesh0 patches and zones // Insert the mesh0 patches and zones
append(patches0.names(), allPatchNames); allPatchNames.append(patches0.names());
append(patches0.types(), allPatchTypes); allPatchTypes.append(patches0.types());
// Patches // Patches
@ -924,9 +924,7 @@ void Foam::polyMeshAdder::mergePointZones
) )
{ {
zoneNames.setCapacity(pz0.size() + pz1.size()); zoneNames.setCapacity(pz0.size() + pz1.size());
zoneNames.append(pz0.names());
// Names
append(pz0.names(), zoneNames);
from1ToAll.setSize(pz1.size()); from1ToAll.setSize(pz1.size());
@ -959,7 +957,7 @@ void Foam::polyMeshAdder::mergePointZones
forAll(pz1, zoneI) forAll(pz1, zoneI)
{ {
// Relabel all points of zone and add to correct pzPoints. // Relabel all points of zone and add to correct pzPoints.
label allZoneI = from1ToAll[zoneI]; const label allZoneI = from1ToAll[zoneI];
append append
( (
@ -991,8 +989,7 @@ void Foam::polyMeshAdder::mergeFaceZones
) )
{ {
zoneNames.setCapacity(fz0.size() + fz1.size()); zoneNames.setCapacity(fz0.size() + fz1.size());
zoneNames.append(fz0.names());
append(fz0.names(), zoneNames);
from1ToAll.setSize(fz1.size()); from1ToAll.setSize(fz1.size());
@ -1092,8 +1089,7 @@ void Foam::polyMeshAdder::mergeCellZones
) )
{ {
zoneNames.setCapacity(cz0.size() + cz1.size()); zoneNames.setCapacity(cz0.size() + cz1.size());
zoneNames.append(cz0.names());
append(cz0.names(), zoneNames);
from1ToAll.setSize(cz1.size()); from1ToAll.setSize(cz1.size());
forAll(cz1, zoneI) forAll(cz1, zoneI)
@ -1108,14 +1104,14 @@ void Foam::polyMeshAdder::mergeCellZones
forAll(cz0, zoneI) forAll(cz0, zoneI)
{ {
// Insert mesh0 cells // Insert mesh0 cells
append(cz0[zoneI], czCells[zoneI]); czCells[zoneI].append(cz0[zoneI]);
} }
// Cell mapping is trivial. // Cell mapping is trivial.
forAll(cz1, zoneI) forAll(cz1, zoneI)
{ {
label allZoneI = from1ToAll[zoneI]; const label allZoneI = from1ToAll[zoneI];
append(from1ToAllCells, cz1[zoneI], czCells[allZoneI]); append(from1ToAllCells, cz1[zoneI], czCells[allZoneI]);
} }

View File

@ -66,10 +66,6 @@ private:
// Private Member Functions // 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 //- Append all mapped elements of a list to a DynamicList
static void append static void append
( (
@ -315,12 +311,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "polyMeshAdderTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -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]);
}
}
// ************************************************************************* //