On Thu, 25 Oct 2012, Derek Gaston wrote:

This all sounds good to me!

Try the attached patch?
---
Roy
Index: include/mesh/mesh_base.h
===================================================================
--- include/mesh/mesh_base.h    (revision 6209)
+++ include/mesh/mesh_base.h    (working copy)
@@ -469,14 +469,10 @@
    *  2.) call \p partition()
    *  3.) call \p renumber_nodes_and_elements()
    *
-   * The read_xda_file boolean flag is true when prepare_for_use
-   * is called from Mesh::read after reading an xda file.  It prevents
-   * the renumbering of nodes and elements.  In general, leave this at
-   * the default value of false.
-   *
-   * skip_renumber is currently set to TRUE to work around an I/O bug
+   * The argument to skip renumbering is now deprecated - to prevent a
+   * mesh from being renumbered, set allow_renumbering(false).
    */
-  void prepare_for_use (const bool skip_renumber_nodes_and_elements=true);
+  void prepare_for_use (const bool skip_renumber_nodes_and_elements=false);
 
   /**
    * Call the default partitioner (currently \p metis_partition()).
Index: src/mesh/unstructured_mesh.C
===================================================================
--- src/mesh/unstructured_mesh.C        (revision 6209)
+++ src/mesh/unstructured_mesh.C        (working copy)
@@ -173,8 +173,11 @@
     }
   }
 
-  //Finally prepare the Mesh for use
-  this->prepare_for_use(/*skip_renumber =*/true);
+  //Finally prepare the new Mesh for use.  Keep the same numbering but
+  //also the same renumbering policy as our source mesh.
+  this->allow_renumbering(false);
+  this->prepare_for_use();
+  this->allow_renumbering(other_mesh->allow_renumbering());
 }
 
 
@@ -691,10 +694,15 @@
       MeshCommunication().broadcast (*this);
     }
 
+  if (skip_renumber_nodes_and_elements)
+    {
+      // Use MeshBase::allow_renumbering() yourself instead.
+      libmesh_deprecated();
+      this->allow_renumbering(false);
+    }
 
   // Done reading the mesh.  Now prepare it for use.
-  this->prepare_for_use(skip_renumber_nodes_and_elements);
-
+  this->prepare_for_use();
 }
 
 
Index: src/mesh/mesh_base.C
===================================================================
--- src/mesh/mesh_base.C        (revision 6209)
+++ src/mesh/mesh_base.C        (working copy)
@@ -105,18 +105,23 @@
     }
 
   // Renumber the nodes and elements so that they in contiguous
-  // blocks.  By default, skip_renumber_nodes_and_elements is false,
-  // however we may skip this step by passing
-  // skip_renumber_nodes_and_elements==true to this function.
+  // blocks.  By default, _skip_renumber_nodes_and_elements is false.
   //
+  // We may currently change that by passing
+  // skip_renumber_nodes_and_elements==true to this function, but we
+  // should use the allow_renumbering() accessor instead.
+  //
   // Instances where you if prepare_for_use() should not renumber the nodes
   // and elements include reading in e.g. an xda/r or gmv file. In
   // this case, the ordering of the nodes may depend on an accompanying
   // solution, and the node ordering cannot be changed.
-  bool old_skip_renumber_value = _skip_renumber_nodes_and_elements;
-  _skip_renumber_nodes_and_elements = _skip_renumber_nodes_and_elements ||
-                                      skip_renumber_nodes_and_elements;
-  
+
+  if (skip_renumber_nodes_and_elements)
+    {
+      libmesh_deprecated();
+      this->allow_renumbering(false);
+    }
+
   if(!_skip_renumber_nodes_and_elements)
     this->renumber_nodes_and_elements();
 
@@ -132,9 +137,6 @@
   if(!_skip_renumber_nodes_and_elements)
     this->renumber_nodes_and_elements();
 
-  // Restore previously requested behavior
-  _skip_renumber_nodes_and_elements = old_skip_renumber_value;
-
   // Reset our PointLocator.  This needs to happen any time the elements
   // in the underlying elements in the mesh have changed, so we do it here.
   this->clear_point_locator();
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Libmesh-devel mailing list
Libmesh-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-devel

Reply via email to