10
0
mirror of https://gitlab.com/scemama/irpf90.git synced 2024-12-21 11:53:32 +01:00

QmcChem OK

Version:1.1.13
This commit is contained in:
Anthony Scemama 2009-09-14 14:36:39 +02:00
parent e76b6d967f
commit 6da6ed407e
4 changed files with 44 additions and 41 deletions

View File

@ -125,7 +125,7 @@ def get_parsed_text():
check_touch(line,vars,main_vars) check_touch(line,vars,main_vars)
txt = " ".join(vars) txt = " ".join(vars)
result += [ ([],Simple_line(line.i,"!",line.filename)), result += [ ([],Simple_line(line.i,"!",line.filename)),
([],Simple_line(line.i,"! >>> TOUCH %s"%(txt,),line.filename)) ] (vars,Simple_line(line.i,"! >>> TOUCH %s"%(txt,),line.filename)) ]
def fun(x): def fun(x):
if x not in variables: if x not in variables:
error.fail(line,"Variable %s unknown"%(x,)) error.fail(line,"Variable %s unknown"%(x,))
@ -328,7 +328,7 @@ parsed_text = result
###################################################################### ######################################################################
if __name__ == '__main__': if __name__ == '__main__':
for i in range(len(parsed_text)): for i in range(len(parsed_text)):
if parsed_text[i][0] == 'mpi.irp.f': if parsed_text[i][0] == 'vmc_step.irp.f':
print '!-------- %s -----------'%(parsed_text[i][0]) print '!-------- %s -----------'%(parsed_text[i][0])
for line in parsed_text[i][1]: for line in parsed_text[i][1]:
print line[1] print line[1]

View File

@ -241,7 +241,7 @@ class Variable(object):
" open(unit=irp_iunit,file='irpf90_%s_'//trim(irp_num),form='FORMATTED',status='OLD',action='READ')"%(n), " open(unit=irp_iunit,file='irpf90_%s_'//trim(irp_num),form='FORMATTED',status='OLD',action='READ')"%(n),
" read(irp_iunit,*) %s%s"%(n,build_dim(variables[n].dim)), " read(irp_iunit,*) %s%s"%(n,build_dim(variables[n].dim)),
" close(irp_iunit)" ] " close(irp_iunit)" ]
rsult += [ \ result += [ \
" call touch_%s"%(name), " call touch_%s"%(name),
" %s_is_built = .True."%(name) ] " %s_is_built = .True."%(name) ]
if command_line.do_debug: if command_line.do_debug:
@ -409,42 +409,43 @@ class Variable(object):
if '_builder' not in self.__dict__: if '_builder' not in self.__dict__:
if not self.is_main: if not self.is_main:
self._builder = [] self._builder = []
import parsed_text else:
from variables import build_use, call_provides import parsed_text
for filename,buffer in parsed_text.parsed_text: from variables import build_use, call_provides
if self.line.filename[0].startswith(filename): for filename,buffer in parsed_text.parsed_text:
break if self.line.filename[0].startswith(filename):
text = []
same_as = self.same_as
inside = False
for vars,line in buffer:
if isinstance(line,Begin_provider):
if line.filename[1] == same_as:
inside = True
vars = []
if inside:
text.append( (vars,line) )
text += map( lambda x: ([],Simple_line(line.i,x,line.filename)), call_provides(vars) )
if isinstance(line,End_provider):
if inside:
break break
name = self.name text = []
text = parsed_text.move_to_top(text,Declaration) same_as = self.same_as
text = parsed_text.move_to_top(text,Implicit) inside = False
text = parsed_text.move_to_top(text,Use) for vars,line in buffer:
text = map(lambda x: x[1], text) if isinstance(line,Begin_provider):
for line in filter(lambda x: type(x) not in [ Begin_doc, End_doc, Doc], text): if line.filename[1] == same_as:
if type(line) == Begin_provider: inside = True
result = [ "subroutine bld_%s"%(name) ] vars = []
result += build_use([name]+self.needs) if inside:
elif type(line) == Cont_provider: text.append( (vars,line) )
pass text += map( lambda x: ([],Simple_line(line.i,x,line.filename)), call_provides(vars) )
elif type(line) == End_provider: if isinstance(line,End_provider):
result.append( "end subroutine bld_%s"%(name) ) if inside:
break break
else: name = self.name
result.append(line.text) text = parsed_text.move_to_top(text,Declaration)
self._builder = result text = parsed_text.move_to_top(text,Implicit)
text = parsed_text.move_to_top(text,Use)
text = map(lambda x: x[1], text)
for line in filter(lambda x: type(x) not in [ Begin_doc, End_doc, Doc], text):
if type(line) == Begin_provider:
result = [ "subroutine bld_%s"%(name) ]
result += build_use([name]+self.needs)
elif type(line) == Cont_provider:
pass
elif type(line) == End_provider:
result.append( "end subroutine bld_%s"%(name) )
break
else:
result.append(line.text)
self._builder = result
return self._builder return self._builder
builder = property(builder) builder = property(builder)

View File

@ -34,9 +34,11 @@ def build_use(vars):
return result return result
###################################################################### ######################################################################
def call_provides(vars): def call_provides(vars,opt=False):
vars = make_single( map(lambda x: variables[x].same_as, vars) ) vars = make_single( map(lambda x: variables[x].same_as, vars) )
vars = map(lambda x: variables[x].name,vars) if opt:
all_children = flatten( map(lambda x: variables[x].children, vars ))
vars = filter(lambda x: x not in all_children,vars)
def fun(x): def fun(x):
return [ \ return [ \
" if (.not.%s_is_built) then"%(x), " if (.not.%s_is_built) then"%(x),

View File

@ -1 +1 @@
version = "1.1.12" version = "1.1.13"