Commit b4a2876c authored by Mark Olesen's avatar Mark Olesen
Browse files

ENH: use move construct for cellZone/faceZone

parent 4fe8ed82
......@@ -1168,7 +1168,7 @@ int main(int argc, char *argv[])
forAll(faceZoneIDs, faceZonei)
{
label zoneID = faceGroupZoneID[faceZoneIDs[faceZonei] ];
label zoneID = faceGroupZoneID[faceZoneIDs[faceZonei]];
word name = groupName[zoneID];
const word& type = groupType[zoneID];
......
......@@ -29,17 +29,10 @@
const polyPatch& masterPatch =
mesh.boundaryMesh()[masterPatchName];
labelList isf(masterPatch.size());
forAll(isf, i)
{
isf[i] = masterPatch.start() + i;
}
fz[3*pairI] = new faceZone
(
mergeName + "MasterZone",
isf,
identity(masterPatch.size(), masterPatch.start()),
false, // none are flipped
0,
mesh.faceZones()
......@@ -50,17 +43,10 @@
const polyPatch& slavePatch =
mesh.boundaryMesh()[slavePatchName];
labelList osf(slavePatch.size());
forAll(osf, i)
{
osf[i] = slavePatch.start() + i;
}
fz[3*pairI + 1] = new faceZone
(
mergeName + "SlaveZone",
osf,
identity(slavePatch.size(), slavePatch.start()),
false, // none are flipped
1,
mesh.faceZones()
......
......@@ -591,7 +591,7 @@ int main(int argc, char *argv[])
{
addr[n] = facei;
flip[n] = faceToFlip[facei];
n++;
++n;
}
}
......
......@@ -233,8 +233,8 @@ int main(int argc, char *argv[])
new faceZone
(
"membraneFaces",
faces,
zoneFlip,
std::move(faces),
std::move(zoneFlip),
0,
mesh.faceZones()
);
......
......@@ -1925,7 +1925,7 @@ int main(int argc, char *argv[])
new cellZone
(
zoneName, //name
regionCells, //addressing
std::move(regionCells), //addressing
zoneI, //index
cellZones //cellZoneMesh
)
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -79,17 +79,10 @@ void Foam::linearValveFvMesh::addZonesAndModifiers()
const word innerSliderName(motionDict_.subDict("slider").lookup("inside"));
const polyPatch& innerSlider = boundaryMesh()[innerSliderName];
labelList isf(innerSlider.size());
forAll(isf, i)
{
isf[i] = innerSlider.start() + i;
}
fz[0] = new faceZone
(
"insideSliderZone",
isf,
identity(innerSlider.size(), innerSlider.start()),
false, // none are flipped
0,
faceZones()
......@@ -99,17 +92,10 @@ void Foam::linearValveFvMesh::addZonesAndModifiers()
const word outerSliderName(motionDict_.subDict("slider").lookup("outside"));
const polyPatch& outerSlider = boundaryMesh()[outerSliderName];
labelList osf(outerSlider.size());
forAll(osf, i)
{
osf[i] = outerSlider.start() + i;
}
fz[1] = new faceZone
(
"outsideSliderZone",
osf,
identity(outerSlider.size(), outerSlider.start()),
false, // none are flipped
1,
faceZones()
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -86,17 +86,10 @@ void Foam::linearValveLayersFvMesh::addZonesAndModifiers()
const word innerSliderName(motionDict_.subDict("slider").lookup("inside"));
const polyPatch& innerSlider = boundaryMesh()[innerSliderName];
labelList isf(innerSlider.size());
forAll(isf, i)
{
isf[i] = innerSlider.start() + i;
}
fz[0] = new faceZone
(
"insideSliderZone",
isf,
identity(innerSlider.size(), innerSlider.start()),
false, // none are flipped
0,
faceZones()
......@@ -106,17 +99,10 @@ void Foam::linearValveLayersFvMesh::addZonesAndModifiers()
const word outerSliderName(motionDict_.subDict("slider").lookup("outside"));
const polyPatch& outerSlider = boundaryMesh()[outerSliderName];
labelList osf(outerSlider.size());
forAll(osf, i)
{
osf[i] = outerSlider.start() + i;
}
fz[1] = new faceZone
(
"outsideSliderZone",
osf,
identity(outsideSlider.size(), outsideSlider.start()),
false, // none are flipped
1,
faceZones()
......@@ -133,16 +119,10 @@ void Foam::linearValveLayersFvMesh::addZonesAndModifiers()
const polyPatch& layerPatch = boundaryMesh()[layerPatchName];
labelList lpf(layerPatch.size());
forAll(lpf, i)
{
lpf[i] = layerPatch.start() + i;
}
fz[3] = new faceZone
(
"valveLayerZone",
identity(layerPatch.size(), layerPatch.start()),
lpf,
true, // all are flipped
0,
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -79,17 +79,10 @@ void Foam::mixerFvMesh::addZonesAndModifiers()
const word innerSliderName(motionDict_.subDict("slider").lookup("inside"));
const polyPatch& innerSlider = boundaryMesh()[innerSliderName];
labelList isf(innerSlider.size());
forAll(isf, i)
{
isf[i] = innerSlider.start() + i;
}
fz[0] = new faceZone
(
"insideSliderZone",
isf,
identity(innerSlider.size(), innerSlider.start()),
false, // none are flipped
0,
faceZones()
......@@ -99,17 +92,10 @@ void Foam::mixerFvMesh::addZonesAndModifiers()
const word outerSliderName(motionDict_.subDict("slider").lookup("outside"));
const polyPatch& outerSlider = boundaryMesh()[outerSliderName];
labelList osf(outerSlider.size());
forAll(osf, i)
{
osf[i] = outerSlider.start() + i;
}
fz[1] = new faceZone
(
"outsideSliderZone",
osf,
identity(outerSlider.size(), outerSlider.start()),
false, // none are flipped
1,
faceZones()
......@@ -124,7 +110,7 @@ void Foam::mixerFvMesh::addZonesAndModifiers()
regionSplit rs(*this);
// Get the region of the cell containing the origin.
label originRegion = rs[findNearestCell(cs().origin())];
const label originRegion = rs[findNearestCell(cs().origin())];
labelList movingCells(nCells());
label nMovingCells = 0;
......@@ -134,17 +120,17 @@ void Foam::mixerFvMesh::addZonesAndModifiers()
if (rs[celli] == originRegion)
{
movingCells[nMovingCells] = celli;
nMovingCells++;
++nMovingCells;
}
}
movingCells.setSize(nMovingCells);
movingCells.resize(nMovingCells);
Info<< "Number of cells in the moving region: " << nMovingCells << endl;
cz[0] = new cellZone
(
"movingCells",
movingCells,
std::move(movingCells),
0,
cellZones()
);
......@@ -203,14 +189,14 @@ void Foam::mixerFvMesh::calcMovingMasks() const
const labelList& cellAddr = cellZones()["movingCells"];
forAll(cellAddr, celli)
for (const label celli : cellAddr)
{
const cell& curCell = c[cellAddr[celli]];
const cell& curCell = c[celli];
forAll(curCell, facei)
for (const label facei : curCell)
{
// Mark all the points as moving
const face& curFace = f[curCell[facei]];
const face& curFace = f[facei];
forAll(curFace, pointi)
{
......@@ -227,9 +213,9 @@ void Foam::mixerFvMesh::calcMovingMasks() const
const labelList& innerSliderAddr = faceZones()[innerSliderZoneName];
forAll(innerSliderAddr, facei)
for (const label facei : innerSliderAddr)
{
const face& curFace = f[innerSliderAddr[facei]];
const face& curFace = f[facei];
forAll(curFace, pointi)
{
......@@ -245,9 +231,9 @@ void Foam::mixerFvMesh::calcMovingMasks() const
const labelList& outerSliderAddr = faceZones()[outerSliderZoneName];
forAll(outerSliderAddr, facei)
for (const label facei : outerSliderAddr)
{
const face& curFace = f[outerSliderAddr[facei]];
const face& curFace = f[facei];
forAll(curFace, pointi)
{
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -133,7 +133,7 @@ void Foam::movingConeTopoFvMesh::addZonesAndModifiers()
zone1[nZoneFaces1] = facei;
Info<< "face " << facei << " for zone 1. Flip: "
<< flipZone1[nZoneFaces1] << endl;
nZoneFaces1++;
++nZoneFaces1;
}
else if
(
......@@ -150,7 +150,7 @@ void Foam::movingConeTopoFvMesh::addZonesAndModifiers()
Info<< "face " << facei << " for zone 2. Flip: "
<< flipZone2[nZoneFaces2] << endl;
nZoneFaces2++;
++nZoneFaces2;
}
}
......@@ -173,23 +173,23 @@ void Foam::movingConeTopoFvMesh::addZonesAndModifiers()
new faceZone
(
"rightExtrusionFaces",
zone1,
flipZone1,
std::move(zone1),
std::move(flipZone1),
nFz,
faceZones()
);
nFz++;
++nFz;
fz[nFz] =
new faceZone
(
"leftExtrusionFaces",
zone2,
flipZone2,
std::move(zone2),
std::move(flipZone2),
nFz,
faceZones()
);
nFz++;
++nFz;
fz.setSize(nFz);
......@@ -218,7 +218,7 @@ void Foam::movingConeTopoFvMesh::addZonesAndModifiers()
motionDict_.subDict("right").lookup("maxThickness")
)
);
nMods++;
++nMods;
tm[nMods] = new layerAdditionRemoval
(
......@@ -235,7 +235,7 @@ void Foam::movingConeTopoFvMesh::addZonesAndModifiers()
motionDict_.subDict("left").lookup("maxThickness")
)
);
nMods++;
++nMods;
tm.setSize(nMods);
Info<< "Adding " << nMods << " mesh modifiers" << endl;
......
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