/[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 3891 by jfenwick, Fri Aug 19 03:53:41 2011 UTC revision 3892 by jfenwick, Tue Apr 10 08:57:23 2012 UTC
# Line 80  class InputOutput(unittest.TestCase): Line 80  class InputOutput(unittest.TestCase):
80    
81       # Does optimize=True change Rectangle for order=1?       # Does optimize=True change Rectangle for order=1?
82       def test_Rectangle_optimize_order1(self):       def test_Rectangle_optimize_order1(self):
83      mydomain1 = Rectangle(n0=NE0, n1=NE1, order=1, l0=1., l1=1., optimize=False)          mydomain1 = Rectangle(n0=NE0, n1=NE1, order=1, l0=1., l1=1., optimize=False)
84      mydomain2 = Rectangle(n0=NE0, n1=NE1, order=1, l0=1., l1=1., optimize=True)          mydomain2 = Rectangle(n0=NE0, n1=NE1, order=1, l0=1., l1=1., optimize=True)
85          self.domainsEqual(mydomain1, mydomain2)          self.domainsEqual(mydomain1, mydomain2)
86    
87       # Does optimize=True change Rectangle for order=2?       # Does optimize=True change Rectangle for order=2?
88       #def test_Rectangle_optimize_order2(self):       #def test_Rectangle_optimize_order2(self):
89      #mydomain1 = Rectangle(n0=NE0, n1=NE1, order=2, l0=1., l1=1., optimize=False)          #mydomain1 = Rectangle(n0=NE0, n1=NE1, order=2, l0=1., l1=1., optimize=False)
90      #mydomain2 = Rectangle(n0=NE0, n1=NE1, order=2, l0=1., l1=1., optimize=True)          #mydomain2 = Rectangle(n0=NE0, n1=NE1, order=2, l0=1., l1=1., optimize=True)
91          #self.domainsEqual(mydomain1, mydomain2)          #self.domainsEqual(mydomain1, mydomain2)
92    
93       # Does optimize=True change Rectangle for order=-1?       # Does optimize=True change Rectangle for order=-1?
94       def test_Rectangle_optimize_macro(self):       def test_Rectangle_optimize_macro(self):
95      mydomain1 = Rectangle(n0=NE0, n1=NE1, order=-1, l0=1., l1=1., optimize=False)          mydomain1 = Rectangle(n0=NE0, n1=NE1, order=-1, l0=1., l1=1., optimize=False)
96      mydomain2 = Rectangle(n0=NE0, n1=NE1, order=-1, l0=1., l1=1., optimize=True)          mydomain2 = Rectangle(n0=NE0, n1=NE1, order=-1, l0=1., l1=1., optimize=True)
97          self.domainsEqual(mydomain1, mydomain2)          self.domainsEqual(mydomain1, mydomain2)
98    
99       # Does optimize=True change Brick for order=1?       # Does optimize=True change Brick for order=1?
100       def test_Brick_optimize_order1(self):       def test_Brick_optimize_order1(self):
101      mydomain1 = Brick(n0=NE0, n1=NE1, n2=NE2, order=1, l0=1., l1=1., l2=1., optimize=False)          mydomain1 = Brick(n0=NE0, n1=NE1, n2=NE2, order=1, l0=1., l1=1., l2=1., optimize=False)
102      mydomain2 = Brick(n0=NE0, n1=NE1, n2=NE2, order=1, l0=1., l1=1., l2=1., optimize=True)          mydomain2 = Brick(n0=NE0, n1=NE1, n2=NE2, order=1, l0=1., l1=1., l2=1., optimize=True)
103          self.domainsEqual(mydomain1, mydomain2)          self.domainsEqual(mydomain1, mydomain2)
104    
105       # Does optimize=True change Brick for order=2?       # Does optimize=True change Brick for order=2?
106       #def test_Brick_optimize_order2(self):       #def test_Brick_optimize_order2(self):
107      #mydomain1 = Brick(n0=NE0, n1=NE1, n2=NE2, order=2, l0=1., l1=1., l2=1., optimize=False)          #mydomain1 = Brick(n0=NE0, n1=NE1, n2=NE2, order=2, l0=1., l1=1., l2=1., optimize=False)
108      #mydomain2 = Brick(n0=NE0, n1=NE1, n2=NE2, order=2, l0=1., l1=1., l2=1., optimize=True)          #mydomain2 = Brick(n0=NE0, n1=NE1, n2=NE2, order=2, l0=1., l1=1., l2=1., optimize=True)
109          #self.domainsEqual(mydomain1, mydomain2)          #self.domainsEqual(mydomain1, mydomain2)
110       # Does optimize=True change Brick for order=-1?       # Does optimize=True change Brick for order=-1?
111       def test_Brick_optimize_macro(self):       def test_Brick_optimize_macro(self):
112      mydomain1 = Brick(n0=NE0, n1=NE1, n2=NE2, order=-1, l0=1., l1=1., l2=1., optimize=False)          mydomain1 = Brick(n0=NE0, n1=NE1, n2=NE2, order=-1, l0=1., l1=1., l2=1., optimize=False)
113      mydomain2 = Brick(n0=NE0, n1=NE1, n2=NE2, order=-1, l0=1., l1=1., l2=1., optimize=True)          mydomain2 = Brick(n0=NE0, n1=NE1, n2=NE2, order=-1, l0=1., l1=1., l2=1., optimize=True)
114          self.domainsEqual(mydomain1, mydomain2)          self.domainsEqual(mydomain1, mydomain2)
115    
116       def test_data_dump_to_NetCDF_rectangle(self):       def test_data_dump_to_NetCDF_rectangle(self):
117      if loadIsConfigured():          if loadIsConfigured():
118        mydomain1 = Rectangle(n0=NE0, n1=NE1, order=1, l0=1., l1=1., optimize=False)            mydomain1 = Rectangle(n0=NE0, n1=NE1, order=1, l0=1., l1=1., optimize=False)
119        d1=Data(mydomain1.getMPIRank(), Function(mydomain1))            d1=Data(mydomain1.getMPIRank(), Function(mydomain1))
120        d1.expand()            d1.expand()
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.assertTrue(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():
128        mydomain1 = Brick(n0=NE0, n1=NE1, n2=NE2, order=1, l0=1., l1=1., l2=1., optimize=False)            mydomain1 = Brick(n0=NE0, n1=NE1, n2=NE2, order=1, l0=1., l1=1., l2=1., optimize=False)
129        d1=Data(mydomain1.getMPIRank(), Function(mydomain1))            d1=Data(mydomain1.getMPIRank(), Function(mydomain1))
130        d1.expand()            d1.expand()
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.assertTrue(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():
138        mydomain1 = Rectangle(n0=NE0, n1=NE1, order=1, l0=1., l1=1., optimize=False)            mydomain1 = Rectangle(n0=NE0, n1=NE1, order=1, l0=1., l1=1., optimize=False)
139        dumpfile=os.path.join(DUDLEY_WORKDIR, "tempfile.mesh.nc")            dumpfile=os.path.join(DUDLEY_WORKDIR, "tempfile.mesh.nc")
140        mydomain1.dump(dumpfile)            mydomain1.dump(dumpfile)
141        mydomain2=LoadMesh(dumpfile)            mydomain2=LoadMesh(dumpfile)
142            self.domainsEqual(mydomain1, mydomain2)            self.domainsEqual(mydomain1, mydomain2)
143    
144       def test_mesh_dump_to_NetCDF_brick(self):       def test_mesh_dump_to_NetCDF_brick(self):
145      if loadIsConfigured():          if loadIsConfigured():
146        mydomain1 = Brick(n0=NE0, n1=NE1, n2=NE2, order=1, l0=1., l1=1., l2=1., optimize=False)            mydomain1 = Brick(n0=NE0, n1=NE1, n2=NE2, order=1, l0=1., l1=1., l2=1., optimize=False)
147        dumpfile=os.path.join(DUDLEY_WORKDIR, "tempfile.mesh.nc")            dumpfile=os.path.join(DUDLEY_WORKDIR, "tempfile.mesh.nc")
148        mydomain1.dump(dumpfile)            mydomain1.dump(dumpfile)
149        mydomain2=LoadMesh(dumpfile)            mydomain2=LoadMesh(dumpfile)
150            self.domainsEqual(mydomain1, mydomain2)            self.domainsEqual(mydomain1, mydomain2)
151    
152       def fixme_test_mesh_read_rectangle_from_dudley_file(self):       def fixme_test_mesh_read_rectangle_from_dudley_file(self):
153      if getMPISizeWorld() < 16:          if getMPISizeWorld() < 16:
154        mydomain1 = Rectangle(n0=8, n1=10, order=1, l0=1., l1=1., optimize=False)            mydomain1 = Rectangle(n0=8, n1=10, order=1, l0=1., l1=1., optimize=False)
155            mydomain2 = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"rectangle_8x10.fly"))            mydomain2 = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"rectangle_8x10.fly"))
156            self.domainsEqual(mydomain1, mydomain2)            self.domainsEqual(mydomain1, mydomain2)
157    
158       def fixme_test_mesh_read_brick_from_dudley_file(self):       def fixme_test_mesh_read_brick_from_dudley_file(self):
159      if getMPISizeWorld() < 16:          if getMPISizeWorld() < 16:
160            mydomain1 = Brick(n0=8, n1=10, n2=12, order=1, l0=1., l1=1., l2=1., optimize=False)            mydomain1 = Brick(n0=8, n1=10, n2=12, order=1, l0=1., l1=1., l2=1., optimize=False)
161            mydomain2 = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"brick_8x10x12.fly"))            mydomain2 = ReadMesh(os.path.join(DUDLEY_TEST_MESH_PATH,"brick_8x10x12.fly"))
162            self.domainsEqual(mydomain1, mydomain2)            self.domainsEqual(mydomain1, mydomain2)

Legend:
Removed from v.3891  
changed lines
  Added in v.3892

  ViewVC Help
Powered by ViewVC 1.1.26