/[escript]/trunk/modellib/test/python/run_domainreaders.py
ViewVC logotype

Contents of /trunk/modellib/test/python/run_domainreaders.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3586 - (show annotations)
Fri Sep 9 04:02:29 2011 UTC (10 years, 1 month ago) by caltinay
File MIME type: text/x-python
File size: 2474 byte(s)
run_domainreaders now passes some parameters to the constructors so
kwargs is tested to be working. Addresses #578.

1
2 ########################################################
3 #
4 # Copyright (c) 2003-2010 by University of Queensland
5 # Earth Systems Science Computational Center (ESSCC)
6 # http://www.uq.edu.au/esscc
7 #
8 # Primary Business: Queensland, Australia
9 # Licensed under the Open Software License version 3.0
10 # http://www.opensource.org/licenses/osl-3.0.php
11 #
12 ########################################################
13
14 __copyright__="""Copyright (c) 2003-2010 by University of Queensland
15 Earth Systems Science Computational Center (ESSCC)
16 http://www.uq.edu.au/esscc
17 Primary Business: Queensland, Australia"""
18 __license__="""Licensed under the Open Software License version 3.0
19 http://www.opensource.org/licenses/osl-3.0.php"""
20 __url__="https://launchpad.net/escript-finley"
21
22 #
23 # Testing reading domains
24 #
25 # Tests for finley and dudley reading .fly and .gmsh
26 #
27
28 import os
29
30 import esys.finley
31 import esys.dudley
32
33 from esys.escript import getMPISizeWorld
34 from esys.escript.modelframe import DataSource
35 from esys.modellib.geometry import *
36 from esys.pycad.gmsh import *
37 from esys.pycad import *
38
39 # Putting it in PYCAD dir
40 try:
41 MODELLIB_WORKDIR=os.environ['MODELLIB_WORKDIR']
42 except KeyError:
43 MODELLIB_WORKDIR='.'
44
45
46 def Test_domain(dommodule, f):
47 dom=RectangularDomain(dommodule, parameters=["fish","dummy"], debug=True)
48 # need to write to both .fly and .gmsh
49 dom.domain().write(f+"dr.fly")
50 r1=DomainReader(dommodule)
51 r1.source=DataSource(uri=f+"dr.fly", fileformat="fly")
52 bdomf=r1.domain()
53 del bdomf
54 r2=DomainReader(dommodule)
55 r2.source=DataSource(uri=os.path.join(MODELLIB_WORKDIR,"TESTgmsh_test.msh"), fileformat="gmsh")
56 bdomm=r2.domain()
57 del bdomm
58
59
60 if getMPISizeWorld() > 1:
61 print "Warning: modellib/test/python/run_domainreaders.py has not been executed as number of MPI ranks is greater than 1."
62 else:
63
64 des=Design()
65 b=Volume(Brick(Point(0,0,0), Point(1,1,1)))
66 des.addItems(b)
67 des.setMeshFileName(os.path.join(MODELLIB_WORKDIR,"TESTgmsh_test.msh"))
68 esys.finley.MakeDomain(des)
69
70 Test_domain(None,os.path.join(MODELLIB_WORKDIR,'TESTnone'))
71 Test_domain(esys.finley,os.path.join(MODELLIB_WORKDIR,'TESTfin'))
72 Test_domain(esys.dudley,os.path.join(MODELLIB_WORKDIR,'TESTDud'))
73
74 #Now we need to test using the FinleyReader
75
76 rf=FinleyReader(parameters=["fish","dummy"], debug=True)
77 rf.source=DataSource(uri=os.path.join(MODELLIB_WORKDIR,"TESTfindr.fly"), fileformat="fly")
78 rf.domain()
79

  ViewVC Help
Powered by ViewVC 1.1.26