BUG: update points reference in surfMesh fails (issue #320)

- Should be updating references (shallow copy), but triggers a deep copy
  instead. Likely introduced by 6e573ad7e8.
This commit is contained in:
Mark Olesen
2016-11-30 14:13:01 +01:00
parent ed27b25ff8
commit 7b450a2915

View File

@ -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<SubField<point>&>
// Assign the reference to the points (quite ugly)
// points() are returned as Field but are actually stored as SubField
reinterpret_cast<typename MeshReference::PointFieldType&>
(
const_cast<Field<point>&>(MeshReference::points())
) = reinterpret_cast<SubField<point>&>(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<MeshReference&>(*this).shallowCopy
(
this->storedFaces()
);
}