mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: use polyPatchList instead of List<polyPatch*> in more places
This commit is contained in:
@ -226,14 +226,18 @@ int main(int argc, char *argv[])
|
|||||||
// Add the boundary patches
|
// Add the boundary patches
|
||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
|
|
||||||
List<polyPatch*> p(patches.size());
|
polyPatchList newPatches(patches.size());
|
||||||
|
|
||||||
forAll(p, patchi)
|
forAll(newPatches, patchi)
|
||||||
{
|
{
|
||||||
p[patchi] = patches[patchi].clone(fMesh.boundaryMesh()).ptr();
|
newPatches.set
|
||||||
|
(
|
||||||
|
patchi,
|
||||||
|
patches[patchi].clone(fMesh.boundaryMesh())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fMesh.addFvPatches(p);
|
fMesh.addFvPatches(newPatches);
|
||||||
|
|
||||||
|
|
||||||
// Refinement level
|
// Refinement level
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -205,34 +205,43 @@ label addPatch(polyMesh& mesh, const word& patchName)
|
|||||||
{
|
{
|
||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
|
|
||||||
List<polyPatch*> newPatches(patches.size() + 1);
|
polyPatchList newPatches(patches.size() + 1);
|
||||||
|
|
||||||
|
label nPatches = 0;
|
||||||
|
|
||||||
// Add empty patch as 0th entry (Note: only since subsetMesh wants this)
|
// Add empty patch as 0th entry (Note: only since subsetMesh wants this)
|
||||||
patchi = 0;
|
patchi = 0;
|
||||||
|
|
||||||
newPatches[patchi] =
|
|
||||||
new emptyPolyPatch
|
|
||||||
(
|
|
||||||
Foam::word(patchName),
|
|
||||||
0,
|
|
||||||
mesh.nInternalFaces(),
|
|
||||||
patchi,
|
|
||||||
patches,
|
|
||||||
emptyPolyPatch::typeName
|
|
||||||
);
|
|
||||||
|
|
||||||
forAll(patches, i)
|
|
||||||
{
|
{
|
||||||
const polyPatch& pp = patches[i];
|
newPatches.set
|
||||||
|
(
|
||||||
|
nPatches,
|
||||||
|
new emptyPolyPatch
|
||||||
|
(
|
||||||
|
patchName,
|
||||||
|
0,
|
||||||
|
mesh.nInternalFaces(),
|
||||||
|
nPatches,
|
||||||
|
patches,
|
||||||
|
emptyPolyPatch::typeName
|
||||||
|
)
|
||||||
|
);
|
||||||
|
++nPatches;
|
||||||
|
}
|
||||||
|
|
||||||
newPatches[i+1] =
|
for (const polyPatch& pp : patches)
|
||||||
|
{
|
||||||
|
newPatches.set
|
||||||
|
(
|
||||||
|
nPatches,
|
||||||
pp.clone
|
pp.clone
|
||||||
(
|
(
|
||||||
patches,
|
patches,
|
||||||
i+1,
|
nPatches,
|
||||||
pp.size(),
|
pp.size(),
|
||||||
pp.start()
|
pp.start()
|
||||||
).ptr();
|
)
|
||||||
|
);
|
||||||
|
++nPatches;
|
||||||
}
|
}
|
||||||
|
|
||||||
mesh.removeBoundary();
|
mesh.removeBoundary();
|
||||||
|
|||||||
@ -1678,7 +1678,7 @@ int main(int argc, char *argv[])
|
|||||||
label defaultPatchID = mesh.boundaryMesh().findPatchID(defaultFacesName);
|
label defaultPatchID = mesh.boundaryMesh().findPatchID(defaultFacesName);
|
||||||
if (mesh.boundaryMesh()[defaultPatchID].size() == 0)
|
if (mesh.boundaryMesh()[defaultPatchID].size() == 0)
|
||||||
{
|
{
|
||||||
List<polyPatch*> newPatchPtrList((mesh.boundaryMesh().size() - 1));
|
polyPatchList newPatches((mesh.boundaryMesh().size() - 1));
|
||||||
label newPatchi = 0;
|
label newPatchi = 0;
|
||||||
forAll(mesh.boundaryMesh(), patchi)
|
forAll(mesh.boundaryMesh(), patchi)
|
||||||
{
|
{
|
||||||
@ -1686,18 +1686,21 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
const polyPatch& patch = mesh.boundaryMesh()[patchi];
|
const polyPatch& patch = mesh.boundaryMesh()[patchi];
|
||||||
|
|
||||||
newPatchPtrList[newPatchi] = patch.clone
|
newPatches.set
|
||||||
(
|
(
|
||||||
mesh.boundaryMesh(),
|
|
||||||
newPatchi,
|
newPatchi,
|
||||||
patch.size(),
|
patch.clone
|
||||||
patch.start()
|
(
|
||||||
).ptr();
|
mesh.boundaryMesh(),
|
||||||
|
newPatchi,
|
||||||
newPatchi++;
|
patch.size(),
|
||||||
|
patch.start()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
++newPatchi;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
repatcher.changePatches(newPatchPtrList);
|
repatcher.changePatches(newPatches);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the precision of the points data to 10
|
// Set the precision of the points data to 10
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2013-2016 OpenFOAM Foundation
|
Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2021 OpenCFD Ltd.
|
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -167,28 +167,32 @@ int main(int argc, char *argv[])
|
|||||||
);
|
);
|
||||||
|
|
||||||
Info<< "Constructing patches." << endl;
|
Info<< "Constructing patches." << endl;
|
||||||
List<polyPatch*> patches(poly2DMesh.patchNames().size());
|
polyPatchList newPatches(poly2DMesh.patchNames().size());
|
||||||
label countPatches = 0;
|
label nPatches = 0;
|
||||||
|
|
||||||
forAll(patches, patchi)
|
forAll(newPatches, patchi)
|
||||||
{
|
{
|
||||||
if (poly2DMesh.patchSizes()[patchi] != 0)
|
if (poly2DMesh.patchSizes()[patchi] != 0)
|
||||||
{
|
{
|
||||||
patches[countPatches] = new polyPatch
|
newPatches.set
|
||||||
(
|
(
|
||||||
poly2DMesh.patchNames()[patchi],
|
nPatches,
|
||||||
poly2DMesh.patchSizes()[patchi],
|
new polyPatch
|
||||||
poly2DMesh.patchStarts()[patchi],
|
(
|
||||||
countPatches,
|
poly2DMesh.patchNames()[patchi],
|
||||||
pMesh.boundaryMesh(),
|
poly2DMesh.patchSizes()[patchi],
|
||||||
word::null
|
poly2DMesh.patchStarts()[patchi],
|
||||||
|
nPatches,
|
||||||
|
pMesh.boundaryMesh(),
|
||||||
|
word::null
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
countPatches++;
|
++nPatches;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
patches.setSize(countPatches);
|
newPatches.resize(nPatches);
|
||||||
pMesh.addPatches(patches);
|
pMesh.addPatches(newPatches);
|
||||||
|
|
||||||
if (extrude)
|
if (extrude)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -191,7 +191,7 @@ int main(int argc, char *argv[])
|
|||||||
const PtrList<boundaryPatch>& patches = bMesh.patches();
|
const PtrList<boundaryPatch>& patches = bMesh.patches();
|
||||||
|
|
||||||
// Create new list of patches with old ones first
|
// Create new list of patches with old ones first
|
||||||
List<polyPatch*> newPatchPtrList(patches.size());
|
polyPatchList newPatches(patches.size());
|
||||||
|
|
||||||
newPatchi = 0;
|
newPatchi = 0;
|
||||||
|
|
||||||
@ -200,34 +200,41 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
const polyPatch& patch = mesh.boundaryMesh()[patchi];
|
const polyPatch& patch = mesh.boundaryMesh()[patchi];
|
||||||
|
|
||||||
newPatchPtrList[newPatchi] =
|
newPatches.set
|
||||||
|
(
|
||||||
|
newPatchi,
|
||||||
patch.clone
|
patch.clone
|
||||||
(
|
(
|
||||||
mesh.boundaryMesh(),
|
mesh.boundaryMesh(),
|
||||||
newPatchi,
|
newPatchi,
|
||||||
patch.size(),
|
patch.size(),
|
||||||
patch.start()
|
patch.start()
|
||||||
).ptr();
|
)
|
||||||
|
);
|
||||||
|
|
||||||
newPatchi++;
|
++newPatchi;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add new ones with empty size.
|
// Add new ones with empty size.
|
||||||
for (label patchi = newPatchi; patchi < patches.size(); patchi++)
|
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,
|
newPatchi,
|
||||||
mesh.boundaryMesh()
|
polyPatch::New
|
||||||
).ptr();
|
(
|
||||||
|
polyPatch::typeName,
|
||||||
|
patchName,
|
||||||
|
0,
|
||||||
|
mesh.nFaces(),
|
||||||
|
newPatchi,
|
||||||
|
mesh.boundaryMesh()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
newPatchi++;
|
++newPatchi;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!overwrite)
|
if (!overwrite)
|
||||||
@ -238,7 +245,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Change patches
|
// Change patches
|
||||||
repatchPolyTopoChanger polyMeshRepatcher(mesh);
|
repatchPolyTopoChanger polyMeshRepatcher(mesh);
|
||||||
polyMeshRepatcher.changePatches(newPatchPtrList);
|
polyMeshRepatcher.changePatches(newPatches);
|
||||||
|
|
||||||
|
|
||||||
// Change face ordering
|
// Change face ordering
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2016 OpenCFD Ltd.
|
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -136,46 +136,55 @@ void Foam::mergePolyMesh::sortProcessorPatches()
|
|||||||
|
|
||||||
const polyBoundaryMesh& oldPatches = boundaryMesh();
|
const polyBoundaryMesh& oldPatches = boundaryMesh();
|
||||||
|
|
||||||
DynamicList<polyPatch*> newPatches(oldPatches.size());
|
polyPatchList newPatches(oldPatches.size());
|
||||||
|
|
||||||
labelList oldToSorted(oldPatches.size());
|
labelList oldToSorted(oldPatches.size());
|
||||||
|
|
||||||
|
label nPatches = 0;
|
||||||
|
|
||||||
forAll(oldPatches, patchi)
|
forAll(oldPatches, patchi)
|
||||||
{
|
{
|
||||||
const polyPatch& pp = oldPatches[patchi];
|
const polyPatch& pp = oldPatches[patchi];
|
||||||
|
|
||||||
if (!isA<processorPolyPatch>(pp))
|
if (!isA<processorPolyPatch>(pp))
|
||||||
{
|
{
|
||||||
oldToSorted[patchi] = newPatches.size();
|
newPatches.set
|
||||||
newPatches.append
|
|
||||||
(
|
(
|
||||||
|
nPatches,
|
||||||
pp.clone
|
pp.clone
|
||||||
(
|
(
|
||||||
oldPatches,
|
oldPatches,
|
||||||
oldToSorted[patchi],
|
nPatches,
|
||||||
0,
|
0,
|
||||||
nInternalFaces()
|
nInternalFaces()
|
||||||
).ptr()
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
oldToSorted[patchi] = nPatches;
|
||||||
|
++nPatches;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(oldPatches, patchi)
|
forAll(oldPatches, patchi)
|
||||||
{
|
{
|
||||||
const polyPatch& pp = oldPatches[patchi];
|
const polyPatch& pp = oldPatches[patchi];
|
||||||
|
|
||||||
if (isA<processorPolyPatch>(pp))
|
if (isA<processorPolyPatch>(pp))
|
||||||
{
|
{
|
||||||
oldToSorted[patchi] = newPatches.size();
|
newPatches.set
|
||||||
newPatches.append
|
|
||||||
(
|
(
|
||||||
|
nPatches,
|
||||||
pp.clone
|
pp.clone
|
||||||
(
|
(
|
||||||
oldPatches,
|
oldPatches,
|
||||||
oldToSorted[patchi],
|
oldToSorted[patchi],
|
||||||
0,
|
0,
|
||||||
nInternalFaces()
|
nInternalFaces()
|
||||||
).ptr()
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
oldToSorted[patchi] = nPatches;
|
||||||
|
++nPatches;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,7 +470,7 @@ void Foam::mergePolyMesh::merge()
|
|||||||
{
|
{
|
||||||
Info<< "Copying old patches" << endl;
|
Info<< "Copying old patches" << endl;
|
||||||
|
|
||||||
List<polyPatch*> newPatches(patchNames_.size());
|
polyPatchList newPatches(patchNames_.size());
|
||||||
|
|
||||||
const polyBoundaryMesh& oldPatches = boundaryMesh();
|
const polyBoundaryMesh& oldPatches = boundaryMesh();
|
||||||
|
|
||||||
@ -470,7 +479,11 @@ void Foam::mergePolyMesh::merge()
|
|||||||
|
|
||||||
for (patchi = 0; patchi < oldPatches.size(); patchi++)
|
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;
|
Info<< "Adding new patches. " << endl;
|
||||||
@ -487,15 +500,18 @@ void Foam::mergePolyMesh::merge()
|
|||||||
dict.set("nFaces", 0);
|
dict.set("nFaces", 0);
|
||||||
dict.set("startFace", endOfLastPatch);
|
dict.set("startFace", endOfLastPatch);
|
||||||
|
|
||||||
newPatches[patchi] =
|
newPatches.set
|
||||||
(
|
(
|
||||||
polyPatch::New
|
patchi,
|
||||||
(
|
(
|
||||||
patchNames_[patchi],
|
polyPatch::New
|
||||||
dict,
|
(
|
||||||
patchi,
|
patchNames_[patchi],
|
||||||
oldPatches
|
dict,
|
||||||
).ptr()
|
patchi,
|
||||||
|
oldPatches
|
||||||
|
)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2018 OpenCFD Ltd.
|
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -404,20 +404,24 @@ Foam::mirrorFvMesh::mirrorFvMesh
|
|||||||
fvMesh& pMesh = mirrorMeshPtr_();
|
fvMesh& pMesh = mirrorMeshPtr_();
|
||||||
|
|
||||||
// Add the boundary patches
|
// 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,
|
patchi,
|
||||||
newPatchSizes[patchi],
|
boundaryMesh()[patchi].clone
|
||||||
newPatchStarts[patchi]
|
(
|
||||||
).ptr();
|
pMesh.boundaryMesh(),
|
||||||
|
patchi,
|
||||||
|
newPatchSizes[patchi],
|
||||||
|
newPatchStarts[patchi]
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pMesh.addPatches(p);
|
pMesh.addPatches(newPatches);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -58,7 +58,7 @@ label addPatch(polyMesh& mesh, const word& patchName)
|
|||||||
{
|
{
|
||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
|
|
||||||
List<polyPatch*> newPatches(patches.size() + 1);
|
polyPatchList newPatches(patches.size() + 1);
|
||||||
|
|
||||||
patchi = 0;
|
patchi = 0;
|
||||||
|
|
||||||
@ -67,20 +67,25 @@ label addPatch(polyMesh& mesh, const word& patchName)
|
|||||||
{
|
{
|
||||||
const polyPatch& pp = patches[i];
|
const polyPatch& pp = patches[i];
|
||||||
|
|
||||||
newPatches[patchi] =
|
newPatches.set
|
||||||
|
(
|
||||||
|
patchi,
|
||||||
pp.clone
|
pp.clone
|
||||||
(
|
(
|
||||||
patches,
|
patches,
|
||||||
patchi,
|
patchi,
|
||||||
pp.size(),
|
pp.size(),
|
||||||
pp.start()
|
pp.start()
|
||||||
).ptr();
|
)
|
||||||
|
);
|
||||||
|
|
||||||
patchi++;
|
patchi++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add zero-sized patch
|
// Add zero-sized patch
|
||||||
newPatches[patchi] =
|
newPatches.set
|
||||||
|
(
|
||||||
|
patchi,
|
||||||
new polyPatch
|
new polyPatch
|
||||||
(
|
(
|
||||||
patchName,
|
patchName,
|
||||||
@ -89,7 +94,8 @@ label addPatch(polyMesh& mesh, const word& patchName)
|
|||||||
patchi,
|
patchi,
|
||||||
patches,
|
patches,
|
||||||
polyPatch::typeName
|
polyPatch::typeName
|
||||||
);
|
)
|
||||||
|
);
|
||||||
|
|
||||||
mesh.removeBoundary();
|
mesh.removeBoundary();
|
||||||
mesh.addPatches(newPatches);
|
mesh.addPatches(newPatches);
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -2420,7 +2420,7 @@ void Foam::ccm::reader::addPatches
|
|||||||
{
|
{
|
||||||
// Create patches
|
// Create patches
|
||||||
// use patch types to determine what Foam types to generate
|
// use patch types to determine what Foam types to generate
|
||||||
List<polyPatch*> newPatches(origBndId_.size());
|
polyPatchList newPatches(origBndId_.size());
|
||||||
|
|
||||||
label meshFaceI = nInternalFaces_;
|
label meshFaceI = nInternalFaces_;
|
||||||
wordHashSet hashedNames(origBndId_.size());
|
wordHashSet hashedNames(origBndId_.size());
|
||||||
@ -2463,7 +2463,9 @@ void Foam::ccm::reader::addPatches
|
|||||||
|
|
||||||
if (patchType == "wall")
|
if (patchType == "wall")
|
||||||
{
|
{
|
||||||
newPatches[patchI] =
|
newPatches.set
|
||||||
|
(
|
||||||
|
patchI,
|
||||||
new wallPolyPatch
|
new wallPolyPatch
|
||||||
(
|
(
|
||||||
patchName,
|
patchName,
|
||||||
@ -2472,11 +2474,14 @@ void Foam::ccm::reader::addPatches
|
|||||||
patchI,
|
patchI,
|
||||||
mesh.boundaryMesh(),
|
mesh.boundaryMesh(),
|
||||||
patchType
|
patchType
|
||||||
);
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else if (patchType == "symmetry")
|
else if (patchType == "symmetry")
|
||||||
{
|
{
|
||||||
newPatches[patchI] =
|
newPatches.set
|
||||||
|
(
|
||||||
|
patchI,
|
||||||
new symmetryPolyPatch
|
new symmetryPolyPatch
|
||||||
(
|
(
|
||||||
patchName,
|
patchName,
|
||||||
@ -2485,12 +2490,15 @@ void Foam::ccm::reader::addPatches
|
|||||||
patchI,
|
patchI,
|
||||||
mesh.boundaryMesh(),
|
mesh.boundaryMesh(),
|
||||||
patchType
|
patchType
|
||||||
);
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else if (patchType == "empty")
|
else if (patchType == "empty")
|
||||||
{
|
{
|
||||||
// Note: not ccm name, may have been introduced by us
|
// Note: not ccm name, may have been introduced by us
|
||||||
newPatches[patchI] =
|
newPatches.set
|
||||||
|
(
|
||||||
|
patchI,
|
||||||
new emptyPolyPatch
|
new emptyPolyPatch
|
||||||
(
|
(
|
||||||
patchName,
|
patchName,
|
||||||
@ -2499,13 +2507,16 @@ void Foam::ccm::reader::addPatches
|
|||||||
patchI,
|
patchI,
|
||||||
mesh.boundaryMesh(),
|
mesh.boundaryMesh(),
|
||||||
patchType
|
patchType
|
||||||
);
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// All other ccm types become straight polyPatch:
|
// All other ccm types become straight polyPatch:
|
||||||
// 'inlet', 'outlet', 'pressure'.
|
// 'inlet', 'outlet', 'pressure'.
|
||||||
newPatches[patchI] =
|
newPatches.set
|
||||||
|
(
|
||||||
|
patchI,
|
||||||
new polyPatch
|
new polyPatch
|
||||||
(
|
(
|
||||||
patchName,
|
patchName,
|
||||||
@ -2514,7 +2525,8 @@ void Foam::ccm::reader::addPatches
|
|||||||
patchI,
|
patchI,
|
||||||
mesh.boundaryMesh(),
|
mesh.boundaryMesh(),
|
||||||
patchType
|
patchType
|
||||||
);
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
meshFaceI += patchSizes_[patchI];
|
meshFaceI += patchSizes_[patchI];
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2016 OpenCFD Ltd.
|
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -377,7 +377,7 @@ void Foam::meshReader::createPolyBoundary()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::List<Foam::polyPatch*>
|
Foam::polyPatchList
|
||||||
Foam::meshReader::polyBoundaryPatches(const polyMesh& mesh)
|
Foam::meshReader::polyBoundaryPatches(const polyMesh& mesh)
|
||||||
{
|
{
|
||||||
label nUsed = 0, nEmpty = 0;
|
label nUsed = 0, nEmpty = 0;
|
||||||
@ -416,7 +416,7 @@ Foam::meshReader::polyBoundaryPatches(const polyMesh& mesh)
|
|||||||
patchSizes_.setSize(nPatches);
|
patchSizes_.setSize(nPatches);
|
||||||
|
|
||||||
|
|
||||||
List<polyPatch*> p(nPatches);
|
polyPatchList newPatches(nPatches);
|
||||||
|
|
||||||
// All patch dictionaries
|
// All patch dictionaries
|
||||||
PtrList<dictionary> patchDicts(patchNames_.size());
|
PtrList<dictionary> patchDicts(patchNames_.size());
|
||||||
@ -469,16 +469,20 @@ Foam::meshReader::polyBoundaryPatches(const polyMesh& mesh)
|
|||||||
|
|
||||||
forAll(patchStarts_, patchi)
|
forAll(patchStarts_, patchi)
|
||||||
{
|
{
|
||||||
p[patchi] = polyPatch::New
|
newPatches.set
|
||||||
(
|
(
|
||||||
patchNames_[patchi],
|
|
||||||
patchDicts[patchi],
|
|
||||||
patchi,
|
patchi,
|
||||||
mesh.boundaryMesh()
|
polyPatch::New
|
||||||
).ptr();
|
(
|
||||||
|
patchNames_[patchi],
|
||||||
|
patchDicts[patchi],
|
||||||
|
patchi,
|
||||||
|
mesh.boundaryMesh()
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return p;
|
return newPatches;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -109,8 +109,10 @@ Foam::autoPtr<Foam::polyMesh> Foam::meshReader::mesh
|
|||||||
);
|
);
|
||||||
polyMesh& mesh = *meshPtr;
|
polyMesh& mesh = *meshPtr;
|
||||||
|
|
||||||
|
polyPatchList newPatches(polyBoundaryPatches(mesh));
|
||||||
|
|
||||||
// Adding patches also checks the mesh
|
// Adding patches also checks the mesh
|
||||||
mesh.addPatches(polyBoundaryPatches(mesh));
|
mesh.addPatches(newPatches);
|
||||||
|
|
||||||
warnDuplicates("boundaries", mesh.boundaryMesh().names());
|
warnDuplicates("boundaries", mesh.boundaryMesh().names());
|
||||||
|
|
||||||
|
|||||||
@ -49,8 +49,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef meshReader_H
|
#ifndef Foam_meshReader_H
|
||||||
#define meshReader_H
|
#define Foam_meshReader_H
|
||||||
|
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "HashTable.H"
|
#include "HashTable.H"
|
||||||
@ -179,7 +179,7 @@ private:
|
|||||||
void createPolyBoundary();
|
void createPolyBoundary();
|
||||||
|
|
||||||
//- Add polyhedral boundary
|
//- Add polyhedral boundary
|
||||||
List<polyPatch*> polyBoundaryPatches(const polyMesh&);
|
polyPatchList polyBoundaryPatches(const polyMesh&);
|
||||||
|
|
||||||
//- Clear extra storage before creation of the mesh to remove
|
//- Clear extra storage before creation of the mesh to remove
|
||||||
// a memory peak
|
// a memory peak
|
||||||
|
|||||||
@ -342,8 +342,8 @@ void Foam::fileFormats::FIREMeshReader::reorganize()
|
|||||||
|
|
||||||
void Foam::fileFormats::FIREMeshReader::addPatches(polyMesh& mesh) const
|
void Foam::fileFormats::FIREMeshReader::addPatches(polyMesh& mesh) const
|
||||||
{
|
{
|
||||||
// create patches
|
// Create patches
|
||||||
List<polyPatch*> newPatches(patchSizes_.size());
|
polyPatchList newPatches(patchSizes_.size());
|
||||||
|
|
||||||
label meshFaceI = nInternalFaces_;
|
label meshFaceI = nInternalFaces_;
|
||||||
|
|
||||||
@ -355,14 +355,18 @@ void Foam::fileFormats::FIREMeshReader::addPatches(polyMesh& mesh) const
|
|||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
// don't know anything better - just make it a wall
|
// don't know anything better - just make it a wall
|
||||||
newPatches[patchI] = new polyPatch
|
newPatches.set
|
||||||
(
|
(
|
||||||
patchNames_[patchI],
|
|
||||||
patchSizes_[patchI],
|
|
||||||
meshFaceI,
|
|
||||||
patchI,
|
patchI,
|
||||||
mesh.boundaryMesh(),
|
new polyPatch
|
||||||
word::null
|
(
|
||||||
|
patchNames_[patchI],
|
||||||
|
patchSizes_[patchI],
|
||||||
|
meshFaceI,
|
||||||
|
patchI,
|
||||||
|
mesh.boundaryMesh(),
|
||||||
|
word::null
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
meshFaceI += patchSizes_[patchI];
|
meshFaceI += patchSizes_[patchI];
|
||||||
|
|||||||
@ -1315,19 +1315,23 @@ void Foam::polyDualMesh::calcDual
|
|||||||
|
|
||||||
|
|
||||||
// Add patches. First add zero sized (since mesh still 0 size)
|
// Add patches. First add zero sized (since mesh still 0 size)
|
||||||
List<polyPatch*> dualPatches(patches.size());
|
polyPatchList dualPatches(patches.size());
|
||||||
|
|
||||||
forAll(patches, patchi)
|
forAll(patches, patchi)
|
||||||
{
|
{
|
||||||
const polyPatch& pp = patches[patchi];
|
const polyPatch& pp = patches[patchi];
|
||||||
|
|
||||||
dualPatches[patchi] = pp.clone
|
dualPatches.set
|
||||||
(
|
(
|
||||||
boundaryMesh(),
|
|
||||||
patchi,
|
patchi,
|
||||||
0, //patchSizes[patchi],
|
pp.clone
|
||||||
0 //patchStarts[patchi]
|
(
|
||||||
).ptr();
|
boundaryMesh(),
|
||||||
|
patchi,
|
||||||
|
0, //patchSizes[patchi],
|
||||||
|
0 //patchStarts[patchi]
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
addPatches(dualPatches);
|
addPatches(dualPatches);
|
||||||
|
|
||||||
|
|||||||
@ -1149,7 +1149,7 @@ void Foam::boundaryMesh::patchify
|
|||||||
// zero faces (repatched later on). Exception is coupled patches which
|
// zero faces (repatched later on). Exception is coupled patches which
|
||||||
// keep their size.
|
// keep their size.
|
||||||
|
|
||||||
List<polyPatch*> newPatchPtrList(nNewPatches);
|
polyPatchList newPatches(nNewPatches);
|
||||||
|
|
||||||
label meshFacei = newMesh.nInternalFaces();
|
label meshFacei = newMesh.nInternalFaces();
|
||||||
|
|
||||||
@ -1174,15 +1174,19 @@ void Foam::boundaryMesh::patchify
|
|||||||
<< " type:" << bp.physicalType() << endl;
|
<< " type:" << bp.physicalType() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
newPatchPtrList[newPatchi] = polyPatch::New
|
newPatches.set
|
||||||
(
|
(
|
||||||
bp.physicalType(),
|
|
||||||
bp.name(),
|
|
||||||
facesToBeDone,
|
|
||||||
meshFacei,
|
|
||||||
newPatchi,
|
newPatchi,
|
||||||
newMesh.boundaryMesh()
|
polyPatch::New
|
||||||
).ptr();
|
(
|
||||||
|
bp.physicalType(),
|
||||||
|
bp.name(),
|
||||||
|
facesToBeDone,
|
||||||
|
meshFacei,
|
||||||
|
newPatchi,
|
||||||
|
newMesh.boundaryMesh()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
meshFacei += facesToBeDone;
|
meshFacei += facesToBeDone;
|
||||||
|
|
||||||
@ -1200,13 +1204,17 @@ void Foam::boundaryMesh::patchify
|
|||||||
<< oldPatch.name() << endl;
|
<< oldPatch.name() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
newPatchPtrList[newPatchi] = oldPatch.clone
|
newPatches.set
|
||||||
(
|
(
|
||||||
newMesh.boundaryMesh(),
|
|
||||||
newPatchi,
|
newPatchi,
|
||||||
facesToBeDone,
|
oldPatch.clone
|
||||||
meshFacei
|
(
|
||||||
).ptr();
|
newMesh.boundaryMesh(),
|
||||||
|
newPatchi,
|
||||||
|
facesToBeDone,
|
||||||
|
meshFacei
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
meshFacei += facesToBeDone;
|
meshFacei += facesToBeDone;
|
||||||
|
|
||||||
@ -1220,9 +1228,9 @@ void Foam::boundaryMesh::patchify
|
|||||||
{
|
{
|
||||||
Pout<< "Patchify : new polyPatch list:" << endl;
|
Pout<< "Patchify : new polyPatch list:" << endl;
|
||||||
|
|
||||||
forAll(newPatchPtrList, patchi)
|
forAll(newPatches, patchi)
|
||||||
{
|
{
|
||||||
const polyPatch& newPatch = *newPatchPtrList[patchi];
|
const polyPatch& newPatch = newPatches[patchi];
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -1237,13 +1245,13 @@ void Foam::boundaryMesh::patchify
|
|||||||
|
|
||||||
// Actually add new list of patches
|
// Actually add new list of patches
|
||||||
repatchPolyTopoChanger polyMeshRepatcher(newMesh);
|
repatchPolyTopoChanger polyMeshRepatcher(newMesh);
|
||||||
polyMeshRepatcher.changePatches(newPatchPtrList);
|
polyMeshRepatcher.changePatches(newPatches);
|
||||||
|
|
||||||
|
|
||||||
// Pass2:
|
// Pass2:
|
||||||
// Change patch type for face
|
// Change patch type for face
|
||||||
|
|
||||||
if (newPatchPtrList.size())
|
if (newPatches.size())
|
||||||
{
|
{
|
||||||
List<DynamicList<label>> patchFaces(nNewPatches);
|
List<DynamicList<label>> patchFaces(nNewPatches);
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -77,7 +77,7 @@ Foam::extrudePatchMesh::extrudePatchMesh
|
|||||||
const fvPatch& p,
|
const fvPatch& p,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const word& regionName,
|
const word& regionName,
|
||||||
const List<polyPatch*>& regionPatches
|
polyPatchList& regionPatches
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
extrudePatchMesh(regionName, mesh, p, dict)
|
extrudePatchMesh(regionName, mesh, p, dict)
|
||||||
@ -86,6 +86,24 @@ Foam::extrudePatchMesh::extrudePatchMesh
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::extrudePatchMesh::extrudePatchMesh
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const fvPatch& p,
|
||||||
|
const dictionary& dict,
|
||||||
|
const word& regionName,
|
||||||
|
const List<polyPatch*>& regionPatches
|
||||||
|
)
|
||||||
|
:
|
||||||
|
extrudePatchMesh(regionName, mesh, p, dict)
|
||||||
|
{
|
||||||
|
// Acquire ownership of the pointers
|
||||||
|
polyPatchList plist(const_cast<List<polyPatch*>&>(regionPatches));
|
||||||
|
|
||||||
|
extrudeMesh(plist);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::extrudePatchMesh::extrudePatchMesh
|
Foam::extrudePatchMesh::extrudePatchMesh
|
||||||
(
|
(
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
@ -96,18 +114,10 @@ Foam::extrudePatchMesh::extrudePatchMesh
|
|||||||
:
|
:
|
||||||
extrudePatchMesh(regionName, mesh, p, dict)
|
extrudePatchMesh(regionName, mesh, p, dict)
|
||||||
{
|
{
|
||||||
List<polyPatch*> regionPatches(3);
|
polyPatchList regionPatches(3);
|
||||||
|
List<dictionary> dicts(regionPatches.size());
|
||||||
List<word> patchNames(regionPatches.size());
|
List<word> patchNames(regionPatches.size());
|
||||||
List<word> patchTypes(regionPatches.size());
|
List<word> patchTypes(regionPatches.size());
|
||||||
PtrList<dictionary> dicts(regionPatches.size());
|
|
||||||
|
|
||||||
forAll(dicts, patchi)
|
|
||||||
{
|
|
||||||
if (!dicts.set(patchi))
|
|
||||||
{
|
|
||||||
dicts.set(patchi, new dictionary());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dicts[bottomPatchID] = dict_.subDict("bottomCoeffs");
|
dicts[bottomPatchID] = dict_.subDict("bottomCoeffs");
|
||||||
dicts[sidePatchID] = dict_.subDict("sideCoeffs");
|
dicts[sidePatchID] = dict_.subDict("sideCoeffs");
|
||||||
@ -125,22 +135,26 @@ Foam::extrudePatchMesh::extrudePatchMesh
|
|||||||
patchDict.set("nFaces", 0);
|
patchDict.set("nFaces", 0);
|
||||||
patchDict.set("startFace", 0);
|
patchDict.set("startFace", 0);
|
||||||
|
|
||||||
regionPatches[patchi] = polyPatch::New
|
regionPatches.set
|
||||||
|
(
|
||||||
|
patchi,
|
||||||
|
polyPatch::New
|
||||||
(
|
(
|
||||||
patchNames[patchi],
|
patchNames[patchi],
|
||||||
patchDict,
|
patchDict,
|
||||||
patchi,
|
patchi,
|
||||||
mesh.boundaryMesh()
|
mesh.boundaryMesh()
|
||||||
).ptr();
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
extrudeMesh(regionPatches);
|
extrudeMesh(regionPatches);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::extrudePatchMesh::extrudeMesh(const List<polyPatch*>& regionPatches)
|
void Foam::extrudePatchMesh::extrudeMesh(polyPatchList& regionPatches)
|
||||||
{
|
{
|
||||||
if (this->boundaryMesh().size() == 0)
|
if (this->boundaryMesh().empty())
|
||||||
{
|
{
|
||||||
const bool columnCells = dict_.get<bool>("columnCells");
|
const bool columnCells = dict_.get<bool>("columnCells");
|
||||||
|
|
||||||
|
|||||||
@ -70,12 +70,11 @@ Description
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef extrudePatchMesh_H
|
#ifndef Foam_extrudePatchMesh_H
|
||||||
#define extrudePatchMesh_H
|
#define Foam_extrudePatchMesh_H
|
||||||
|
|
||||||
#include "extrudeModel.H"
|
#include "extrudeModel.H"
|
||||||
#include "autoPtr.H"
|
#include "autoPtr.H"
|
||||||
|
|
||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
|
|
||||||
@ -97,12 +96,12 @@ class extrudePatchMesh
|
|||||||
{
|
{
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
//- Enumeration of patch IDs
|
//- Enumeration of patch IDs. Must be 0,1,2,...
|
||||||
enum patchID
|
enum patchID
|
||||||
{
|
{
|
||||||
bottomPatchID,
|
bottomPatchID = 0,
|
||||||
topPatchID,
|
topPatchID = 1,
|
||||||
sidePatchID
|
sidePatchID = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
//- Const reference to the patch from which this mesh is extruded
|
//- Const reference to the patch from which this mesh is extruded
|
||||||
@ -115,7 +114,7 @@ class extrudePatchMesh
|
|||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Extrude mesh using polyPatches
|
//- Extrude mesh using polyPatches
|
||||||
void extrudeMesh(const List<polyPatch*>& regionPatches);
|
void extrudeMesh(polyPatchList& regionPatches);
|
||||||
|
|
||||||
//- Construct from mesh, patch and dictionary without patches.
|
//- Construct from mesh, patch and dictionary without patches.
|
||||||
// Only used internally
|
// Only used internally
|
||||||
@ -145,14 +144,25 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from mesh, patch, dictionary and new mesh
|
//- Construct from mesh, patch, dictionary and new mesh
|
||||||
// polyPatch information
|
//- polyPatch information
|
||||||
extrudePatchMesh
|
extrudePatchMesh
|
||||||
(
|
(
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
const fvPatch& p,
|
const fvPatch& p,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const word& regionName,
|
const word& regionName,
|
||||||
const List<polyPatch*>& polyPatches
|
polyPatchList& regionPatches
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from mesh, patch, dictionary and new mesh
|
||||||
|
//- polyPatch information
|
||||||
|
extrudePatchMesh
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const fvPatch& p,
|
||||||
|
const dictionary& dict,
|
||||||
|
const word& regionName,
|
||||||
|
const List<polyPatch*>& regionPatches
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1796,17 +1796,21 @@ Foam::autoPtr<Foam::fvMesh> Foam::fvMeshDistribute::receiveMesh
|
|||||||
);
|
);
|
||||||
fvMesh& domainMesh = *domainMeshPtr;
|
fvMesh& domainMesh = *domainMeshPtr;
|
||||||
|
|
||||||
List<polyPatch*> patches(patchEntries.size());
|
polyPatchList patches(patchEntries.size());
|
||||||
|
|
||||||
forAll(patchEntries, patchi)
|
forAll(patchEntries, patchi)
|
||||||
{
|
{
|
||||||
patches[patchi] = polyPatch::New
|
patches.set
|
||||||
(
|
(
|
||||||
patchEntries[patchi].keyword(),
|
|
||||||
patchEntries[patchi].dict(),
|
|
||||||
patchi,
|
patchi,
|
||||||
domainMesh.boundaryMesh()
|
polyPatch::New
|
||||||
).ptr();
|
(
|
||||||
|
patchEntries[patchi].keyword(),
|
||||||
|
patchEntries[patchi].dict(),
|
||||||
|
patchi,
|
||||||
|
domainMesh.boundaryMesh()
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// Add patches; no parallel comms
|
// Add patches; no parallel comms
|
||||||
domainMesh.addFvPatches(patches, false);
|
domainMesh.addFvPatches(patches, false);
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -80,34 +81,40 @@ void Foam::attachPolyTopoChanger::attach(const bool removeEmptyPatches)
|
|||||||
// Re-do the boundary patches, removing the ones with zero size
|
// Re-do the boundary patches, removing the ones with zero size
|
||||||
const polyBoundaryMesh& oldPatches = mesh_.boundaryMesh();
|
const polyBoundaryMesh& oldPatches = mesh_.boundaryMesh();
|
||||||
|
|
||||||
List<polyPatch*> newPatches(oldPatches.size());
|
polyPatchList newPatches(oldPatches.size());
|
||||||
label nNewPatches = 0;
|
label nNewPatches = 0;
|
||||||
|
|
||||||
forAll(oldPatches, patchi)
|
forAll(oldPatches, patchi)
|
||||||
{
|
{
|
||||||
if (oldPatches[patchi].size())
|
const word& patchName = oldPatches[patchi].name();
|
||||||
{
|
|
||||||
newPatches[nNewPatches] = oldPatches[patchi].clone
|
|
||||||
(
|
|
||||||
mesh_.boundaryMesh(),
|
|
||||||
nNewPatches,
|
|
||||||
oldPatches[patchi].size(),
|
|
||||||
oldPatches[patchi].start()
|
|
||||||
).ptr();
|
|
||||||
|
|
||||||
nNewPatches++;
|
if (returnReduceOr(oldPatches[patchi].size()))
|
||||||
|
{
|
||||||
|
newPatches.set
|
||||||
|
(
|
||||||
|
nNewPatches,
|
||||||
|
oldPatches[patchi].clone
|
||||||
|
(
|
||||||
|
mesh_.boundaryMesh(),
|
||||||
|
nNewPatches,
|
||||||
|
oldPatches[patchi].size(),
|
||||||
|
oldPatches[patchi].start()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
++nNewPatches;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Pout<< "Removing zero-sized patch " << patchi
|
Pout<< "Removing zero-sized patch " << patchi
|
||||||
<< " named " << oldPatches[patchi].name() << endl;
|
<< " named " << patchName << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
newPatches.setSize(nNewPatches);
|
newPatches.resize(nNewPatches);
|
||||||
|
|
||||||
mesh_.removeBoundary();
|
mesh_.removeBoundary();
|
||||||
mesh_.addPatches(newPatches);
|
mesh_.addPatches(newPatches);
|
||||||
|
|||||||
@ -46,8 +46,8 @@ Description
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef attachPolyTopoChanger_H
|
#ifndef Foam_attachPolyTopoChanger_H
|
||||||
#define attachPolyTopoChanger_H
|
#define Foam_attachPolyTopoChanger_H
|
||||||
|
|
||||||
#include "polyTopoChanger.H"
|
#include "polyTopoChanger.H"
|
||||||
|
|
||||||
@ -57,16 +57,16 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class attachPolyTopoChanger Declaration
|
Class attachPolyTopoChanger Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class attachPolyTopoChanger
|
class attachPolyTopoChanger
|
||||||
:
|
:
|
||||||
public polyTopoChanger
|
public polyTopoChanger
|
||||||
{
|
{
|
||||||
// Private data
|
public:
|
||||||
|
|
||||||
// Private Member Functions
|
// Generated Methods
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
attachPolyTopoChanger(const attachPolyTopoChanger&) = delete;
|
attachPolyTopoChanger(const attachPolyTopoChanger&) = delete;
|
||||||
@ -75,8 +75,6 @@ class attachPolyTopoChanger
|
|||||||
void operator=(const attachPolyTopoChanger&) = delete;
|
void operator=(const attachPolyTopoChanger&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Read constructor from IOobject and a polyMesh
|
//- Read constructor from IOobject and a polyMesh
|
||||||
|
|||||||
@ -60,7 +60,7 @@ Foam::repatchPolyTopoChanger::repatchPolyTopoChanger(polyMesh& mesh)
|
|||||||
|
|
||||||
void Foam::repatchPolyTopoChanger::changePatches
|
void Foam::repatchPolyTopoChanger::changePatches
|
||||||
(
|
(
|
||||||
const List<polyPatch*>& patches
|
polyPatchList& patches
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (meshModPtr_)
|
if (meshModPtr_)
|
||||||
@ -76,6 +76,18 @@ void Foam::repatchPolyTopoChanger::changePatches
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::repatchPolyTopoChanger::changePatches
|
||||||
|
(
|
||||||
|
const List<polyPatch*>& patches
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Acquire ownership of the pointers
|
||||||
|
polyPatchList plist(const_cast<List<polyPatch*>&>(patches));
|
||||||
|
|
||||||
|
changePatches(plist);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::repatchPolyTopoChanger::changePatchID
|
void Foam::repatchPolyTopoChanger::changePatchID
|
||||||
(
|
(
|
||||||
const label faceID,
|
const label faceID,
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011 OpenFOAM Foundation
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -37,8 +37,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef repatchPolyTopoChanger_H
|
#ifndef Foam_repatchPolyTopoChanger_H
|
||||||
#define repatchPolyTopoChanger_H
|
#define Foam_repatchPolyTopoChanger_H
|
||||||
|
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "polyTopoChange.H"
|
#include "polyTopoChange.H"
|
||||||
@ -60,7 +60,7 @@ class repatchPolyTopoChanger
|
|||||||
polyMesh& mesh_;
|
polyMesh& mesh_;
|
||||||
|
|
||||||
//- Topological change to accumulated all mesh changes
|
//- Topological change to accumulated all mesh changes
|
||||||
unique_ptr<polyTopoChange> meshModPtr_;
|
std::unique_ptr<polyTopoChange> meshModPtr_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
@ -89,11 +89,14 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Change patches.
|
||||||
|
void changePatches(polyPatchList& patches);
|
||||||
|
|
||||||
//- Change patches.
|
//- Change patches.
|
||||||
void changePatches(const List<polyPatch*>& patches);
|
void changePatches(const List<polyPatch*>& patches);
|
||||||
|
|
||||||
//- Change patch ID for a boundary face. Note: patchID should be in new
|
//- Change patch ID for a boundary face.
|
||||||
// numbering.
|
//- Note: patchID should be in new numbering.
|
||||||
void changePatchID
|
void changePatchID
|
||||||
(
|
(
|
||||||
const label faceID,
|
const label faceID,
|
||||||
|
|||||||
@ -83,16 +83,20 @@ Foam::simplifiedMeshes::hexCellFvMesh::hexCellFvMesh
|
|||||||
labelList()
|
labelList()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
List<polyPatch*> patches(1);
|
polyPatchList patches(1);
|
||||||
|
|
||||||
patches[0] = new emptyPolyPatch
|
patches.set
|
||||||
(
|
(
|
||||||
"boundary",
|
|
||||||
6,
|
|
||||||
0,
|
0,
|
||||||
0,
|
new emptyPolyPatch
|
||||||
boundaryMesh(),
|
(
|
||||||
emptyPolyPatch::typeName
|
"boundary",
|
||||||
|
6,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
boundaryMesh(),
|
||||||
|
emptyPolyPatch::typeName
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
addFvPatches(patches);
|
addFvPatches(patches);
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2019 OpenCFD Ltd.
|
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -258,16 +258,20 @@ void Foam::singleCellFvMesh::agglomerateMesh
|
|||||||
pointField boundaryPoints(mesh.points(), pointMap_);
|
pointField boundaryPoints(mesh.points(), pointMap_);
|
||||||
|
|
||||||
// Add patches (on still zero sized mesh)
|
// Add patches (on still zero sized mesh)
|
||||||
List<polyPatch*> newPatches(oldPatches.size());
|
polyPatchList newPatches(oldPatches.size());
|
||||||
forAll(oldPatches, patchi)
|
forAll(oldPatches, patchi)
|
||||||
{
|
{
|
||||||
newPatches[patchi] = oldPatches[patchi].clone
|
newPatches.set
|
||||||
(
|
(
|
||||||
boundaryMesh(),
|
|
||||||
patchi,
|
patchi,
|
||||||
0,
|
oldPatches[patchi].clone
|
||||||
0
|
(
|
||||||
).ptr();
|
boundaryMesh(),
|
||||||
|
patchi,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
addFvPatches(newPatches);
|
addFvPatches(newPatches);
|
||||||
|
|
||||||
|
|||||||
@ -143,10 +143,10 @@ void thermalBaffleFvPatchScalarField::createPatchMesh()
|
|||||||
|
|
||||||
const word regionName(dict_.get<word>("region"));
|
const word regionName(dict_.get<word>("region"));
|
||||||
|
|
||||||
List<polyPatch*> regionPatches(3);
|
polyPatchList regionPatches(3);
|
||||||
|
List<dictionary> dicts(regionPatches.size());
|
||||||
List<word> patchNames(regionPatches.size());
|
List<word> patchNames(regionPatches.size());
|
||||||
List<word> patchTypes(regionPatches.size());
|
List<word> patchTypes(regionPatches.size());
|
||||||
List<dictionary> dicts(regionPatches.size());
|
|
||||||
|
|
||||||
patchNames[bottomPatchID] = word("bottom");
|
patchNames[bottomPatchID] = word("bottom");
|
||||||
patchNames[sidePatchID] = word("side");
|
patchNames[sidePatchID] = word("side");
|
||||||
@ -172,8 +172,7 @@ void thermalBaffleFvPatchScalarField::createPatchMesh()
|
|||||||
patchTypes[sidePatchID] = polyPatch::typeName;
|
patchTypes[sidePatchID] = polyPatch::typeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
const mappedPatchBase& mpp =
|
const auto& mpp = refCast<const mappedPatchBase>(patch().patch(), dict_);
|
||||||
refCast<const mappedPatchBase>(patch().patch(), dict_);
|
|
||||||
|
|
||||||
const word coupleGroup(mpp.coupleGroup());
|
const word coupleGroup(mpp.coupleGroup());
|
||||||
|
|
||||||
@ -202,18 +201,22 @@ void thermalBaffleFvPatchScalarField::createPatchMesh()
|
|||||||
|
|
||||||
forAll(regionPatches, patchi)
|
forAll(regionPatches, patchi)
|
||||||
{
|
{
|
||||||
dictionary& patchDict = dicts[patchi];
|
dictionary& patchDict = dicts[patchi];
|
||||||
patchDict.set("nFaces", 0);
|
patchDict.set("nFaces", 0);
|
||||||
patchDict.set("startFace", 0);
|
patchDict.set("startFace", 0);
|
||||||
|
|
||||||
regionPatches[patchi] = polyPatch::New
|
regionPatches.set
|
||||||
(
|
(
|
||||||
patchTypes[patchi],
|
|
||||||
patchNames[patchi],
|
|
||||||
dicts[patchi],
|
|
||||||
patchi,
|
patchi,
|
||||||
thisMesh.boundaryMesh()
|
polyPatch::New
|
||||||
).ptr();
|
(
|
||||||
|
patchTypes[patchi],
|
||||||
|
patchNames[patchi],
|
||||||
|
dicts[patchi],
|
||||||
|
patchi,
|
||||||
|
thisMesh.boundaryMesh()
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
extrudeMeshPtr_.reset
|
extrudeMeshPtr_.reset
|
||||||
|
|||||||
@ -495,15 +495,19 @@ void Foam::meshToMesh::calculate(const word& methodName, const bool normalise)
|
|||||||
);
|
);
|
||||||
|
|
||||||
// create some dummy patch info
|
// create some dummy patch info
|
||||||
List<polyPatch*> patches(1);
|
polyPatchList patches(1);
|
||||||
patches[0] = new polyPatch
|
patches.set
|
||||||
(
|
(
|
||||||
"defaultFaces",
|
|
||||||
newTgt.nBoundaryFaces(),
|
|
||||||
newTgt.nInternalFaces(),
|
|
||||||
0,
|
0,
|
||||||
newTgt.boundaryMesh(),
|
new polyPatch
|
||||||
word::null
|
(
|
||||||
|
"defaultFaces",
|
||||||
|
newTgt.nBoundaryFaces(),
|
||||||
|
newTgt.nInternalFaces(),
|
||||||
|
0,
|
||||||
|
newTgt.boundaryMesh(),
|
||||||
|
word::null
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
newTgt.addPatches(patches);
|
newTgt.addPatches(patches);
|
||||||
|
|||||||
Reference in New Issue
Block a user