/[escript]/trunk/dudley/test/python/run_inputOutput.py
ViewVC logotype

Diff of /trunk/dudley/test/python/run_inputOutput.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3349 by caltinay, Mon Nov 15 05:09:56 2010 UTC revision 3551 by jfenwick, Fri Aug 19 03:53:41 2011 UTC
# Line 60  class InputOutput(unittest.TestCase): Line 60  class InputOutput(unittest.TestCase):
60       # Check that two domains are equal using Fourier integrals       # Check that two domains are equal using Fourier integrals
61       # We cannot compare the X coordinates since they are on different domains       # We cannot compare the X coordinates since they are on different domains
62       def domainsEqual(self, m1, m2, nft=100):       def domainsEqual(self, m1, m2, nft=100):
63          self.failUnless(m1.getDim() == m2.getDim(), "Dimensions differ")          self.assertTrue(m1.getDim() == m2.getDim(), "Dimensions differ")
64          self.failUnless(m1.getNumDataPointsGlobal() == m2.getNumDataPointsGlobal(), "Num data points differ")          self.assertTrue(m1.getNumDataPointsGlobal() == m2.getNumDataPointsGlobal(), "Num data points differ")
65          for tagName in m1.showTagNames().split(", "):          for tagName in m1.showTagNames().split(", "):
66            self.failUnless(m2.isValidTagName(tagName), "m1 has a tag '%s' not present in m2" % tagName)            self.assertTrue(m2.isValidTagName(tagName), "m1 has a tag '%s' not present in m2" % tagName)
67          for tagName in m2.showTagNames().split(", "):          for tagName in m2.showTagNames().split(", "):
68            self.failUnless(m1.isValidTagName(tagName), "m2 has a tag '%s' not present in m1" % tagName)            self.assertTrue(m1.isValidTagName(tagName), "m2 has a tag '%s' not present in m1" % tagName)
69            self.failUnless(m1.getTag(tagName) == m2.getTag(tagName), "values of tag '%s' differ" % tagName)            self.assertTrue(m1.getTag(tagName) == m2.getTag(tagName), "values of tag '%s' differ" % tagName)
70          for fs in ["Solution", "ReducedSolution", "Function", "ReducedFunction", "ContinuousFunction", "ReducedContinuousFunction"]:          for fs in ["Solution", "ReducedSolution", "Function", "ReducedFunction", "ContinuousFunction", "ReducedContinuousFunction"]:
71            fs1 = eval("%s(m1)" % fs)            fs1 = eval("%s(m1)" % fs)
72            fs2 = eval("%s(m2)" % fs)            fs2 = eval("%s(m2)" % fs)
# Line 75  class InputOutput(unittest.TestCase): Line 75  class InputOutput(unittest.TestCase):
75            for n in range(1, nft+1):            for n in range(1, nft+1):
76              integ1 = integrate(sin(n*x1))              integ1 = integrate(sin(n*x1))
77              integ2 = integrate(sin(n*x2))              integ2 = integrate(sin(n*x2))
78              self.failUnless(Lsup(abs(integ1-integ2)) <= REL_TOL, "integrals for n=%d differ" % n)              self.assertTrue(Lsup(abs(integ1-integ2)) <= REL_TOL, "integrals for n=%d differ" % n)
79          return True          return True
80    
81       # Does optimize=True change Rectangle for order=1?       # Does optimize=True change Rectangle for order=1?
# Line 121  class InputOutput(unittest.TestCase): Line 121  class InputOutput(unittest.TestCase):
121        dumpfile=os.path.join(DUDLEY_WORKDIR, "tempfile.dump.nc")        dumpfile=os.path.join(DUDLEY_WORKDIR, "tempfile.dump.nc")
122        d1.dump(dumpfile)        d1.dump(dumpfile)
123        d2=load(dumpfile, mydomain1)        d2=load(dumpfile, mydomain1)
124            self.failUnless(Lsup(abs(d1-d2)) <= REL_TOL, "data objects differ")            self.assertTrue(Lsup(abs(d1-d2)) <= REL_TOL, "data objects differ")
125    
126       def test_data_dump_to_NetCDF_brick(self):       def test_data_dump_to_NetCDF_brick(self):
127      if loadIsConfigured():      if loadIsConfigured():
# Line 131  class InputOutput(unittest.TestCase): Line 131  class InputOutput(unittest.TestCase):
131        dumpfile=os.path.join(DUDLEY_WORKDIR, "tempfile.dump.nc")        dumpfile=os.path.join(DUDLEY_WORKDIR, "tempfile.dump.nc")
132        d1.dump(dumpfile)        d1.dump(dumpfile)
133        d2=load(dumpfile, mydomain1)        d2=load(dumpfile, mydomain1)
134            self.failUnless(Lsup(abs(d1-d2)) <= REL_TOL, "data objects differ")            self.assertTrue(Lsup(abs(d1-d2)) <= REL_TOL, "data objects differ")
135    
136       def test_mesh_dump_to_NetCDF_rectangle(self):       def test_mesh_dump_to_NetCDF_rectangle(self):
137      if loadIsConfigured():      if loadIsConfigured():

Legend:
Removed from v.3349  
changed lines
  Added in v.3551

  ViewVC Help
Powered by ViewVC 1.1.26