Hi Logan,
Logan Sorenson wrote:
Hi,
First of all, sorry for disappearing for a month or so. Things got really busy with moving and starting school again.
Same here (no school though, just work).
I cloned the latest git repository from [1] and issued a make in the root sfepy directory. Then I ran ./runTests.py and everything passed.
Good, I try to keep the master repo without errors.
So I tried to run the poisson_parametric_study example and got the following parser exception.:
logan@phoenix:~/projects/sfepy$ ./simple.py input/poisson_parametric_study.py sfepy: left over: ['select_circ', 'vary_omega1_size', '__builtins__', '__file__', 'output', '__name__', 'pause', 'nm', '_filename', 'default_diameter', 'debug', 'os', '__doc__'] sfepy: reading mesh (database/square_circ.vtk)...
sfepy: ...done in 0.02 s
sfepy: setting up domain edges...
sfepy: ...done in 0.01 s
sfepy: creating regions... sfepy: leaf Omega region_Omega__2 parsing failed: Struct:Omega_1 name: Omega_1 select: nodes by select_circ( x, y, z, 0.250000 ) Traceback (most recent call last): File "./simple.py", line 100, in <module> main() File "./simple.py", line 93, in main app = SimpleApp( conf, options, output_prefix ) File "/home/logan/projects/sfepy/sfepy/applications/simple_app.py", line 48, in __init__ **kwargs ) File "/home/logan/projects/sfepy/sfepy/fem/problemDef.py", line 83, in from_conf obj.set_regions(conf.regions, conf.materials, obj.functions) File "/home/logan/projects/sfepy/sfepy/fem/problemDef.py", line 124, in set_regions self.domain.create_regions(conf_regions, functions) File "/home/logan/projects/sfepy/sfepy/fem/domain.py", line 589, in create_regions out = bnf.parseString( rdef.select ) File "/usr/lib/pymodules/python2.5/pyparsing.py", line 1076, in parseString raise exc pyparsing.ParseException: Expected end of text (at char 20), (line:1, col:21)
I fired up winpdb and was able to find the exception raised at line 589 in sfepy/fem/domain.py. It looks it isn't parsing the region definition on line 45 of poisson_parametric_study.py:
'Omega_1' : ('nodes by select_circ( x, y, z, %f )' % default_diameter, {}),
The parser fails on the '(' character in the string 'nodes by select_circ( x, y, z, %f )'. Since I'm not familiar yet with pyparsing, that's as far as I can get for now. Does anyone else see this?
Thanks for the bug-report! This input file is not covered by the tests, and it should. Could you submit an issue at [1]? It is also easy to fix, see below.
The error you see is related to implementing the issues 36 and 93, [2,3], i.e. a unification of passing (extra) arguments to BC, material, and region definition functions. There is now a new keyword 'functions', where a function to be used should be registered, and any extra parameters are handled there too. The function is then used by its name only, see, for example, input/octahedron.py (or "git grep 'functions =" to see all the inputs using this feature).
Would you like to try and fix it yourself?
cheers, r.
[1] http://code.google.com/p/sfepy/issues/list [2] http://code.google.com/p/sfepy/issues/detail?id=36&can=1 [3] http://code.google.com/p/sfepy/issues/detail?id=93&can=1