STYLE: use polyPatchList instead of List<polyPatch*> in more places

This commit is contained in:
Mark Olesen
2022-09-23 11:33:30 +02:00
parent 3c7088b6c0
commit 5130c7bcbc
26 changed files with 388 additions and 238 deletions

View File

@ -191,7 +191,7 @@ int main(int argc, char *argv[])
const PtrList<boundaryPatch>& patches = bMesh.patches();
// Create new list of patches with old ones first
List<polyPatch*> newPatchPtrList(patches.size());
polyPatchList newPatches(patches.size());
newPatchi = 0;
@ -200,34 +200,41 @@ int main(int argc, char *argv[])
{
const polyPatch& patch = mesh.boundaryMesh()[patchi];
newPatchPtrList[newPatchi] =
newPatches.set
(
newPatchi,
patch.clone
(
mesh.boundaryMesh(),
newPatchi,
patch.size(),
patch.start()
).ptr();
)
);
newPatchi++;
++newPatchi;
}
// Add new ones with empty size.
for (label patchi = newPatchi; patchi < patches.size(); patchi++)
{
const boundaryPatch& bp = patches[patchi];
const word& patchName = patches[patchi].name();
newPatchPtrList[newPatchi] = polyPatch::New
newPatches.set
(
polyPatch::typeName,
bp.name(),
0,
mesh.nFaces(),
newPatchi,
mesh.boundaryMesh()
).ptr();
polyPatch::New
(
polyPatch::typeName,
patchName,
0,
mesh.nFaces(),
newPatchi,
mesh.boundaryMesh()
)
);
newPatchi++;
++newPatchi;
}
if (!overwrite)
@ -238,7 +245,7 @@ int main(int argc, char *argv[])
// Change patches
repatchPolyTopoChanger polyMeshRepatcher(mesh);
polyMeshRepatcher.changePatches(newPatchPtrList);
polyMeshRepatcher.changePatches(newPatches);
// Change face ordering

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2016 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -136,46 +136,55 @@ void Foam::mergePolyMesh::sortProcessorPatches()
const polyBoundaryMesh& oldPatches = boundaryMesh();
DynamicList<polyPatch*> newPatches(oldPatches.size());
polyPatchList newPatches(oldPatches.size());
labelList oldToSorted(oldPatches.size());
label nPatches = 0;
forAll(oldPatches, patchi)
{
const polyPatch& pp = oldPatches[patchi];
if (!isA<processorPolyPatch>(pp))
{
oldToSorted[patchi] = newPatches.size();
newPatches.append
newPatches.set
(
nPatches,
pp.clone
(
oldPatches,
oldToSorted[patchi],
nPatches,
0,
nInternalFaces()
).ptr()
)
);
oldToSorted[patchi] = nPatches;
++nPatches;
}
}
forAll(oldPatches, patchi)
{
const polyPatch& pp = oldPatches[patchi];
if (isA<processorPolyPatch>(pp))
{
oldToSorted[patchi] = newPatches.size();
newPatches.append
newPatches.set
(
nPatches,
pp.clone
(
oldPatches,
oldToSorted[patchi],
0,
nInternalFaces()
).ptr()
)
);
oldToSorted[patchi] = nPatches;
++nPatches;
}
}
@ -461,7 +470,7 @@ void Foam::mergePolyMesh::merge()
{
Info<< "Copying old patches" << endl;
List<polyPatch*> newPatches(patchNames_.size());
polyPatchList newPatches(patchNames_.size());
const polyBoundaryMesh& oldPatches = boundaryMesh();
@ -470,7 +479,11 @@ void Foam::mergePolyMesh::merge()
for (patchi = 0; patchi < oldPatches.size(); patchi++)
{
newPatches[patchi] = oldPatches[patchi].clone(oldPatches).ptr();
newPatches.set
(
patchi,
oldPatches[patchi].clone(oldPatches)
);
}
Info<< "Adding new patches. " << endl;
@ -487,15 +500,18 @@ void Foam::mergePolyMesh::merge()
dict.set("nFaces", 0);
dict.set("startFace", endOfLastPatch);
newPatches[patchi] =
newPatches.set
(
polyPatch::New
patchi,
(
patchNames_[patchi],
dict,
patchi,
oldPatches
).ptr()
polyPatch::New
(
patchNames_[patchi],
dict,
patchi,
oldPatches
)
)
);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2017-2018 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -404,20 +404,24 @@ Foam::mirrorFvMesh::mirrorFvMesh
fvMesh& pMesh = mirrorMeshPtr_();
// Add the boundary patches
List<polyPatch*> p(newPatchSizes.size());
polyPatchList newPatches(newPatchSizes.size());
forAll(p, patchi)
forAll(newPatches, patchi)
{
p[patchi] = boundaryMesh()[patchi].clone
newPatches.set
(
pMesh.boundaryMesh(),
patchi,
newPatchSizes[patchi],
newPatchStarts[patchi]
).ptr();
boundaryMesh()[patchi].clone
(
pMesh.boundaryMesh(),
patchi,
newPatchSizes[patchi],
newPatchStarts[patchi]
)
);
}
pMesh.addPatches(p);
pMesh.addPatches(newPatches);
}