/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 .
\*---------------------------------------------------------------------------*/
#include "polyMesh.H"
#include "HashOps.H"
#include "emptyPolyPatch.H"
#include "mapPolyMesh.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template
void Foam::polyTopoChange::reorder
(
const labelUList& oldToNew,
DynamicList& lst
)
{
// Create copy
DynamicList oldLst(lst);
forAll(oldLst, i)
{
const label newIdx = oldToNew[i];
if (newIdx >= 0)
{
lst[newIdx] = std::move(oldLst[i]);
}
}
}
template
void Foam::polyTopoChange::renumberKey
(
const labelUList& oldToNew,
Map& map
)
{
Map newMap(map.capacity());
forAllConstIters(map, iter)
{
const label newKey = oldToNew[iter.key()];
if (newKey >= 0)
{
newMap.insert(newKey, iter.val());
}
}
map.transfer(newMap);
}
template
Foam::autoPtr Foam::polyTopoChange::makeMesh
(
autoPtr& newMeshPtr,
const IOobject& io,
const polyMesh& mesh,
const labelUList& patchMap,
const bool syncParallel,
const bool orderCells,
const bool orderPoints
)
{
if (debug)
{
Pout<< "polyTopoChange::changeMesh"
<< "(autoPtr&, const IOobject&, const fvMesh&"
<< ", const bool, const bool, const bool)"
<< endl;
}
if (debug)
{
Pout<< "Old mesh:" << nl;
writeMeshStats(mesh, Pout);
}
// new mesh points
pointField newPoints;
// number of internal points
label nInternalPoints;
// patch slicing
labelList patchSizes;
labelList patchStarts;
// inflate maps
List pointsFromPoints;
List facesFromPoints;
List facesFromEdges;
List facesFromFaces;
List cellsFromPoints;
List cellsFromEdges;
List cellsFromFaces;
List cellsFromCells;
// old mesh info
List