Commit eb5b6fd7 authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: mapPolyMesh - added construct from mesh

parent 36af9f61
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
......@@ -30,6 +30,71 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::mapPolyMesh::mapPolyMesh(const polyMesh& mesh)
:
mesh_(mesh),
nOldPoints_(mesh.nPoints()),
nOldFaces_(mesh.nFaces()),
nOldCells_(mesh.nCells()),
pointMap_(identity(mesh.nPoints())),
pointsFromPointsMap_(),
faceMap_(identity(mesh.nFaces())),
facesFromPointsMap_(),
facesFromEdgesMap_(),
facesFromFacesMap_(),
cellMap_(identity(mesh.nCells())),
cellsFromPointsMap_(),
cellsFromEdgesMap_(),
cellsFromFacesMap_(),
cellsFromCellsMap_(),
reversePointMap_(identity(mesh.nPoints())),
reverseFaceMap_(identity(mesh.nFaces())),
reverseCellMap_(identity(mesh.nCells())),
flipFaceFlux_(),
patchPointMap_(mesh.boundaryMesh().size()),
pointZoneMap_(mesh.pointZones().size()),
faceZonePointMap_(mesh.faceZones().size()),
faceZoneFaceMap_(mesh.faceZones().size()),
cellZoneMap_(mesh.cellZones().size()),
preMotionPoints_(mesh.points()),
oldPatchSizes_(mesh.boundaryMesh().patchSizes()),
oldPatchStarts_(mesh.boundaryMesh().patchStarts()),
oldPatchNMeshPoints_(mesh.boundaryMesh().size()),
oldCellVolumesPtr_()
{
// Identity map for patch points
forAll(patchPointMap_, patchi)
{
const label nPoints = mesh.boundaryMesh()[patchi].meshPoints().size();
oldPatchNMeshPoints_[patchi] = nPoints;
patchPointMap_[patchi] = identity(nPoints);
}
// Identity maps for zones
forAll(pointZoneMap_, zonei)
{
pointZoneMap_[zonei] = identity(mesh.pointZones()[zonei].size());
}
forAll(faceZonePointMap_, zonei)
{
faceZonePointMap_[zonei] =
identity(mesh.faceZones()[zonei]().meshPoints().size());
}
forAll(faceZoneFaceMap_, zonei)
{
pointZoneMap_[zonei] = identity(mesh.faceZones()[zonei].size());
}
forAll(cellZoneMap_, zonei)
{
cellZoneMap_[zonei] = identity(mesh.cellZones()[zonei].size());
}
}
Foam::mapPolyMesh::mapPolyMesh
(
const polyMesh& mesh,
......
......@@ -233,27 +233,27 @@ class mapPolyMesh
const labelHashSet flipFaceFlux_;
//- Patch mesh point renumbering
const labelListList patchPointMap_;
labelListList patchPointMap_;
//- Point zone renumbering
// For every preserved point in zone give the old position.
// For added points, the index is set to -1
const labelListList pointZoneMap_;
labelListList pointZoneMap_;
//- Face zone point renumbering
// For every preserved point in zone give the old position.
// For added points, the index is set to -1
const labelListList faceZonePointMap_;
labelListList faceZonePointMap_;
//- Face zone face renumbering
// For every preserved face in zone give the old position.
// For added faces, the index is set to -1
const labelListList faceZoneFaceMap_;
labelListList faceZoneFaceMap_;
//- Cell zone renumbering
// For every preserved cell in zone give the old position.
// For added cells, the index is set to -1
const labelListList cellZoneMap_;
labelListList cellZoneMap_;
//- Pre-motion point positions.
// This specifies the correct way of blowing up zero-volume objects
......@@ -266,7 +266,7 @@ class mapPolyMesh
const labelList oldPatchStarts_;
//- List of numbers of mesh points per old patch
const labelList oldPatchNMeshPoints_;
labelList oldPatchNMeshPoints_;
//- Optional old cell volumes (for mapping)
autoPtr<scalarField> oldCellVolumesPtr_;
......@@ -285,6 +285,9 @@ public:
// Constructors
//- Construct from mesh
mapPolyMesh(const polyMesh& mesh);
//- Construct from components. Copy (except for oldCellVolumes).
mapPolyMesh
(
......
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