[cig-commits] r13954 - in short/3D/PyLith/branches/pylith-swig/unittests/pytests: meshio topology
brad at geodynamics.org
brad at geodynamics.org
Sun Jan 25 15:10:51 PST 2009
Author: brad
Date: 2009-01-25 15:10:51 -0800 (Sun, 25 Jan 2009)
New Revision: 13954
Modified:
short/3D/PyLith/branches/pylith-swig/unittests/pytests/meshio/TestMeshIOAscii.py
short/3D/PyLith/branches/pylith-swig/unittests/pytests/meshio/TestMeshIOCubit.py
short/3D/PyLith/branches/pylith-swig/unittests/pytests/meshio/TestMeshIOLagrit.py
short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestMesh.py
Log:
Improved Mesh object- added communicator and debug flag as members; added createSieveMesh().
Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/meshio/TestMeshIOAscii.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/meshio/TestMeshIOAscii.py 2009-01-25 23:10:39 UTC (rev 13953)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/meshio/TestMeshIOAscii.py 2009-01-25 23:10:51 UTC (rev 13954)
@@ -50,7 +50,6 @@
"""
filenameIn = "data/mesh2Din3D.txt"
filenameOut = "data/mesh2Din3D_test.txt"
- dim = 2
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
@@ -64,8 +63,7 @@
from spatialdata.units.Nondimensional import Nondimensional
normalizer = Nondimensional()
- mesh = io.read(dim, normalizer, debug=False, interpolate=False)
- self.assertEqual(2, mesh.dimension())
+ mesh = io.read(normalizer, debug=False, interpolate=False)
io.filename(filenameOut)
io.write(mesh)
Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/meshio/TestMeshIOCubit.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/meshio/TestMeshIOCubit.py 2009-01-25 23:10:39 UTC (rev 13953)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/meshio/TestMeshIOCubit.py 2009-01-25 23:10:51 UTC (rev 13954)
@@ -52,7 +52,6 @@
filenameIn = "data/twohex8.exo"
filenameOut = "data/twohex8_test.txt"
filenameE = "data/twohex8.txt"
- dim = 3
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
@@ -66,8 +65,7 @@
from spatialdata.units.Nondimensional import Nondimensional
normalizer = Nondimensional()
- mesh = io.read(dim, normalizer, debug=False, interpolate=False)
- self.assertEqual(3, mesh.dimension())
+ mesh = io.read(normalizer, debug=False, interpolate=False)
testhandler = MeshIOAscii()
testhandler.filename(filenameOut)
Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/meshio/TestMeshIOLagrit.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/meshio/TestMeshIOLagrit.py 2009-01-25 23:10:39 UTC (rev 13953)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/meshio/TestMeshIOLagrit.py 2009-01-25 23:10:51 UTC (rev 13954)
@@ -56,7 +56,6 @@
filenamePsetIn = "data/cube2_ascii.pset"
filenameOut = "data/cube2_test.txt"
filenameE = "data/cube2.txt"
- dim = 3
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
@@ -72,8 +71,7 @@
from spatialdata.units.Nondimensional import Nondimensional
normalizer = Nondimensional()
- mesh = io.read(dim, normalizer, debug=False, interpolate=False)
- self.assertEqual(3, mesh.dimension())
+ mesh = io.read(normalizer, debug=False, interpolate=False)
testhandler = MeshIOAscii()
testhandler.filename(filenameOut)
Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestMesh.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestMesh.py 2009-01-25 23:10:39 UTC (rev 13953)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/topology/TestMesh.py 2009-01-25 23:10:51 UTC (rev 13954)
@@ -29,6 +29,8 @@
Test constructor.
"""
mesh = Mesh()
+ self.assertEqual(0, mesh.dimension())
+ self.assertEqual(False, mesh.debug())
return
@@ -36,8 +38,10 @@
"""
Test constructor.
"""
- from pylith.mpi.Communicator import mpi_comm_self
- mesh = Mesh(comm=mpi_comm_self())
+ dim = 2
+ mesh = Mesh(dim=dim)
+ self.assertEqual(dim, mesh.dimension())
+ self.assertEqual(False, mesh.debug())
return
@@ -45,11 +49,29 @@
"""
Test constructor.
"""
+ dim = 2
from pylith.mpi.Communicator import mpi_comm_self
- mesh = Mesh(comm=mpi_comm_self(), dim=2)
+ mesh = Mesh(dim=dim, comm=mpi_comm_self())
+ self.assertEqual(dim, mesh.dimension())
+ self.assertEqual(False, mesh.debug())
return
+ def test_createSieveMesh(self):
+ """
+ Test createSeiveMesh().
+ """
+ mesh = Mesh()
+
+ mesh.createSieveMesh()
+ self.assertEqual(3, mesh.dimension())
+
+ dim = 2
+ mesh.createSieveMesh(dim)
+ self.assertEqual(dim, mesh.dimension())
+ return
+
+
def test_coordsys(self):
"""
Test coordsys().
@@ -83,9 +105,7 @@
Test debug().
"""
mesh = Mesh()
-
- dim = 3
- self.assertEqual(dim, mesh.dimension())
+ self.assertEqual(0, mesh.dimension())
return
@@ -93,9 +113,10 @@
"""
Test comm().
"""
- from pylith.mpi.Communicator import petsc_comm_world
- mesh = Mesh(comm=petsc_comm_world())
- comm = mesh.comm()
+ from pylith.mpi.Communicator import petsc_comm_self
+ mesh = Mesh()
+ mesh.setComm(petsc_comm_self())
+ comm = mesh.getComm()
self.assertEqual(0, comm.rank)
self.assertEqual(1, comm.size)
return
More information about the CIG-COMMITS
mailing list