[cig-commits] r17203 - in short/3D/PyLith/trunk: libsrc/topology unittests/pytests/topology/data

brad at geodynamics.org brad at geodynamics.org
Mon Sep 20 13:29:22 PDT 2010


Author: brad
Date: 2010-09-20 13:29:22 -0700 (Mon, 20 Sep 2010)
New Revision: 17203

Modified:
   short/3D/PyLith/trunk/libsrc/topology/RefineUniform.cc
   short/3D/PyLith/trunk/unittests/pytests/topology/data/twotet4.mesh
   short/3D/PyLith/trunk/unittests/pytests/topology/data/twotet4_nofault_refined2.mesh
Log:
Fixed some global uniform refinement bugs. Set unit test data to correct values.

Modified: short/3D/PyLith/trunk/libsrc/topology/RefineUniform.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/RefineUniform.cc	2010-09-20 18:46:24 UTC (rev 17202)
+++ short/3D/PyLith/trunk/libsrc/topology/RefineUniform.cc	2010-09-20 20:29:22 UTC (rev 17203)
@@ -112,18 +112,10 @@
     new SieveMesh::sieve_type(mesh.comm(), mesh.debug());
   newSieveMesh->setSieve(newSieve);
 
-  std::map<edge_type, point_type> edge2vertex;
-   
-#if 0 // ORIGINAL VERSION
-  ALE::MeshBuilder<Mesh>::refineTetrahedra(*mesh.sieveMesh(), * newSieveMesh,
-					   edge2vertex);
-#else
-  // Is arg to CellRefiner constructor the new mesh or the old mesh?
   ALE::MeshBuilder<SieveMesh>::CellRefiner<SieveMesh,edge_type> refiner(*sieveMesh);
 
   ALE::MeshBuilder<SieveMesh>::refineGeneral< SieveMesh,
     ALE::MeshBuilder<SieveMesh>::CellRefiner<SieveMesh,edge_type> >(*sieveMesh, *newSieveMesh, refiner);
-#endif
 
   // Fix material ids
   const int numCells = sieveMesh->heightStratum(0)->size();
@@ -146,6 +138,8 @@
   const ALE::Obj<std::set<std::string> >& sectionNames =
     sieveMesh->getIntSections();
   
+  ALE::MeshBuilder<SieveMesh>::CellRefiner<SieveMesh,edge_type>::edge_map_type& edge2vertex = refiner.getEdgeToVertex();
+
   const std::set<std::string>::const_iterator namesBegin = 
     sectionNames->begin();
   const std::set<std::string>::const_iterator namesEnd = 
@@ -161,6 +155,7 @@
     newGroup->setChart(Mesh::IntSection::chart_type(numNewCells, 
 						    numNewCells + numNewVertices));
     const Mesh::IntSection::chart_type& newChart = newGroup->getChart();
+    std::cout << "NEW CHART (" << numNewCells << ", " << numNewCells + numNewVertices << ")" << std::endl;
       
     const int chartMax = chart.max();
     for (int p = chart.min(), pNew = newChart.min(); p < chartMax; ++p, ++pNew) {
@@ -173,8 +168,7 @@
 	 e_iter != edge2VertexEnd;
 	 ++e_iter) {
       const point_type vertexA = e_iter->first.first;
-      const point_type vertexB = e_iter->first.second;
-      
+      const point_type vertexB = e_iter->first.second;      
       if (group->getFiberDimension(vertexA) && group->getFiberDimension(vertexB))
 	if (group->restrictPoint(vertexA)[0] == group->restrictPoint(vertexB)[0])
 	  newGroup->setFiberDimension(e_iter->second, 1);

Modified: short/3D/PyLith/trunk/unittests/pytests/topology/data/twotet4.mesh
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/topology/data/twotet4.mesh	2010-09-20 18:46:24 UTC (rev 17202)
+++ short/3D/PyLith/trunk/unittests/pytests/topology/data/twotet4.mesh	2010-09-20 20:29:22 UTC (rev 17203)
@@ -52,7 +52,7 @@
     // In this example, cells 0 and 1 both are associated with material ID 1.
     material-ids = {
              0   1
-             1   1
+             1   2
     }
   }
 

Modified: short/3D/PyLith/trunk/unittests/pytests/topology/data/twotet4_nofault_refined2.mesh
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/topology/data/twotet4_nofault_refined2.mesh	2010-09-20 18:46:24 UTC (rev 17202)
+++ short/3D/PyLith/trunk/unittests/pytests/topology/data/twotet4_nofault_refined2.mesh	2010-09-20 20:29:22 UTC (rev 17203)
@@ -1,110 +1,106 @@
-// Global mesh object.
-// This defines a mesh composed of two tetrahedral elements.
 mesh = {
-
-  // This is a 3D mesh.
   dimension = 3
-
-  // We are using zero-indexing (default) rather than one-indexing.
   use-index-zero = true
-
-  // Describe the vertices (nodes) defining the mesh.
   vertices = {
-
-    // The vertices are defined in a 3D coordinate system.
     dimension = 3
-
-    // There are 5 vertices.
-    count = 5
-
-    // List the coordinates as:
-    // Vertex number (starting from zero), x-coord, y-coord, z-coord
-    // Use coordinate units that are consistent with the other units used.
+    count = 14
     coordinates = {
-             0     -1.0  0.0  0.0
-             1      0.0 -1.0  0.0
-             2      0.0  0.0  1.0
-             3      0.0  1.0  0.0
-             4      1.0  0.0  0.0
+             0     -1.000000e+00      0.000000e+00      0.000000e+00
+             1      0.000000e+00     -1.000000e+00      0.000000e+00
+             2      0.000000e+00      0.000000e+00      1.000000e+00
+             3      0.000000e+00      1.000000e+00      0.000000e+00
+             4      1.000000e+00      0.000000e+00      0.000000e+00
+             5      0.000000e+00     -5.000000e-01      5.000000e-01
+             6      0.000000e+00      5.000000e-01      5.000000e-01
+             7      0.000000e+00      0.000000e+00      0.000000e+00
+             8     -5.000000e-01     -5.000000e-01      0.000000e+00
+             9     -5.000000e-01      0.000000e+00      5.000000e-01
+            10     -5.000000e-01      5.000000e-01      0.000000e+00
+            11      5.000000e-01     -5.000000e-01      0.000000e+00
+            12      5.000000e-01      5.000000e-01      0.000000e+00
+            13      5.000000e-01      0.000000e+00      5.000000e-01
     }
   }
-
-  // Describe the cells (elements) composing the mesh.
   cells = {
-
-    // There are 2 cells.
-    count = 2
-
-    // These are linear tetrahedral cells, so there are 4 corners per cell.
+    count = 16
     num-corners = 4
-
-    // List the vertices composing each cell (see manual for ordering).
-    // List the information as:
-    // Cell number (starting from zero), vertex 0, vertex 1, vertex 2, vertex 3
     simplices = {
-             0       1  2  3  0
-             1       1  3  2  4
+             0       1       8       5       7
+             1       2       9       6       5
+             2       3      10       7       6
+             3       0       8      10       9
+             4       5       8       9       6
+             5       6       9      10       8
+             6       7      10       8       6
+             7       5       6       7       8
+             8       1      11       7       5
+             9       3      12       6       7
+            10       2      13       5       6
+            11       4      11      13      12
+            12       7      11      12       6
+            13       6      12      13      11
+            14       5      13      11       6
+            15       7       6       5      11
     }
-
-    // List the material ID's associated with each cell.
-    // Different ID's may be used to specify a different material type, or
-    // to use a different spatial database for each material ID.
-    // In this example, cells 0 and 1 both are associated with material ID 1.
     material-ids = {
              0   1
              1   1
+             2   1
+             3   1
+             4   1
+             5   1
+             6   1
+             7   1
+             8   2
+             9   2
+            10   2
+            11   2
+            12   2
+            13   2
+            14   2
+            15   2
     }
   }
-
-  // Here we list different groups (cells or vertices) that we want to associate
-  // with a particular name (ID).
-
-  // This group of vertices may be used to define a fault.
-  // There are 3 vertices corresponding to indices 1, 2 and 3.
   group = {
-    name = fault
+    name = edge 1
     type = vertices
     count = 3
     indices = {
+      0
       1
-      2
-      3
+      8
     }
   }
-
-  // This group of vertices may be used to specify boundary conditions.
-  // There are 2 vertices corresponding to indices 0 and 4.
   group = {
-    name = end points
+    name = edge 2
     type = vertices
-    count = 2
+    count = 3
     indices = {
-      0
+      2
       4
+      13
     }
   }
-
-  // This group of vertices may be used to specify boundary conditions.
-  // There are 2 vertices corresponding to indices 0, 1.
   group = {
-    name = edge 1
+    name = end points
     type = vertices
     count = 2
     indices = {
       0
-      1
+      4
     }
   }
-
-  // This group of vertices may be used to specify boundary conditions.
-  // There are 2 vertices corresponding to indices 2, 4.
   group = {
-    name = edge 2
+    name = fault
     type = vertices
-    count = 2
+    count = 6
     indices = {
+      1
       2
-      4
+      3
+      5
+      6
+      7
     }
   }
 }



More information about the CIG-COMMITS mailing list