[cig-commits] r17938 - in short/3D/PyLith/branches/pylith-scecdynrup: . examples/greensfns/hex8 libsrc/faults libsrc/meshio libsrc/topology playpen/postproc pylith/apps pylith/perf pylith/topology tests

brad at geodynamics.org brad at geodynamics.org
Mon Feb 21 20:36:04 PST 2011


Author: brad
Date: 2011-02-21 20:36:03 -0800 (Mon, 21 Feb 2011)
New Revision: 17938

Added:
   short/3D/PyLith/branches/pylith-scecdynrup/tests/topology/
Modified:
   short/3D/PyLith/branches/pylith-scecdynrup/configure.ac
   short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/designdata.py
   short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/getcoords.py
   short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/lininvert.py
   short/3D/PyLith/branches/pylith-scecdynrup/libsrc/faults/FaultCohesiveDyn.cc
   short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/MeshBuilder.cc
   short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/MeshIO.cc
   short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Distributor.cc
   short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Mesh.cc
   short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Mesh.icc
   short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/MeshRefiner.cc
   short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/ReverseCuthillMcKee.cc
   short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/SubMesh.cc
   short/3D/PyLith/branches/pylith-scecdynrup/playpen/postproc/stressinfo.py
   short/3D/PyLith/branches/pylith-scecdynrup/pylith/apps/PetscApplication.py
   short/3D/PyLith/branches/pylith-scecdynrup/pylith/perf/MemoryLogger.py
   short/3D/PyLith/branches/pylith-scecdynrup/pylith/perf/Mesh.py
   short/3D/PyLith/branches/pylith-scecdynrup/pylith/perf/VertexGroup.py
   short/3D/PyLith/branches/pylith-scecdynrup/pylith/topology/MeshImporter.py
   short/3D/PyLith/branches/pylith-scecdynrup/pylith/topology/RefineUniform.py
   short/3D/PyLith/branches/pylith-scecdynrup/subpackage.am
   short/3D/PyLith/branches/pylith-scecdynrup/tests/Makefile.am
Log:
Merge from trunk.

Modified: short/3D/PyLith/branches/pylith-scecdynrup/configure.ac
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/configure.ac	2011-02-22 04:34:18 UTC (rev 17937)
+++ short/3D/PyLith/branches/pylith-scecdynrup/configure.ac	2011-02-22 04:36:03 UTC (rev 17938)
@@ -377,6 +377,7 @@
 		tests/3d/plasticity/threehex8/mesh/Makefile
 		tests/3d/plasticity/threehex8/results/Makefile
 		tests/3d/plasticity/threehex8/spatialdb/Makefile
+		tests/topology/Makefile
                 doc/Makefile
 		doc/developer/Makefile
 		doc/install/Makefile

Modified: short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/designdata.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/designdata.py	2011-02-22 04:34:18 UTC (rev 17937)
+++ short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/designdata.py	2011-02-22 04:36:03 UTC (rev 17938)
@@ -2,11 +2,17 @@
 #
 # ----------------------------------------------------------------------
 #
-#                           Brad T. Aagaard
-#                        U.S. Geological Survey
+# Brad T. Aagaard, U.S. Geological Survey
+# Charles A. Williams, GNS Science
+# Matthew G. Knepley, University of Chicago
 #
-# <LicenseText>
+# This code was developed as part of the Computational Infrastructure
+# for Geodynamics (http://geodynamics.org).
 #
+# Copyright (c) 2010 University of California, Davis
+#
+# See COPYING for license information.
+#
 # ----------------------------------------------------------------------
 #
 

Modified: short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/getcoords.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/getcoords.py	2011-02-22 04:34:18 UTC (rev 17937)
+++ short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/getcoords.py	2011-02-22 04:36:03 UTC (rev 17938)
@@ -14,7 +14,7 @@
 
 ## @brief Python application to get the coordinates for a set of vertex
 ## ID's and output them to a file. This is a very simple code that expects
-## coordinates in Abaqus format as well as ID's in Abaqus nodeset format.
+## coordinates and ID's obtained using ncdump on the Exodus file.
 
 import math
 import numpy
@@ -30,7 +30,7 @@
   """
   Python application to get the coordinates for a set of vertex
   ID's and output them to a file. This is a very simple code that expects
-  coordinates in Abaqus format as well as ID's in Abaqus nodeset format.
+  coordinates and ID's obtained using ncdump on the Exodus file.
   """
   
   class Inventory(Application.Inventory):
@@ -105,7 +105,8 @@
     lines = f.readlines()
     for line in lines:
       for entry in line.split(', '):
-        self.idList.append(int(entry.rstrip(',\n')))
+        idEntry = int(entry.rstrip(',\n')) - 1
+        self.idList.append(idEntry)
 
     self.numIds = len(self.idList)
     f.close()
@@ -118,23 +119,10 @@
     Function to read a list of coordinates and output the coordinates if
     they correspond to one of the requested ID's.
     """
-    f = open(self.coordFile, 'r')
-    o = open(self.outputFile, 'w')
-    lines = f.readlines()
-    for line in lines:
-      vertexId = int(line.split(', ')[0].rstrip(',\n'))
-      for requestedId in self.idList:
-        if vertexId == requestedId:
-          x = line.split(', ')[1].rstrip(',')
-          y = line.split(', ')[2].rstrip(',')
-          z = line.split(', ')[3].rstrip(',\n')
-          outLine = x + '   ' + y + '   ' + z + '\n'
-          o.write(outLine)
-          break
+    meshCoords = numpy.loadtxt(self.coordFile, dtype=numpy.float64)
+    outputCoords = meshCoords[self.idList,:]
+    numpy.savetxt(self.outputFile, outputCoords)
 
-    f.close()
-    o.close()
-
     return
   
 

Modified: short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/lininvert.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/lininvert.py	2011-02-22 04:34:18 UTC (rev 17937)
+++ short/3D/PyLith/branches/pylith-scecdynrup/examples/greensfns/hex8/lininvert.py	2011-02-22 04:36:03 UTC (rev 17938)
@@ -160,9 +160,9 @@
 
     self.numObs = self.dataVals.shape[0]
     self.numParams = self.aprioriVals.shape[0]
-    # print "Number of observations: %i" % self.numObs
-    # print "Number of parameters: %i" % self.numParams
-    # sys.stdout.flush()
+    print "Number of observations: %i" % self.numObs
+    print "Number of parameters: %i" % self.numParams
+    sys.stdout.flush()
 
     return
 
@@ -195,21 +195,29 @@
     self.fData = numpy.diag(fDataVec)
     self.predicted = numpy.dot(self.dataDesign, self.solution)
     dataMisfit = self.dataVals - self.predicted
-    weightMisfit = dataMisfit * fDataVec
-    self.chiSquare = numpy.sum(weightMisfit * weightMisfit)
+    dataWeightMisfit = dataMisfit * fDataVec
+    self.chiSquare = numpy.sum(dataWeightMisfit * dataWeightMisfit)
+    dataMisfitNorm = numpy.linalg.norm(dataMisfit)
+    dataWeightMisfitNorm = numpy.linalg.norm(dataWeightMisfit)
     
     # Write out inversion info.
     string1 = "\nNumber of observations:  %i\n" % self.numObs
     string2 = "Number of parameters:  %i\n" % self.numParams
-    string3 = "Chi-square value:  %e\n" % self.chiSquare
+    string3 = "Data Chi-square value:  %e\n" % self.chiSquare
+    string4 = "Data residual norm:  %e\n" % dataMisfitNorm
+    string5 = "Weighted data residual norm:  %e\n" % dataWeightMisfitNorm
     print string1
     print string2
     print string3
+    print string4
+    print string5
     sys.stdout.flush()
     i = open(self.infoOutputFile, 'w')
     i.write(string1)
     i.write(string2)
     i.write(string3)
+    i.write(string4)
+    i.write(string5)
     i.close()
                                
     # Write out data info.
@@ -222,7 +230,7 @@
     
     dataOut = numpy.transpose(numpy.vstack((self.dataVals, self.predicted,
                                             fDataVecInv, dataMisfit,
-                                            weightMisfit)))
+                                            dataWeightMisfit)))
     numpy.savetxt(self.dataOutputFile, dataOut)
 
     return

Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/faults/FaultCohesiveDyn.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/faults/FaultCohesiveDyn.cc	2011-02-22 04:34:18 UTC (rev 17937)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/faults/FaultCohesiveDyn.cc	2011-02-22 04:36:03 UTC (rev 17938)
@@ -302,7 +302,7 @@
     // Compute traction by dividing force by area
     assert(*areaVertex > 0);
     tractionTVertex = lagrangeTVertex / (*areaVertex);
-      tractionTpdtVertex = lagrangeTpdtVertex / (*areaVertex);
+    tractionTpdtVertex = lagrangeTpdtVertex / (*areaVertex);
 
     // Get friction properties and state variables.
     _friction->retrievePropsStateVars(v_fault);
@@ -759,10 +759,6 @@
     const int v_negative = _cohesiveVertices[iVertex].negative;
     const int v_positive = _cohesiveVertices[iVertex].positive;
 
-    // Compute contribution only if Lagrange constraint is local.
-    if (!globalOrder->isLocal(v_lagrange))
-      continue;
-
 #if defined(DETAILED_EVENT_LOGGING)
     _logger->eventBegin(restrictEvent);
 #endif
@@ -955,15 +951,21 @@
     _logger->eventBegin(updateEvent);
 #endif
 
-    // Adjust displacements to account for Lagrange multiplier values
-    // (assumed to be zero in perliminary solve).
-    assert(dispTIncrVertexN.size() == 
-	   dispTIncrAdjSection->getFiberDimension(v_negative));
-    dispTIncrAdjSection->updateAddPoint(v_negative, &dispTIncrVertexN[0]);
+    // Compute contribution to adjusting solution only if Lagrange
+    // constraint is local (the adjustment is assembled across processors).
+    if (globalOrder->isLocal(v_lagrange)) {
+      // Adjust displacements to account for Lagrange multiplier values
+      // (assumed to be zero in perliminary solve).
+      assert(dispTIncrVertexN.size() == 
+	     dispTIncrAdjSection->getFiberDimension(v_negative));
+      dispTIncrAdjSection->updateAddPoint(v_negative, &dispTIncrVertexN[0]);
+      
+      assert(dispTIncrVertexP.size() == 
+	     dispTIncrAdjSection->getFiberDimension(v_positive));
+      dispTIncrAdjSection->updateAddPoint(v_positive, &dispTIncrVertexP[0]);
+    } // if
 
-    assert(dispTIncrVertexP.size() == 
-	   dispTIncrAdjSection->getFiberDimension(v_positive));
-    dispTIncrAdjSection->updateAddPoint(v_positive, &dispTIncrVertexP[0]);
+    // The Lagrange multiplier and slip are NOT assembled across processors.
 
     // Set Lagrange multiplier value. Value from preliminary solve is
     // bogus due to artificial diagonal entry of 1.0.
@@ -1419,7 +1421,7 @@
   PetscLogFlops(numVertices * (1 + spaceDim) );
 
 #if 0 // DEBUGGING
-  tractions->view("TRACTIONS");
+  tractions->view("INITIAL TRACTIONS");
 #endif
 
 } // _getInitialTractions

Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/MeshBuilder.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/MeshBuilder.cc	2011-02-22 04:34:18 UTC (rev 17937)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/MeshBuilder.cc	2011-02-22 04:36:03 UTC (rev 17938)
@@ -84,9 +84,8 @@
   MPI_Comm_rank(comm, &rank);
   // Memory debugging
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
-  logger.setDebug(mesh->debug()/2);
+  //logger.setDebug(1);
 
-  logger.stagePush("Mesh");
   logger.stagePush("MeshCreation");
   if (0 == rank) {
     assert(coordinates->size() == numVertices*spaceDim);
@@ -173,6 +172,7 @@
     } // if/else
     logger.stagePop();
   } else {
+    logger.stagePop();
     logger.stagePush("MeshStratification");
     sieveMesh->getSieve()->setChart(SieveMesh::sieve_type::chart_type());
     sieveMesh->getSieve()->allocate();
@@ -183,10 +183,8 @@
   logger.stagePush("MeshCoordinates");
   ALE::SieveBuilder<SieveMesh>::buildCoordinates(sieveMesh, spaceDim, 
 						 &(*coordinates)[0]);
-  logger.stagePop(); // MeshCoordinates
+  logger.stagePop(); // Coordinates
 
-  logger.stagePop(); // Mesh
-
   sieveMesh->getFactory()->clear();
 } // buildMesh
 
@@ -219,7 +217,7 @@
 
   // Memory logging
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
-  logger.setDebug(fault->debug()/2);
+  //logger.setDebug(fault->debug()/2);
   logger.stagePush("FaultCreation");
 
   if (0 == rank) {

Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/MeshIO.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/MeshIO.cc	2011-02-22 04:34:18 UTC (rev 17937)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/meshio/MeshIO.cc	2011-02-22 04:36:03 UTC (rev 17938)
@@ -74,10 +74,16 @@
 { // read
   assert(0 == _mesh);
 
+  ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+  //logger.setDebug(1);
+  logger.stagePush("Mesh");
+
   _mesh = mesh;
   _mesh->debug(_debug);
   _read();
 
+  logger.stagePop();
+
   _mesh = 0;
 } // read
 
@@ -207,7 +213,7 @@
 
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
   ///logger.setDebug(2);
-  logger.stagePush("Materials");
+  logger.stagePush("MeshLabels");
   const ALE::Obj<SieveMesh::label_type>& labelMaterials = 
     sieveMesh->createLabel("material-id");
   if (!sieveMesh->commRank()) {
@@ -305,7 +311,7 @@
   } // if
 
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
-  logger.stagePush("VertexGroups");
+  logger.stagePush("MeshIntSections");
   const ALE::Obj<IntSection>& groupField = sieveMesh->getIntSection(name);
   assert(!groupField.isNull());
 

Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Distributor.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Distributor.cc	2011-02-22 04:34:18 UTC (rev 17937)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Distributor.cc	2011-02-22 04:36:03 UTC (rev 17938)
@@ -84,6 +84,7 @@
 	 << "', distribution mesh using dumb partitioner." << journal::endl;
     _distribute<ALE::DistributionNew<SieveMesh> >(newMesh, origMesh);
   } // else
+
 } // distribute
 
 // ----------------------------------------------------------------------
@@ -112,6 +113,7 @@
   const ALE::Obj<SieveMesh> sieveMesh = mesh.sieveMesh();
   assert(!sieveMesh.isNull());
   double rankReal = double(sieveMesh->commRank());
+  assert(sieveMesh->height() > 0);
   const ALE::Obj<SieveMesh::label_sequence>& cells = 
     sieveMesh->heightStratum(0);
   assert(!cells.isNull());
@@ -143,6 +145,11 @@
   typedef typename DistributionType::partitioner_type partitioner_type;
   typedef typename DistributionType::partition_type   partition_type;
 
+  ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+  //logger.setDebug(1);
+  logger.stagePush("DistributedMesh");
+  logger.stagePush("DistributedMeshCreation");
+
   journal::info_t info("distributor");
     
   info << journal::at(__HERE__)
@@ -214,6 +221,9 @@
     throw ALE::Exception("Invalid Overlap");
   } // if
 
+  logger.stagePop();
+  logger.stagePush("DistributedMeshCoordinates");
+
   // Distribute the coordinates
   info << journal::at(__HERE__)
        << "Distribution the vertex coordinates." << journal::endl;
@@ -230,6 +240,9 @@
 				      sendMeshOverlap, recvMeshOverlap, 
 				      parallelCoordinates);
 
+  logger.stagePop();
+  logger.stagePush("DistributedMeshRealSections");
+
   // Distribute other sections
   info << journal::at(__HERE__)
        << "Distribution other sections." << journal::endl;
@@ -253,6 +266,10 @@
     if (n)
       throw std::logic_error("Need to distribute more real sections");
   }
+
+  logger.stagePop();
+  logger.stagePush("DistributedMeshIntSections");
+
   if (origSieveMesh->getIntSections()->size() > 0) {
     ALE::Obj<std::set<std::string> > names = origSieveMesh->getIntSections();
     assert(!names.isNull());
@@ -287,6 +304,9 @@
   if (origSieveMesh->getArrowSections()->size() > 1)
     throw std::logic_error("Need to distribute more arrow sections");
   
+  logger.stagePop();
+  logger.stagePush("DistributedMeshLabels");
+
   // Distribute labels
   info << journal::at(__HERE__)
        << "Distributing labels." << journal::endl;
@@ -330,6 +350,9 @@
 #endif
   } // for
 
+  logger.stagePop();
+  logger.stagePush("DistributedMeshOverlap");
+
   // Create the parallel overlap
   info << journal::at(__HERE__)
        << "Creating the parallel overlap." << journal::endl;
@@ -347,6 +370,10 @@
 					  sendParallelMeshOverlap, 
 					  recvParallelMeshOverlap);
   newSieveMesh->setCalculatedOverlap(true);
+
+  logger.stagePop();
+  logger.stagePop(); // Mesh
+  //logger.setDebug(0);
 } // distribute
 
 

Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Mesh.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Mesh.cc	2011-02-22 04:34:18 UTC (rev 17937)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Mesh.cc	2011-02-22 04:36:03 UTC (rev 17938)
@@ -65,6 +65,7 @@
 pylith::topology::Mesh::deallocate(void)
 { // deallocate
   delete _coordsys; _coordsys = 0;
+  _mesh.destroy();
 } // deallocate
   
 // ----------------------------------------------------------------------

Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Mesh.icc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Mesh.icc	2011-02-22 04:34:18 UTC (rev 17937)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/Mesh.icc	2011-02-22 04:36:03 UTC (rev 17938)
@@ -68,21 +68,23 @@
 inline
 int
 pylith::topology::Mesh::coneSize(void) const {
-  return (!_mesh.isNull()) ? _mesh->getSieve()->getConeSize(*_mesh->heightStratum(0)->begin()) : 0;
+  
+  return (!_mesh.isNull() && numCells() > 0) ? 
+    _mesh->getSieve()->getConeSize(*_mesh->heightStratum(0)->begin()) : 0;
 }
 
 // Get number of vertices in mesh.
 inline
 int
 pylith::topology::Mesh::numVertices(void) const {
-  return (!_mesh.isNull()) ? _mesh->depthStratum(0)->size() : 0;
+  return (!_mesh.isNull() && _mesh->depth() > 0) ? _mesh->depthStratum(0)->size() : 0;
 }
 
 // Get number of cells in mesh.
 inline
 int
 pylith::topology::Mesh::numCells(void) const {
-  return (!_mesh.isNull()) ? _mesh->heightStratum(0)->size() : 0;
+  return (!_mesh.isNull() && _mesh->height() > 0) ? _mesh->heightStratum(0)->size() : 0;
 }
 
 // Set MPI communicator associated with mesh.

Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/MeshRefiner.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/MeshRefiner.cc	2011-02-22 04:34:18 UTC (rev 17937)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/MeshRefiner.cc	2011-02-22 04:36:03 UTC (rev 17938)
@@ -71,6 +71,11 @@
   assert(_orderOldMesh);
   assert(_orderNewMesh);
 
+  ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+  //logger.setDebug(1);
+  logger.stagePush("RefinedMesh");
+  logger.stagePush("RefinedMeshCreation");
+
   // Calculate order in old mesh.
   _orderOldMesh->initialize(mesh);
 
@@ -158,6 +163,11 @@
   } // for
   newSieve->symmetrize();
 
+
+  logger.stagePop();
+  //logger.setDebug(0);
+  logger.stagePush("RefinedMeshCoordinates");
+
   // Set coordinates in refined mesh.
   const Obj<mesh_type::real_section_type>& coordinates = mesh->getRealSection("coordinates");
   assert(!coordinates.isNull());
@@ -184,10 +194,28 @@
 
   refiner.setCoordsNewVertices(newCoordinates, coordinates);
 
+  logger.stagePop();
+  logger.stagePush("RefinedMeshStratification");
+
   _stratify(newMesh);
+
+  logger.stagePop();
+  logger.stagePush("RefinedMeshOverlap");
+
   _calcNewOverlap(newMesh, mesh, refiner);
+
+  logger.stagePop();
+  logger.stagePush("RefinedMeshIntSections");
+
   _createIntSections(newMesh, mesh, refiner);
+
+  logger.stagePop();
+  logger.stagePush("RefinedMeshLabels");
+
   _createLabels(newMesh, mesh, refiner);
+
+  logger.stagePop();
+  logger.stagePop(); // Mesh
 } // _refine
   
 // ----------------------------------------------------------------------

Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/ReverseCuthillMcKee.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/ReverseCuthillMcKee.cc	2011-02-22 04:34:18 UTC (rev 17937)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/ReverseCuthillMcKee.cc	2011-02-22 04:36:03 UTC (rev 17938)
@@ -35,7 +35,9 @@
 { // reorder
   assert(0 != mesh);
 
-  //logger.stagePush("MeshReordering");
+  ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+  //logger.setDebug(1);
+  logger.stagePush("MeshReordering");
 
   int rank = 0;
   MPI_Comm_rank(mesh->comm(), &rank);
@@ -58,7 +60,7 @@
     //sieveMesh->view("MESH AFTER RELABEL");
   } // if    
 
-  //logger.stagePop();
+  logger.stagePop();
 } // reorder
 
 

Modified: short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/SubMesh.cc
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/SubMesh.cc	2011-02-22 04:34:18 UTC (rev 17937)
+++ short/3D/PyLith/branches/pylith-scecdynrup/libsrc/topology/SubMesh.cc	2011-02-22 04:36:03 UTC (rev 17938)
@@ -60,6 +60,7 @@
 pylith::topology::SubMesh::deallocate(void)
 { // deallocate
   delete _coordsys; _coordsys = 0;
+  _mesh.destroy();
 } // deallocate
   
 // ----------------------------------------------------------------------

Modified: short/3D/PyLith/branches/pylith-scecdynrup/playpen/postproc/stressinfo.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/playpen/postproc/stressinfo.py	2011-02-22 04:34:18 UTC (rev 17937)
+++ short/3D/PyLith/branches/pylith-scecdynrup/playpen/postproc/stressinfo.py	2011-02-22 04:36:03 UTC (rev 17938)
@@ -105,8 +105,8 @@
 
 
   def main(self):
-    import pdb
-    pdb.set_trace()
+    # import pdb
+    # pdb.set_trace()
     self._readVtkFile()
     self._getStressInfo()
     self._writeVtkFile()
@@ -199,13 +199,13 @@
     for point in xrange(self.numTensorPoints):
       tensor = self.tensorSorted[point, :]
       pressure, devInvariant2 = self._compStressInfo(tensor)
-      self.pressure[point,:] = pressure
-      self.devInvariant2[point,:] = devInvariant2
+      self.pressure[point] = pressure
+      self.devInvariant2[point] = devInvariant2
       dpPlasPresTerm = self.alphaYield * 3.0 * pressure
-      self.dpPlasPresTerm[point,:] = dpPlasPresTerm
+      self.dpPlasPresTerm[point] = dpPlasPresTerm
       dpPlasStressTerm = dpPlasPresTerm + devInvariant2
-      self.dpPlasStressTerm[point,:] = dpPlasStressTerm
-      self.dpPlasYieldFunc[point,:] = dpPlasStressTerm - self.cohesion
+      self.dpPlasStressTerm[point] = dpPlasStressTerm
+      self.dpPlasYieldFunc[point] = dpPlasStressTerm - self.beta
 
     return
   
@@ -255,8 +255,7 @@
     mesh.update()
 
     # Write VTK file
-    w = tvtk.UnstructuredGridWriter(file_name=self.vtkOutputFile,
-		    input=mesh)
+    w = tvtk.XMLDataSetWriter(file_name=self.vtkOutputFile, input=mesh)
     w.write()
 
     return

Modified: short/3D/PyLith/branches/pylith-scecdynrup/pylith/apps/PetscApplication.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/pylith/apps/PetscApplication.py	2011-02-22 04:34:18 UTC (rev 17937)
+++ short/3D/PyLith/branches/pylith-scecdynrup/pylith/apps/PetscApplication.py	2011-02-22 04:36:03 UTC (rev 17938)
@@ -76,9 +76,10 @@
 
     except Exception, err:
       self.cleanup() # Attempt to clean up memory.
-      print "Fatal error while running PyLith:"
-      print err
-      print "Calling MPI_Abort() to abort PyLith application."
+      print "Fatal error. Calling MPI_Abort() to abort PyLith application."
+      # Print stacktrace
+      from traceback import print_exc
+      print_exc()
       from pylith.mpi import mpi
       errorCode = -1
       mpi.mpi_abort(mpi.petsc_comm_world(), errorCode)

Modified: short/3D/PyLith/branches/pylith-scecdynrup/pylith/perf/MemoryLogger.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/pylith/perf/MemoryLogger.py	2011-02-22 04:34:18 UTC (rev 17937)
+++ short/3D/PyLith/branches/pylith-scecdynrup/pylith/perf/MemoryLogger.py	2011-02-22 04:36:03 UTC (rev 17938)
@@ -75,7 +75,7 @@
                                       mesh.numVertices(), mesh.numCells())
     meshModel.tabulate(self.memory[stage])
     for group, nvertices in mesh.groupSizes():
-      self.logVertexGroup('VertexGroups', group, nvertices, mesh.numVertices())
+      self.logVertexGroup(stage, group, nvertices, mesh.numVertices())
     return
 
 
@@ -85,10 +85,13 @@
     """
     import pylith.perf.VertexGroup
 
-    if not stage in self.memory: self.memory[stage] = {}
+    if not stage in self.memory:
+      self.memory[stage] = {}
+    if not 'IntSections' in self.memory[stage]:
+      self.memory[stage]['IntSections'] = {}
     groupModel = pylith.perf.VertexGroup.VertexGroup(label, nvertices, 
                                                      nMeshVertices)
-    groupModel.tabulate(self.memory[stage])
+    groupModel.tabulate(self.memory[stage]['IntSections'])
     return
 
 
@@ -98,10 +101,13 @@
     """
     import pylith.perf.Material
 
-    if not stage in self.memory: self.memory[stage] = {}
+    if not stage in self.memory:
+      self.memory[stage] = {}
+    if not 'Labels' in self.memory[stage]:
+      self.memory[stage]['Labels'] = {}
     materialModel = pylith.perf.Material.Material(material.label(), 
                                                   material.ncells)
-    materialModel.tabulate(self.memory[stage])
+    materialModel.tabulate(self.memory[stage]['Labels'])
     return
 
 

Modified: short/3D/PyLith/branches/pylith-scecdynrup/pylith/perf/Mesh.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/pylith/perf/Mesh.py	2011-02-22 04:34:18 UTC (rev 17937)
+++ short/3D/PyLith/branches/pylith-scecdynrup/pylith/perf/Mesh.py	2011-02-22 04:36:03 UTC (rev 17938)
@@ -61,7 +61,8 @@
     Initialize application.
     """
     try:
-      self.cellType = self.cellTypes[(self.dimension,self.coneSize)]
+      if self.coneSize > 0:
+        self.cellType = self.cellTypes[(self.dimension,self.coneSize)]
     except:
       raise ValueError("Unknown cell type '%s' for dim %d and cone size %d." % (self.cellType,self.dimension,self.coneSize))
     return
@@ -74,7 +75,11 @@
     memDict['Stratification'] = 2 * self.sizeArrow * (self.nvertices + self.ncells)
     # Here we have data + atlas (could use uniform) + bc (could use Section)
     memDict['Coordinates']    = (self.sizeDouble * self.dimension * self.nvertices) + (2 * self.sizeInt * self.nvertices) + (2 * self.sizeInt * self.nvertices)
+    memDict['Overlap'] = 0 # Don't know overlap
+    memDict['RealSections'] = 0 # Real sections should be elsewhere
     return
 
 if __name__ == '__main__':
-  print 'Memory:',Mesh(2, 3, 10, 25).tabulate()
+  d = {}
+  Mesh(2, 3, 10, 25).tabulate(d)
+  print 'Memory:',d

Modified: short/3D/PyLith/branches/pylith-scecdynrup/pylith/perf/VertexGroup.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/pylith/perf/VertexGroup.py	2011-02-22 04:34:18 UTC (rev 17937)
+++ short/3D/PyLith/branches/pylith-scecdynrup/pylith/perf/VertexGroup.py	2011-02-22 04:36:03 UTC (rev 17938)
@@ -46,7 +46,9 @@
     return
 
 if __name__ == '__main__':
-  print 'Memory:',VertexGroup('rock', 35).tabulate()
+  d = {}
+  VertexGroup('rock', 35).tabulate(d)
+  print 'Memory:',d
 
 
 # End of file

Modified: short/3D/PyLith/branches/pylith-scecdynrup/pylith/topology/MeshImporter.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/pylith/topology/MeshImporter.py	2011-02-22 04:34:18 UTC (rev 17937)
+++ short/3D/PyLith/branches/pylith-scecdynrup/pylith/topology/MeshImporter.py	2011-02-22 04:36:03 UTC (rev 17938)
@@ -116,8 +116,7 @@
     self._adjustTopology(mesh, faults)
 
     # Distribute mesh
-    import mpi
-    if mpi.MPI_Comm_size(mpi.MPI_COMM_WORLD) > 1:
+    if mesh.getComm().size > 1:
       self._info.log("Distributing mesh.")
       mesh = self.distributor.distribute(mesh, normalizer)
       if self.debug:

Modified: short/3D/PyLith/branches/pylith-scecdynrup/pylith/topology/RefineUniform.py
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/pylith/topology/RefineUniform.py	2011-02-22 04:34:18 UTC (rev 17937)
+++ short/3D/PyLith/branches/pylith-scecdynrup/pylith/topology/RefineUniform.py	2011-02-22 04:36:03 UTC (rev 17938)
@@ -68,6 +68,9 @@
     newMesh.coordsys(mesh.coordsys())
     ModuleRefineUniform.refine(self, newMesh, mesh, self.levels)
 
+    if mesh != newMesh:
+      mesh.deallocate();
+
     self._eventLogger.eventEnd(logEvent)
     return newMesh
 

Modified: short/3D/PyLith/branches/pylith-scecdynrup/subpackage.am
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/subpackage.am	2011-02-22 04:34:18 UTC (rev 17937)
+++ short/3D/PyLith/branches/pylith-scecdynrup/subpackage.am	2011-02-22 04:36:03 UTC (rev 17938)
@@ -41,7 +41,5 @@
 
 INCLUDES = -I$(top_builddir)/include
 
-# version
-# $Id$
 
 # End of file 

Modified: short/3D/PyLith/branches/pylith-scecdynrup/tests/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-scecdynrup/tests/Makefile.am	2011-02-22 04:34:18 UTC (rev 17937)
+++ short/3D/PyLith/branches/pylith-scecdynrup/tests/Makefile.am	2011-02-22 04:36:03 UTC (rev 17938)
@@ -18,6 +18,7 @@
 
 SUBDIRS = \
 	2d \
-	3d
+	3d \
+	topology
 
 # End of file 

Copied: short/3D/PyLith/branches/pylith-scecdynrup/tests/topology (from rev 17937, short/3D/PyLith/trunk/tests/topology)



More information about the CIG-COMMITS mailing list