Search for data files in SERPENT_DATA as well

New ideas for code development

Search for data files in SERPENT_DATA as well

Postby Andrei Fokau » Thu Sep 02, 2010 7:41 pm

Jaakko,
It seems that if in *.xsdata (acelib) one gives a relative path to the nuclide data, then Serpent tries to find it from the current directory only. It would be nice if it searches in SERPENT_DATA as well!
KTH Reactor Physics (Stockholm, Sweden) neutron.kth.se
Andrei Fokau
 
Posts: 77
Joined: Thu Mar 25, 2010 12:25 am
Location: KTH, Stockholm, Sweden

Re: Search for data files in SERPENT_DATA as well

Postby Jaakko Leppänen » Fri Sep 03, 2010 12:13 am

Andrei Fokau wrote:Jaakko,
It seems that if in *.xsdata (acelib) one gives a relative path to the nuclide data, then Serpent tries to find it from the current directory only. It would be nice if it searches in SERPENT_DATA as well!


I'm not sure what you mean? The search order is (see opendatafile.c):

1) string given in "set acelib"
2) SERPENT_DATA + string given in "set acelib"
3) SERPENT_DATA + '/' + string given in "set acelib"
4) SERPENT_DATA + file name parsed from string given in "set acelib" (everything after the last '/' character)
5) SERPENT_DATA + '/' + file name parsed from string given in "set acelib" (everything after the last '/' character)

It shouldn't search it from the current directory at all.
- Jaakko
User avatar
Jaakko Leppänen
Site Admin
 
Posts: 1982
Joined: Thu Mar 18, 2010 10:43 pm
Location: Espoo, Finland

Re: Search for data files in SERPENT_DATA as well

Postby Andrei Fokau » Fri Sep 03, 2010 7:53 pm

Jaakko, I meant that it would be great to have similar checks in readacefiles.c as well, so one could have xs-directory file with
Code: Select all
   1001.03c   1001.03c  1   1001  0    1.007828   299.97679  0  jeff31/data/1001_300K.ace

Currently, I have to create a symbolic link in the current directory to make it working
Code: Select all
ln -s /usr/local/serpent/xs/jeff31

BTW, steps 2 and 4 seem to be redundant... at least for OS I have experience with.
KTH Reactor Physics (Stockholm, Sweden) neutron.kth.se
Andrei Fokau
 
Posts: 77
Joined: Thu Mar 25, 2010 12:25 am
Location: KTH, Stockholm, Sweden

Re: Search for data files in SERPENT_DATA as well

Postby Jaakko Leppänen » Mon Sep 06, 2010 9:27 am

OK. That can be done by replacing line 149 in readacefiles.c from:

Code: Select all
     if ((fp = fopen(GetText(xsd + XSDATA_PTR_FILE), "r")) == NULL)
       Die(FUNCTION_NAME, "Unable to open file %s",
      GetText(xsd + XSDATA_PTR_FILE));


to

Code: Select all
     fp = OpenDataFile(xsd + XSDATA_PTR_FILE, "xs library");
- Jaakko
User avatar
Jaakko Leppänen
Site Admin
 
Posts: 1982
Joined: Thu Mar 18, 2010 10:43 pm
Location: Espoo, Finland

Re: Search for data files in SERPENT_DATA as well

Postby Andrei Fokau » Mon Sep 06, 2010 9:41 am

Jaakko Leppänen wrote:OK. That can be done by replacing line 149 in readacefiles.c ...

Easy... I should have seen it myself even being so scarred by C pointers! Do you plan to add it to the next update?
KTH Reactor Physics (Stockholm, Sweden) neutron.kth.se
Andrei Fokau
 
Posts: 77
Joined: Thu Mar 25, 2010 12:25 am
Location: KTH, Stockholm, Sweden

Re: Search for data files in SERPENT_DATA as well

Postby Jaakko Leppänen » Mon Sep 06, 2010 9:52 am

Yes, It's added.
- Jaakko
User avatar
Jaakko Leppänen
Site Admin
 
Posts: 1982
Joined: Thu Mar 18, 2010 10:43 pm
Location: Espoo, Finland


Return to Development

Who is online

Users browsing this forum: No registered users and 1 guest