Commit bdf57fb4 authored by Mark Olesen's avatar Mark Olesen Committed by Andrew Heather
Browse files

ENH: support addPatches with PtrList

parent 7795adfc
......@@ -927,7 +927,7 @@ Foam::polyMesh::cellTree() const
void Foam::polyMesh::addPatches
(
const List<polyPatch*>& p,
PtrList<polyPatch>& plist,
const bool validBoundary
)
{
......@@ -942,13 +942,7 @@ void Foam::polyMesh::addPatches
geometricD_ = Zero;
solutionD_ = Zero;
boundary_.setSize(p.size());
// Copy the patch pointers
forAll(p, pI)
{
boundary_.set(pI, p[pI]);
}
boundary_.transfer(plist);
// parallelData depends on the processorPatch ordering so force
// recalculation. Problem: should really be done in removeBoundary but
......@@ -1027,6 +1021,19 @@ void Foam::polyMesh::addZones
}
void Foam::polyMesh::addPatches
(
const List<polyPatch*>& p,
const bool validBoundary
)
{
// Acquire ownership of the pointers
PtrList<polyPatch> plist(const_cast<List<polyPatch*>&>(p));
addPatches(plist, validBoundary);
}
const Foam::pointField& Foam::polyMesh::points() const
{
if (clearedPrimitives_)
......
......@@ -573,7 +573,14 @@ public:
//- Add boundary patches
void addPatches
(
const List<polyPatch*>&,
PtrList<polyPatch>& plist,
const bool validBoundary = true
);
//- Add boundary patches
void addPatches
(
const List<polyPatch*>& p,
const bool validBoundary = true
);
......
......@@ -478,7 +478,7 @@ Foam::SolverPerformance<Foam::tensor> Foam::fvMesh::solve
void Foam::fvMesh::addFvPatches
(
const List<polyPatch*>& p,
PtrList<polyPatch>& plist,
const bool validBoundary
)
{
......@@ -489,12 +489,24 @@ void Foam::fvMesh::addFvPatches
<< abort(FatalError);
}
// first add polyPatches
addPatches(p, validBoundary);
addPatches(plist, validBoundary);
boundary_.addPatches(boundaryMesh());
}
void Foam::fvMesh::addFvPatches
(
const List<polyPatch*>& p,
const bool validBoundary
)
{
// Acquire ownership of the pointers
PtrList<polyPatch> plist(const_cast<List<polyPatch*>&>(p));
addFvPatches(plist, validBoundary);
}
void Foam::fvMesh::removeFvBoundary()
{
if (debug)
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
......@@ -186,7 +186,7 @@ public:
explicit fvMesh(const IOobject& io);
//- Construct from IOobject or as zero-sized mesh
// Boundary is added using addPatches() member function
// Boundary is added using addFvPatches() member function
fvMesh(const IOobject& io, const zero, bool syncPar=true);
//- Construct from components without boundary.
......@@ -202,7 +202,7 @@ public:
);
//- Construct without boundary from cells rather than owner/neighbour.
// Boundary is added using addPatches() member function
// Boundary is added using addFvPatches() member function
fvMesh
(
const IOobject& io,
......@@ -221,6 +221,13 @@ public:
// Helpers
//- Add boundary patches. Constructor helper
void addFvPatches
(
PtrList<polyPatch>& plist,
const bool validBoundary = true
);
//- Add boundary patches. Constructor helper
void addFvPatches
(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment