[cig-commits] r12784 - short/3D/PyLith/trunk/libsrc/meshio

brad at geodynamics.org brad at geodynamics.org
Tue Sep 2 17:10:22 PDT 2008


Author: brad
Date: 2008-09-02 17:10:22 -0700 (Tue, 02 Sep 2008)
New Revision: 12784

Modified:
   short/3D/PyLith/trunk/libsrc/meshio/MeshIOLagrit.cc
   short/3D/PyLith/trunk/libsrc/meshio/MeshIOLagrit.hh
Log:
Fixed parsing of UCD file for fault mesh.

Modified: short/3D/PyLith/trunk/libsrc/meshio/MeshIOLagrit.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/MeshIOLagrit.cc	2008-09-02 22:58:23 UTC (rev 12783)
+++ short/3D/PyLith/trunk/libsrc/meshio/MeshIOLagrit.cc	2008-09-03 00:10:22 UTC (rev 12784)
@@ -123,10 +123,12 @@
     // Section 6: <node_id 1> <node_data 1> ... <node_data num_ndata>
     vertexIDs.resize(numFVertices);
     for(int v = 0; v < numFVertices; ++v) {
-      int id, dummy;
+      int id;
+      double dummy;
 
       fin >> id;
-      fin >> vertexIDs[v];
+      fin >> vertexIDs[v]; // global node number
+      fin >> dummy; // components of normal at vertices
       fin >> dummy;
       fin >> dummy;
     }
@@ -151,19 +153,21 @@
       int id, dummy;
 
       fin >> id;
-      fin >> dummy;
-      fin >> dummy;
-      fin >> faceCells[c*2+0];
+      fin >> faceCells[c*2+0]; // Cell numbers in global mesh on either side of fault
       fin >> faceCells[c*2+1];
-      fin >> dummy;
     }
 
-    // Renumber vertices
-    for(int c = 0; c < numFCells; ++c) {
-      for(int corner = 0; corner < numFCorners; ++corner) {
-        fCells[c*numFCorners+corner] = vertexIDs[fCells[c*numFCorners+corner]];
-      }
-    }
+    // Renumber vertices and use zero based indices
+    // UCD file has one-based indices for both vertexIDs and fCells
+    for(int c = 0; c < numFCells; ++c)
+      for(int corner = 0; corner < numFCorners; ++corner)
+        fCells[c*numFCorners+corner] = 
+	  vertexIDs[fCells[c*numFCorners+corner]-1] - 1;
+
+    // Switch to zero based index for global cell numbering
+    for (int c=0; c < numFCells; ++c)
+      for (int i=0; i < 2; ++i)
+	faceCells[c*2+i] -= 1;
   }
 
   _buildFaultMesh(fCoordinates, numFVertices, fSpaceDim, fCells, numFCells, numFCorners, faceCells, faultDim, fault, faultBd);

Modified: short/3D/PyLith/trunk/libsrc/meshio/MeshIOLagrit.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/MeshIOLagrit.hh	2008-09-02 22:58:23 UTC (rev 12783)
+++ short/3D/PyLith/trunk/libsrc/meshio/MeshIOLagrit.hh	2008-09-03 00:10:22 UTC (rev 12784)
@@ -111,7 +111,11 @@
    */
   bool isRecordHeader32Bit(void) const;
 
-  static void readFault(const std::string filename, const Obj<Mesh>& fault, Obj<ALE::Mesh>& faultBd);
+  // TEMPORARY
+  static
+  void readFault(const std::string filename,
+		 const Obj<Mesh>& fault,
+		 Obj<ALE::Mesh>& faultBd);
 
 // PROTECTED METHODS ////////////////////////////////////////////////////
 protected :



More information about the cig-commits mailing list