View Issue Details

IDProjectCategoryView StatusLast Update
0000089OpenFOAM[All Projects] Bugpublic2010-11-25 12:19
ReporterbgschaidAssigned Touser4 
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
Product Version 
Fixed in Version 
Summary0000089: updateGeometry of sampledSurface-subclass does not delete derived data (faceCenters etc)
DescriptionI stumbled on this when a sampledIsioSurface after an updateGeometry still had the old values for the face-centers (although the surface and even the number of faces had changed).

The attached patch deletes that data via clearGeom every time the facesPtr_ is cleared (which makes the data invalid)
- I only tested this for sampledIsoSurface
- Better design would probably be to collect these two operations into an atomic method
TagsNo tags attached.

Activities

bgschaid

2010-11-24 22:28

reporter  

sampledIsoUpdate (3,309 bytes)
# HG changeset patch
# Parent 5bf0d3912694baf27c505a34339c49b03e1c4468

diff --git a/src/sampling/sampledSurface/distanceSurface/distanceSurface.C b/src/sampling/sampledSurface/distanceSurface/distanceSurface.C
--- a/src/sampling/sampledSurface/distanceSurface/distanceSurface.C
+++ b/src/sampling/sampledSurface/distanceSurface/distanceSurface.C
@@ -52,6 +52,9 @@
     // Clear any stored topologies
     facesPtr_.clear();
 
+    // Clear derived data
+    clearGeom();
+
     const fvMesh& fvm = static_cast<const fvMesh&>(mesh());
 
     // Distance to cell centres
@@ -327,6 +330,9 @@
     // Clear any stored topologies
     facesPtr_.clear();
 
+    // Clear derived data
+    clearGeom();
+
     // already marked as expired
     if (needsUpdate_)
     {
diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.C b/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.C
--- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.C
+++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurface.C
@@ -423,6 +423,9 @@
     surfPtr_.clear();
     facesPtr_.clear();
 
+    // Clear derived data
+    clearGeom();
+
     if (subMeshPtr_.valid())
     {
         surfPtr_.reset
@@ -561,6 +564,9 @@
     facesPtr_.clear();
     subMeshPtr_.clear();
 
+    // Clear derived data
+    clearGeom();
+
     // already marked as expired
     if (prevTimeIndex_ == -1)
     {
diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.C b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.C
--- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.C
+++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.C
@@ -56,6 +56,9 @@
     // Clear any stored topo
     facesPtr_.clear();
 
+    // Clear derived data
+    sampledSurface::clearGeom();
+
     // Optionally read volScalarField
     autoPtr<volScalarField> readFieldPtr_;
 
@@ -237,6 +240,9 @@
 {
     facesPtr_.clear();
 
+    // Clear derived data
+    sampledSurface::clearGeom();
+
     // already marked as expired
     if (prevTimeIndex_ == -1)
     {
diff --git a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.C b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.C
--- a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.C
+++ b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.C
@@ -61,6 +61,8 @@
     pointDistance_.clear();
     cellDistancePtr_.clear();
 
+    // Clear derived data
+    clearGeom();
 
     // Get any subMesh
     if (zoneID_.index() != -1 && !subMeshPtr_.valid())
@@ -313,6 +315,9 @@
     // Clear any stored topologies
     facesPtr_.clear();
 
+    // Clear derived data
+    clearGeom();
+
     // already marked as expired
     if (needsUpdate_)
     {
diff --git a/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.C b/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.C
--- a/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.C
+++ b/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.C
@@ -124,6 +124,8 @@
     ).MeshedSurface<face>::transfer(surf);
     meshCells_.transfer(surf.meshCells());
 
+    // clear derived data
+    sampledSurface::clearGeom();
 
     if (debug)
     {
sampledIsoUpdate (3,309 bytes)

user4

2010-11-25 12:19

  ~0000140

fixed 93f90d857e39eb3946ee9623e952400272b28636

Many thanks!

Issue History

Date Modified Username Field Change
2010-11-24 22:28 bgschaid New Issue
2010-11-24 22:28 bgschaid File Added: sampledIsoUpdate
2010-11-25 12:19 user4 Note Added: 0000140
2010-11-25 12:19 user4 Status new => resolved
2010-11-25 12:19 user4 Fixed in Version => 1.7.x
2010-11-25 12:19 user4 Resolution open => fixed
2010-11-25 12:19 user4 Assigned To => user4