From 7b450a2915e3dbbb71fc8e30352f98cce3764e17 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 30 Nov 2016 14:13:01 +0100 Subject: [PATCH] BUG: update points reference in surfMesh fails (issue #320) - Should be updating references (shallow copy), but triggers a deep copy instead. Likely introduced by 6e573ad7e83d1e928cc3. --- src/surfMesh/surfMesh/surfMesh.C | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/surfMesh/surfMesh/surfMesh.C b/src/surfMesh/surfMesh/surfMesh.C index c7eef6b72b..f1ed76a7eb 100644 --- a/src/surfMesh/surfMesh/surfMesh.C +++ b/src/surfMesh/surfMesh/surfMesh.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -229,18 +229,25 @@ Foam::surfMesh::~surfMesh() void Foam::surfMesh::updatePointsRef() { - // Assign the reference to the points (this is truly ugly) - reinterpret_cast&> + // Assign the reference to the points (quite ugly) + // points() are returned as Field but are actually stored as SubField + reinterpret_cast ( const_cast&>(MeshReference::points()) - ) = reinterpret_cast&>(this->storedPoints()); + ).shallowCopy + ( + this->storedPoints() + ); } void Foam::surfMesh::updateFacesRef() { - // Assign the reference to the faces - shallowCopy(this->storedFaces()); + // Assign the reference to the faces (UList) + static_cast(*this).shallowCopy + ( + this->storedFaces() + ); }