[cig-commits] r4534 - in short/3D/PyLith/trunk/playpen/meshio: src test

knepley at geodynamics.org knepley at geodynamics.org
Thu Sep 14 12:03:01 PDT 2006


Author: knepley
Date: 2006-09-14 12:03:00 -0700 (Thu, 14 Sep 2006)
New Revision: 4534

Modified:
   short/3D/PyLith/trunk/playpen/meshio/src/MeshIOAscii.cc
   short/3D/PyLith/trunk/playpen/meshio/src/testascii.cc
   short/3D/PyLith/trunk/playpen/meshio/test/tri2.mesh
   short/3D/PyLith/trunk/playpen/meshio/test/tri3.mesh
Log:
Mesh tests now working


Modified: short/3D/PyLith/trunk/playpen/meshio/src/MeshIOAscii.cc
===================================================================
--- short/3D/PyLith/trunk/playpen/meshio/src/MeshIOAscii.cc	2006-09-14 18:43:20 UTC (rev 4533)
+++ short/3D/PyLith/trunk/playpen/meshio/src/MeshIOAscii.cc	2006-09-14 19:03:00 UTC (rev 4534)
@@ -79,9 +79,9 @@
       std::string flag = "";
       filein >> flag;
       if (0 == strcasecmp(flag.c_str(), "true"))
-	useIndexZero(true);
+        useIndexZero(true);
       else
-	useIndexZero(false);
+        useIndexZero(false);
     } else if (0 == strcasecmp(token.c_str(), "vertices")) {
       filein.ignore(maxIgnore, '{');
       _readVertices(filein, &coordinates, &numVertices, &numDims);
@@ -314,11 +314,13 @@
 pylith::meshIO::MeshIOAscii::_writeCells(std::ostream& fileout,
 				  const Obj<Mesh>& mesh) const
 { // _writeCells
-  const Obj<topology_type>&       topology   = mesh->getTopologyNew();
-  const topology_type::patch_type patch      = 0;
-  const Obj<sieve_type>&          sieve      = topology->getPatch(patch);
+  const Obj<topology_type>&        topology   = mesh->getTopologyNew();
+  const topology_type::patch_type  patch      = 0;
+  const Obj<sieve_type>&           sieve      = topology->getPatch(patch);
   const Obj<Mesh::topology_type::label_sequence>& cells = topology->heightStratum(patch, 0);
-  const int                       numCorners = sieve->nCone(*cells->begin(), topology->depth())->size();
+  const Obj<Mesh::numbering_type>& vNumbering = mesh->getLocalNumbering(0);
+  const int                        numCorners = sieve->nCone(*cells->begin(), topology->depth())->size();
+  sieve->view("Sieve");
 
   fileout
     << "  cells = {\n"
@@ -332,7 +334,7 @@
     const Obj<sieve_type::traits::coneSequence>& cone = sieve->cone(*e_iter);
 
     for(sieve_type::traits::coneSequence::iterator c_iter = cone->begin(); c_iter != cone->end(); ++c_iter) {
-      fileout << std::setw(8) << *c_iter + offset;
+      fileout << std::setw(8) << vNumbering->getIndex(*c_iter) + offset;
     }
     fileout << "\n";
   } // for

Modified: short/3D/PyLith/trunk/playpen/meshio/src/testascii.cc
===================================================================
--- short/3D/PyLith/trunk/playpen/meshio/src/testascii.cc	2006-09-14 18:43:20 UTC (rev 4533)
+++ short/3D/PyLith/trunk/playpen/meshio/src/testascii.cc	2006-09-14 19:03:00 UTC (rev 4534)
@@ -23,21 +23,26 @@
   PetscErrorCode err;
 
   PetscInitialize(&argc, &argv, 0, 0);
-  
-  if (3 != argc) {
-    std::cerr << "usage: testascii MESHIN MESHOUT" << std::endl;
+
+  if (argc < 3) {
+    std::cerr << "usage: testascii MESHIN MESHOUT [options]" << std::endl;
     return -1;
   } // if
 
-  ALE::Obj<ALE::Mesh> mesh;
+  try {
+    ALE::Obj<ALE::Mesh> mesh;
 
-  pylith::meshIO::MeshIOAscii iohandler;
-  iohandler.filename(argv[1]);
-  iohandler.read(mesh);
+    pylith::meshIO::MeshIOAscii iohandler;
+    iohandler.filename(argv[1]);
+    iohandler.read(mesh);
 
-  iohandler.filename(argv[2]);
-  iohandler.write(mesh);
-
+    iohandler.filename(argv[2]);
+    iohandler.write(mesh);
+  } catch(ALE::Exception e) {
+    int rank;
+    MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
+    std::cout <<"["<<rank<<"]: " << e << std::endl;
+  }
   err = PetscFinalize(); CHKERRQ(err);
   
   return err;

Modified: short/3D/PyLith/trunk/playpen/meshio/test/tri2.mesh
===================================================================
--- short/3D/PyLith/trunk/playpen/meshio/test/tri2.mesh	2006-09-14 18:43:20 UTC (rev 4533)
+++ short/3D/PyLith/trunk/playpen/meshio/test/tri2.mesh	2006-09-14 19:03:00 UTC (rev 4534)
@@ -10,7 +10,7 @@
        0.0  1.0
     }
   }
-  elements = {
+  cells = {
     num-corners = 3
     count = 2
     simplices = {

Modified: short/3D/PyLith/trunk/playpen/meshio/test/tri3.mesh
===================================================================
--- short/3D/PyLith/trunk/playpen/meshio/test/tri3.mesh	2006-09-14 18:43:20 UTC (rev 4533)
+++ short/3D/PyLith/trunk/playpen/meshio/test/tri3.mesh	2006-09-14 19:03:00 UTC (rev 4534)
@@ -11,7 +11,7 @@
        0.0 -1.0
     }
   }
-  elements = {
+  cells = {
     num-corners = 3
     count = 3
     simplices = {



More information about the cig-commits mailing list