From 5e19fee4c6160c11def0e263a23869565a5eaee2 Mon Sep 17 00:00:00 2001 From: mattijs <mattijs> Date: Wed, 11 Nov 2015 13:28:41 +0000 Subject: [PATCH] BUG: polyMesh: update patchGroups when polyMesh::readUpdate --- src/OpenFOAM/meshes/polyMesh/polyMeshIO.C | 5 ++- src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C | 42 +++++++++++++++---- .../polyPatches/polyPatch/polyPatch.C | 26 +++++++++++- .../polyPatches/polyPatch/polyPatch.H | 14 ++++++- 4 files changed, 76 insertions(+), 11 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C b/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C index 6015f1167dd..7b36d92c587 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -227,7 +227,8 @@ Foam::polyMesh::readUpdateState Foam::polyMesh::readUpdate() newBoundary[patchI].start(), patchI, boundary_, - newBoundary[patchI].type() + newBoundary[patchI].physicalType(), + newBoundary[patchI].inGroups() ); } } diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C b/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C index 4a8b5dd7d73..f26f77cad30 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -78,15 +78,43 @@ void Foam::polyMesh::updateMesh(const mapPolyMesh& mpm) newMotionPoints.setSize(points_.size()); // Map the list - newMotionPoints.map(oldMotionPoints, mpm.pointMap()); + if (mpm.hasMotionPoints()) + { + newMotionPoints.map(oldMotionPoints, mpm.pointMap()); - // Any points created out-of-nothing get set to the current coordinate - // for lack of anything better. - forAll(mpm.pointMap(), newPointI) + // Any points created out-of-nothing get set to the current + // coordinate for lack of anything better. + forAll(mpm.pointMap(), newPointI) + { + if (mpm.pointMap()[newPointI] == -1) + { + newMotionPoints[newPointI] = points_[newPointI]; + } + } + } + else { - if (mpm.pointMap()[newPointI] == -1) + const labelList& pointMap = mpm.pointMap(); + const labelList& revPointMap = mpm.reversePointMap(); + + forAll(pointMap, newPointI) { - newMotionPoints[newPointI] = points_[newPointI]; + label oldPointI = pointMap[newPointI]; + if (oldPointI >= 0) + { + if (revPointMap[oldPointI] == newPointI) // master point + { + newMotionPoints[newPointI] = oldMotionPoints[oldPointI]; + } + else + { + newMotionPoints[newPointI] = points_[newPointI]; + } + } + else + { + newMotionPoints[newPointI] = points_[newPointI]; + } } } } diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C index d7508c3d94a..dd1583577ff 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -107,6 +107,30 @@ Foam::polyPatch::polyPatch } +Foam::polyPatch::polyPatch +( + const word& name, + const label size, + const label start, + const label index, + const polyBoundaryMesh& bm, + const word& physicalType, + const wordList& inGroups +) +: + patchIdentifier(name, index, physicalType, inGroups), + primitivePatch + ( + faceSubList(bm.mesh().faces(), size, start), + bm.mesh().points() + ), + start_(start), + boundaryMesh_(bm), + faceCellsPtr_(NULL), + mePtr_(NULL) +{} + + Foam::polyPatch::polyPatch ( const word& name, diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H index b13faf0968f..2e12697a184 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -179,6 +179,18 @@ public: const word& patchType ); + //- Construct from components + polyPatch + ( + const word& name, + const label size, + const label start, + const label index, + const polyBoundaryMesh& bm, + const word& physicalType, + const wordList& inGroups + ); + //- Construct from dictionary polyPatch ( -- GitLab