/[escript]/trunk/finley/test/python/testframe.py
ViewVC logotype

Contents of /trunk/finley/test/python/testframe.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1312 - (show annotations)
Mon Sep 24 06:18:44 2007 UTC (13 years ago) by ksteube
File MIME type: text/x-python
File size: 2558 byte(s)
The MPI branch is hereby closed. All future work should be in trunk.

Previously in revision 1295 I merged the latest changes to trunk into trunk-mpi-branch.
In this revision I copied all files from trunk-mpi-branch over the corresponding
trunk files. I did not use 'svn merge', it was a copy.

1 #
2 # $Id$
3 #
4 #######################################################
5 #
6 # Copyright 2003-2007 by ACceSS MNRF
7 # Copyright 2007 by University of Queensland
8 #
9 # http://esscc.uq.edu.au
10 # Primary Business: Queensland, Australia
11 # Licensed under the Open Software License version 3.0
12 # http://www.opensource.org/licenses/osl-3.0.php
13 #
14 #######################################################
15 #
16
17 """
18 frame to ran a single test out of the Test_util suite
19 """
20
21 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
22 http://www.access.edu.au
23 Primary Business: Queensland, Australia"""
24 __license__="""Licensed under the Open Software License version 3.0
25 http://www.opensource.org/licenses/osl-3.0.php"""
26 import unittest
27 from esys.escript import *
28 from esys.escript.linearPDEs import LinearPDE
29 from esys.finley import Rectangle, JoinFaces, Brick
30
31 import numarray
32 FINLEY_TEST_MESH_PATH="data_meshes/"
33
34 NE=6 # number of element in each spatial direction (must be even)
35
36 class Test_X(unittest.TestCase):
37 RES_TOL=1.e-7
38 ABS_TOL=1.e-8
39 def setUp(self):
40 self.order=1
41 d1 = Rectangle(n0=NE/2+1,n1=NE,l0=0.5,order=1)
42 d2 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=1)
43 d2.setX(d2.getX()+[0.5,0.])
44 self.domain = JoinFaces([d1,d2],optimize=False)
45 def tearDown(self):
46 del self.order
47 del self.domain
48 def test_integrate_onFunctionOnBoundary_fromData_ReducedContinuousFunction_rank0(self):
49 """
50 tests integral of rank 0 Data on the FunctionOnBoundary
51
52 assumptions: ReducedContinuousFunction(self.domain) exists
53 self.domain supports integral on FunctionOnBoundary
54 """
55 o=1
56 dim=self.domain.getDim()
57 w_ref=FunctionOnBoundary(self.domain)
58 w=ReducedContinuousFunction(self.domain)
59 x=w.getX()
60 arg=Data(0,(),w)
61 if dim==2:
62 arg=(-0.0177156089276)*x[0]+(-1.07750293477)*x[1]
63 ref=(0.674554765151)*(1+2.*(dim-1.)/(o+1.))+(-1.76977330884)*dim
64 else:
65 arg=(0.304688056778)*x[0]+(0.548485298428)*x[1]+(0.672370309114)*x[2]
66 ref=(0.0121419382123)*(1+2.*(dim-1.)/(o+1.))+(1.51340172611)*dim
67 res=integrate(arg,where=w_ref)
68 self.failUnless(isinstance(res,float),"wrong type of result.")
69 self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
70
71
72
73
74 if __name__ == '__main__':
75 suite = unittest.TestSuite()
76 suite.addTest(unittest.makeSuite(Test_X))
77 s=unittest.TextTestRunner(verbosity=2).run(suite)
78
79

  ViewVC Help
Powered by ViewVC 1.1.26