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

Revision 877 - (show annotations)
Wed Oct 25 03:06:58 2006 UTC (15 years, 8 months ago) by gross
File MIME type: text/x-python
File size: 1961 byte(s)
```backtraking in the saddlepoint problem (not perfect yet)
```
 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 8 Primary Business: Queensland, Australia""" 9 __license__="""Licensed under the Open Software License version 3.0 10 11 import unittest 12 from esys.escript import * 13 from esys.escript.linearPDEs import LinearPDE 14 from esys.finley import Rectangle, JoinFaces 15 import numarray 16 FINLEY_TEST_MESH_PATH="data_meshes/" 17 18 NE=6 # number of element in each spatial direction (must be even) 19 class Test_util2(unittest.TestCase): 20 RES_TOL=1.e-7 21 ABS_TOL=1.e-8 22 def setUp(self): 23 d1 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1) 24 x1 = ContinuousFunction(d1).getX() 25 ContinuousFunction(d1).setTags(1,Scalar(1,ContinuousFunction(d1))) 26 d2 = Rectangle(n0=int(NE/2),n1=NE,l0=0.5,order=1) 27 ContinuousFunction(d2).setTags(2,Scalar(1,ContinuousFunction(d2))) 28 d2.setX(d2.getX()+[0.5,0.]) 29 self.domain = JoinFaces([d1,d2]) 30 def tearDown(self): 31 del self.domain 32 33 #================================================== 34 def test_assemblage_2D_solO1_coeffOFull_NEqu1_d_contact_Const_typeContact(self): 35 x=self.domain.getX() 36 jump=Data(0.,(),ContinuousFunction(self.domain)) 37 jump.setTaggedValue(2,1.) 38 u=((-6)+x[1]-6*x[0])*jump 39 d_contact_test=Data(4,(),FunctionOnContactZero(self.domain)) 40 y_contact_test=(-24)+4*x[1]-24*x[0] 41 pde=LinearPDE(self.domain) 42 pde.setValue(d_contact=d_contact_test, y_contact=y_contact_test) 43 r=pde.getResidual(u) 44 rhs=pde.getRightHandSide() 45 self.failUnless(Lsup(rhs)>0,"right hand side is zero") 46 self.failUnless(Lsup(r)<=self.RES_TOL*Lsup(rhs),"residual is too big") 47 48 if __name__ == '__main__': 49 suite = unittest.TestSuite() 50 suite.addTest(unittest.makeSuite(Test_util2)) 51 s=unittest.TextTestRunner(verbosity=2).run(suite) 52 53

 ViewVC Help Powered by ViewVC 1.1.26