/[escript]/trunk/speckley/test/python/run_specialOnSpeckley.py
ViewVC logotype

Diff of /trunk/speckley/test/python/run_specialOnSpeckley.py

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

revision 5477 by jfenwick, Fri Feb 6 05:31:37 2015 UTC revision 5478 by sshaw, Wed Feb 18 01:57:49 2015 UTC
# Line 234  class Test_Speckley_Assemblers(unittest. Line 234  class Test_Speckley_Assemblers(unittest.
234                          res, self.TOLERANCE)).format("" if expanded else "un-"))                          res, self.TOLERANCE)).format("" if expanded else "un-"))
235    
236  class Test_Speckley(unittest.TestCase):  class Test_Speckley(unittest.TestCase):
237        TOLERANCE = 1e-10
238        def test_Rectangle_ReducedFunction(self):
239            ranks = getMPISizeWorld()
240            for order in range(2, 11):
241                dom = Rectangle(order, 3, 3*ranks, l0=3, l1=3*ranks, d1=ranks)
242                X = dom.getX()
243                redData = interpolate(X, ReducedFunction(dom))
244                data = [(interpolate(redData, ReducedFunction(dom)), "ReducedFunction"),
245                        (interpolate(redData, Function(dom)), "Function"),
246                        (interpolate(redData, ContinuousFunction(dom)), "ContinuousFunction")]
247                for d, fs in data:
248                    self.assertLess(inf(d-[0.5]*2), self.TOLERANCE,
249                            "reduced->%s failure with order %d: %g != 0"%(fs, order, inf(d-[0.5]*2)))
250                    self.assertLess(sup(d[0]+0.5) - 3, self.TOLERANCE,
251                            "reduced->%s failure with order %d: %g != 3"%(fs, order, sup(d[0]+0.5)))
252                    self.assertLess(sup(d[1]+0.5) - 3*ranks, self.TOLERANCE,
253                            "reduced->%s failure with order %d: %g != %g"%(fs, order, sup(d[1]+0.5), 3*ranks))
254    
255        def test_Brick_ReducedFunction(self):
256            ranks = getMPISizeWorld()
257            for order in range(2, 11):
258                dom = Brick(order, 3, 3*ranks, 3, l0=3, l1=3*ranks, l2=3, d1=ranks)
259                X = dom.getX()
260                redData = interpolate(X, ReducedFunction(dom))
261                data = [(interpolate(redData, ReducedFunction(dom)), "ReducedFunction"),
262                        (interpolate(redData, Function(dom)), "Function"),
263                        (interpolate(redData, ContinuousFunction(dom)), "ContinuousFunction")]
264                for d, fs in data:
265                    self.assertLess(inf(d-[0.5]*3), self.TOLERANCE,
266                            "reduced->%s failure with order %d: %g != 0"%(fs, order, inf(d-[0.5]*3)))
267                    self.assertLess(sup(d[0]+0.5) - 3, self.TOLERANCE,
268                            "reduced->%s failure with order %d: %g != 3"%(fs, order, sup(d[0]+0.5)))
269                    self.assertLess(sup(d[1]+0.5) - 3*ranks, self.TOLERANCE,
270                            "reduced->%s failure with order %d: %g != %g"%(fs, order, sup(d[1]+0.5), 3*ranks))
271                    self.assertLess(sup(d[2]+0.5) - 3, self.TOLERANCE,
272                            "reduced->%s failure with order %d: %g != 3"%(fs, order, sup(d[2]+0.5)))
273    
274      def test_Rectangle_Function_gradient(self): #expanded and non-expanded      def test_Rectangle_Function_gradient(self): #expanded and non-expanded
275          ranks = getMPISizeWorld()          ranks = getMPISizeWorld()
276          for expanded in [True, False]:          for expanded in [True, False]:

Legend:
Removed from v.5477  
changed lines
  Added in v.5478

  ViewVC Help
Powered by ViewVC 1.1.26