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

Contents of /trunk-mpi-branch/finley/test/python/testframe.py

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.26