mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: extrudeMesh - migrating new functionlity from internal development line
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -47,6 +47,7 @@ Description
|
|||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "MeshedSurfaces.H"
|
#include "MeshedSurfaces.H"
|
||||||
#include "globalIndex.H"
|
#include "globalIndex.H"
|
||||||
|
#include "cellSet.H"
|
||||||
|
|
||||||
#include "extrudedMesh.H"
|
#include "extrudedMesh.H"
|
||||||
#include "extrudeModel.H"
|
#include "extrudeModel.H"
|
||||||
@ -192,6 +193,23 @@ void updateFaceLabels(const mapPolyMesh& map, labelList& faceLabels)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void updateCellSet(const mapPolyMesh& map, labelHashSet& cellLabels)
|
||||||
|
{
|
||||||
|
const labelList& reverseMap = map.reverseCellMap();
|
||||||
|
|
||||||
|
labelHashSet newCellLabels(2*cellLabels.size());
|
||||||
|
|
||||||
|
forAll(cellLabels, i)
|
||||||
|
{
|
||||||
|
label oldCellI = cellLabels[i];
|
||||||
|
|
||||||
|
if (reverseMap[oldCellI] >= 0)
|
||||||
|
{
|
||||||
|
newCellLabels.insert(reverseMap[oldCellI]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cellLabels.transfer(newCellLabels);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
@ -270,6 +288,9 @@ int main(int argc, char *argv[])
|
|||||||
word backPatchName;
|
word backPatchName;
|
||||||
labelList backPatchFaces;
|
labelList backPatchFaces;
|
||||||
|
|
||||||
|
// Optional added cells (get written to cellSet)
|
||||||
|
labelHashSet addedCellsSet;
|
||||||
|
|
||||||
if (mode == PATCH || mode == MESH)
|
if (mode == PATCH || mode == MESH)
|
||||||
{
|
{
|
||||||
if (flipNormals && mode == MESH)
|
if (flipNormals && mode == MESH)
|
||||||
@ -670,11 +691,33 @@ int main(int argc, char *argv[])
|
|||||||
map().reverseFaceMap(),
|
map().reverseFaceMap(),
|
||||||
backPatchFaces
|
backPatchFaces
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Store added cells
|
||||||
|
if (mode == MESH)
|
||||||
|
{
|
||||||
|
const labelListList addedCells
|
||||||
|
(
|
||||||
|
layerExtrude.addedCells
|
||||||
|
(
|
||||||
|
meshFromMesh,
|
||||||
|
layerExtrude.layerFaces()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
forAll(addedCells, faceI)
|
||||||
|
{
|
||||||
|
const labelList& aCells = addedCells[faceI];
|
||||||
|
forAll(aCells, i)
|
||||||
|
{
|
||||||
|
addedCellsSet.insert(aCells[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Read from surface
|
// Read from surface
|
||||||
fileName surfName(dict.lookup("surface"));
|
fileName surfName(dict.lookup("surface"));
|
||||||
|
surfName.expand();
|
||||||
|
|
||||||
Info<< "Extruding surfaceMesh read from file " << surfName << nl
|
Info<< "Extruding surfaceMesh read from file " << surfName << nl
|
||||||
<< endl;
|
<< endl;
|
||||||
@ -810,6 +853,7 @@ int main(int argc, char *argv[])
|
|||||||
// Update stored data
|
// Update stored data
|
||||||
updateFaceLabels(map(), frontPatchFaces);
|
updateFaceLabels(map(), frontPatchFaces);
|
||||||
updateFaceLabels(map(), backPatchFaces);
|
updateFaceLabels(map(), backPatchFaces);
|
||||||
|
updateCellSet(map(), addedCellsSet);
|
||||||
|
|
||||||
// Move mesh (if inflation used)
|
// Move mesh (if inflation used)
|
||||||
if (map().hasMotionPoints())
|
if (map().hasMotionPoints())
|
||||||
@ -913,6 +957,9 @@ int main(int argc, char *argv[])
|
|||||||
// Update fields
|
// Update fields
|
||||||
mesh.updateMesh(map);
|
mesh.updateMesh(map);
|
||||||
|
|
||||||
|
// Update local data
|
||||||
|
updateCellSet(map(), addedCellsSet);
|
||||||
|
|
||||||
// Move mesh (if inflation used)
|
// Move mesh (if inflation used)
|
||||||
if (map().hasMotionPoints())
|
if (map().hasMotionPoints())
|
||||||
{
|
{
|
||||||
@ -929,6 +976,21 @@ int main(int argc, char *argv[])
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Need writing cellSet
|
||||||
|
label nAdded = returnReduce(addedCellsSet.size(), sumOp<label>());
|
||||||
|
if (nAdded > 0)
|
||||||
|
{
|
||||||
|
cellSet addedCells(mesh, "addedCells", addedCellsSet);
|
||||||
|
Info<< "Writing added cells to cellSet " << addedCells.name()
|
||||||
|
<< nl << endl;
|
||||||
|
if (!addedCells.write())
|
||||||
|
{
|
||||||
|
FatalErrorIn(args.executable()) << "Failed writing cellSet"
|
||||||
|
<< addedCells.name()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Info<< "End\n" << endl;
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user