diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapPolyMesh.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapPolyMesh.C index 5fad25254ab3fb49228850baf715d955e2ab2b51..b3d4a4467c45264c0d70a4fc5fef892608cb072d 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapPolyMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapPolyMesh.C @@ -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, diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapPolyMesh.H b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapPolyMesh.H index 0224d922cb086c8001e2f1fcfbb85bf6a5bc0bc8..32a2d94ea9ad1b3d3ab4783c8d52fb7cb8791253 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapPolyMesh.H +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapPolyMesh.H @@ -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 (