[cig-commits] r6561 - short/3D/PyLith/trunk/unittests/libtests/meshio

brad at geodynamics.org brad at geodynamics.org
Thu Apr 12 21:56:17 PDT 2007


Author: brad
Date: 2007-04-12 21:56:16 -0700 (Thu, 12 Apr 2007)
New Revision: 6561

Modified:
   short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIO.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIO.hh
   short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIOAscii.cc
Log:
Fixed meshio tests (but still need to add checks for groups of vertices and cells.

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIO.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIO.cc	2007-04-13 01:19:44 UTC (rev 6560)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIO.cc	2007-04-13 04:56:16 UTC (rev 6561)
@@ -15,6 +15,8 @@
 #include "TestMeshIO.hh" // Implementation of class methods
 
 #include "pylith/meshio/MeshIO.hh" // USES MeshIO
+#include "pylith/utils/sievetypes.hh" // USES PETSc Mesh
+#include "pylith/utils/array.hh" // USES int_array
 
 #include "data/MeshData.hh"
 
@@ -23,10 +25,6 @@
 ALE::Obj<ALE::Mesh>*
 pylith::meshio::TestMeshIO::createMesh(const MeshData& data)
 { // createMesh
-  typedef ALE::Mesh Mesh;
-  typedef Mesh::sieve_type sieve_type;
-  typedef Mesh::label_type label_type;
-
   // buildTopology() requires zero based index
   CPPUNIT_ASSERT(true == data.useIndexZero);
 
@@ -58,7 +56,8 @@
 
   const ALE::Obj<Mesh::label_sequence>& cellsMesh = mesh->heightStratum(0);
 
-  const ALE::Obj<label_type>& labelMaterials = mesh->createLabel("material-id");
+  const ALE::Obj<Mesh::label_type>& labelMaterials = 
+    mesh->createLabel("material-id");
   
   int i = 0;
   for(Mesh::label_sequence::iterator e_iter = 
@@ -76,8 +75,6 @@
 pylith::meshio::TestMeshIO::checkVals(const ALE::Obj<Mesh>& mesh,
 				      const MeshData& data)
 { // checkVals
-  typedef ALE::Mesh::label_type label_type;
-
   // Check mesh dimension
   CPPUNIT_ASSERT_EQUAL(data.cellDim, mesh->getDimension());
 
@@ -136,12 +133,12 @@
   } // for
 
   // check materials
-  const int size = numCells;
-  int* materialIds = (size > 0) ? new int[size] : 0;
-  const ALE::Obj<label_type>& labelMaterials = 
+  const ALE::Obj<Mesh::label_type>& labelMaterials = 
     mesh->getLabel("material-id");
   const int idDefault = -999;
 
+  const int size = numCells;
+  int_array materialIds(size);
   i = 0;
   for(Mesh::label_sequence::iterator e_iter = cells->begin();
       e_iter != cells->end();
@@ -150,7 +147,6 @@
   
   for (int iCell=0; iCell < numCells; ++iCell)
     CPPUNIT_ASSERT_EQUAL(data.materialIds[iCell], materialIds[iCell]);
-  delete[] materialIds; materialIds = 0;
 
   // :TODO: Check groups of vertices
 } // checkVals

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIO.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIO.hh	2007-04-13 01:19:44 UTC (rev 6560)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIO.hh	2007-04-13 04:56:16 UTC (rev 6561)
@@ -23,7 +23,7 @@
 
 #include <cppunit/extensions/HelperMacros.h>
 
-#include <petscmesh.h>
+#include "pylith/utils/sievefwd.hh" // USES PETSc Mesh
 
 /// Namespace for pylith package
 namespace pylith {
@@ -38,12 +38,7 @@
 /// C++ unit testing for TestMeshIO
 class pylith::meshio::TestMeshIO : public CppUnit::TestFixture
 { // class TestMeshIO
-  // PUBLIC TYPEDEFS ////////////////////////////////////////////////////
-public :
 
-  typedef ALE::Mesh Mesh;
-  typedef Mesh::sieve_type sieve_type;
-
   // PUBLIC METHODS /////////////////////////////////////////////////////
 public :
 
@@ -53,14 +48,14 @@
    *
    * @returns PETSc mesh
    */
-  ALE::Obj<Mesh>* createMesh(const MeshData& data);
+  ALE::Obj<ALE::Mesh>* createMesh(const MeshData& data);
 
   /** Check values in mesh against data.
    *
    * @param mesh PETSc mesh
    * @param data Mesh data
    */
-  void checkVals(const ALE::Obj<Mesh>& mesh,
+  void checkVals(const ALE::Obj<ALE::Mesh>& mesh,
 		 const MeshData& data);
 
   // PROTECTED METHODS //////////////////////////////////////////////////

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIOAscii.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIOAscii.cc	2007-04-13 01:19:44 UTC (rev 6560)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIOAscii.cc	2007-04-13 04:56:16 UTC (rev 6561)
@@ -16,6 +16,8 @@
 
 #include "pylith/meshio/MeshIOAscii.hh"
 
+#include "pylith/utils/sievetypes.hh" // USES PETSc Mesh
+
 #include "data/MeshData1D.hh"
 #include "data/MeshData1Din2D.hh"
 #include "data/MeshData1Din3D.hh"



More information about the cig-commits mailing list