From 844f9433db39a121c1f0e0ee19811944a668377e Mon Sep 17 00:00:00 2001 From: mattijs <mattijs> Date: Fri, 31 Aug 2012 12:55:17 +0100 Subject: [PATCH] BUG: polyMesh: update registered pointMesh --- src/OpenFOAM/meshes/pointMesh/pointMesh.C | 37 ++++++++++++++++++- src/OpenFOAM/meshes/pointMesh/pointMesh.H | 6 ++- src/OpenFOAM/meshes/polyMesh/polyMeshClear.C | 28 ++++++++++++-- src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C | 7 ++++ 4 files changed, 73 insertions(+), 5 deletions(-) diff --git a/src/OpenFOAM/meshes/pointMesh/pointMesh.C b/src/OpenFOAM/meshes/pointMesh/pointMesh.C index 6022f03c39b..f378a5d7802 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointMesh.C +++ b/src/OpenFOAM/meshes/pointMesh/pointMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,10 +30,26 @@ License #include "MapGeometricFields.H" #include "MapPointField.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + +defineTypeNameAndDebug(pointMesh, 0); + +} + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // void Foam::pointMesh::mapFields(const mapPolyMesh& mpm) { + if (debug) + { + Pout<< "void pointMesh::mapFields(const mapPolyMesh&): " + << "Mapping all registered pointFields." + << endl; + } // Create a mapper const pointMeshMapper m(*this, mpm); @@ -60,6 +76,13 @@ Foam::pointMesh::pointMesh(const polyMesh& pMesh) GeoMesh<polyMesh>(pMesh), boundary_(*this, pMesh.boundaryMesh()) { + if (debug) + { + Pout<< "pointMesh::pointMesh(const polyMesh&): " + << "Constructing from polyMesh " << pMesh.name() + << endl; + } + // Calculate the geometry for the patches (transformation tensors etc.) boundary_.calcGeometry(); } @@ -67,12 +90,24 @@ Foam::pointMesh::pointMesh(const polyMesh& pMesh) void Foam::pointMesh::movePoints(const pointField& newPoints) { + if (debug) + { + Pout<< "pointMesh::movePoints(const pointField&): " + << "Moving points." << endl; + } + boundary_.movePoints(newPoints); } void Foam::pointMesh::updateMesh(const mapPolyMesh& mpm) { + if (debug) + { + Pout<< "pointMesh::updateMesh(const mapPolyMesh&): " + << "Updating for topology changes." << endl; + Pout<< endl; + } boundary_.updateMesh(); // Map all registered point fields diff --git a/src/OpenFOAM/meshes/pointMesh/pointMesh.H b/src/OpenFOAM/meshes/pointMesh/pointMesh.H index e40e211aefa..25e8af95304 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointMesh.H +++ b/src/OpenFOAM/meshes/pointMesh/pointMesh.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -71,6 +71,10 @@ class pointMesh public: + // Declare name of the class and its debug switch + ClassName("pointMesh"); + + typedef pointMesh Mesh; typedef pointBoundaryMesh BoundaryMesh; diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshClear.C b/src/OpenFOAM/meshes/polyMesh/polyMeshClear.C index d765e9f60b7..f2c7bca7de4 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshClear.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshClear.C @@ -73,8 +73,22 @@ void Foam::polyMesh::clearGeom() tetBasePtIsPtr_.clear(); // Remove the cell tree cellTreePtr_.clear(); +} - pointMesh::Delete(*this); + +void Foam::polyMesh::clearAdditionalGeom() +{ + if (debug) + { + Info<< "void polyMesh::clearAdditionalGeom() : " + << "clearing additional geometric data" + << endl; + } + + // Remove the stored tet base points + tetBasePtIsPtr_.clear(); + // Remove the cell tree + cellTreePtr_.clear(); } @@ -106,8 +120,6 @@ void Foam::polyMesh::clearAddressing() tetBasePtIsPtr_.clear(); // Remove the cell tree cellTreePtr_.clear(); - - pointMesh::Delete(*this); } @@ -120,6 +132,8 @@ void Foam::polyMesh::clearPrimitives() owner_.setSize(0); neighbour_.setSize(0); + pointMesh::Delete(*this); + clearedPrimitives_ = true; } @@ -128,11 +142,19 @@ void Foam::polyMesh::clearOut() { clearGeom(); clearAddressing(); + pointMesh::Delete(*this); } void Foam::polyMesh::clearCellTree() { + if (debug) + { + Info<< "void polyMesh::clearCellTree() : " + << "clearing cell tree" + << endl; + } + cellTreePtr_.clear(); } diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C b/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C index 96dc726b44a..0fdce95e37a 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C @@ -38,6 +38,13 @@ Description void Foam::polyMesh::updateMesh(const mapPolyMesh& mpm) { + if (debug) + { + Info<< "void polyMesh::updateMesh(const mapPolyMesh&) : " + << "updating addressing and (optional) pointMesh/pointFields" + << endl; + } + // Update boundaryMesh (note that patches themselves already ok) boundary_.updateMesh(); -- GitLab