10
0
mirror of https://gitlab.com/scemama/irpf90.git synced 2024-12-22 04:13:33 +01:00

others_entity_name -> l_others_name

This commit is contained in:
Thomas Applencourt 2017-02-03 15:57:59 -06:00
parent aaebcf8025
commit f1ce16195f
5 changed files with 17 additions and 13 deletions

View File

@ -56,7 +56,7 @@ def process_deps(l):
def process_types(entity_input, d_entity):
assert type(entity_input) == Entity
l_name = [entity_input.name] + entity_input.others_entity_name
l_name = entity_input.l_name
l_entity = [d_entity[name] for name in l_name]
l = [ "{0}\t:: {1}\t{2}".format(entity.type, name, build_dim(entity.dim) )

View File

@ -130,13 +130,17 @@ class Entity(object):
d = self.d_type_lines
return next(line for _,line in d[Begin_provider]+d[Cont_provider] if line.filename[1] == self.name)
@irpy.lazy_property
def l_name(self):
# () -> List[str]
d = self.d_type_lines
return [line.filename[1] for _,line in d[Begin_provider]+d[Cont_provider] ]
@irpy.lazy_property
def others_entity_name(self):
def l_others_name(self):
# () -> List[str]
'''Extract the other entity-name defined'''
d = self.d_type_lines
return [line.filename[1] for _,line in d[Begin_provider]+d[Cont_provider] if not line.filename[1] == self.name]
return [name for name in self.l_name if not name == self.name]
@irpy.lazy_property
@ -193,7 +197,7 @@ class Entity(object):
" irp_iunit = irp_iunit+1",
" inquire(unit=irp_iunit,opened=irp_is_open)",
" enddo" ]
for n in [name] + self.others_entity_name:
for n in self.l_name:
result += [\
" open(unit=irp_iunit,file='irpf90_%s_'//trim(irp_num),form='FORMATTED',status='UNKNOWN',action='WRITE')"%(n),
" write(irp_iunit,*) %s%s"%(n,build_dim(self.d_entity[n].dim,colons=True)),
@ -224,7 +228,7 @@ class Entity(object):
" logical :: irp_is_open",
" integer :: irp_iunit" ]
if command_line.do_debug:
length = len("reader_%s" % (self.name))
length = len("reader_%s" % (name))
result += [\
" character*(%d) :: irp_here = 'reader_%s'"%(length,name),
" call irp_enter(irp_here)" ]
@ -235,7 +239,7 @@ class Entity(object):
" do while (irp_is_open)",
" inquire(unit=irp_iunit,opened=irp_is_open)",
" enddo"]
for n in [name] + self.others:
for n in self.l_name:
result += [\
" 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(self.cm_d_variable[n].dim,colons=True)),
@ -325,7 +329,7 @@ class Entity(object):
return []
else:
# We never go here
return [var for var in self.others_entity_name + [self.name] if self.d_entity[var].dim]
return [var for var in l_name if self.d_entity[var].dim]
# ~ # ~ # ~
# D e c l a r a t i o n
@ -606,7 +610,7 @@ class Entity(object):
if command_line.do_assert or command_line.do_debug:
result.append(" call irp_enter(irp_here)")
result += build_call_provide(self.to_provide, self.d_entity)
result += flatten(map(build_alloc, [self.same_as] + self.others_entity_name))
result += flatten(map(build_alloc, self.l_name))
result += [
" if (.not.%s_is_built) then" % (same_as), " call bld_%s" % (same_as),
" %s_is_built = .True." % (same_as), ""

View File

@ -83,8 +83,8 @@ def main():
print ' graph [ordering="out" splines=true overlap=false];'
l_main_usr = set([entity for entity in comm_world.d_entity.values() if entity.is_main])
l_main_head_usr = set([entity for entity in l_main_usr if entity.others_entity_name])
l_set_main_head_name = [ set([e.name]+e.others_entity_name) for e in l_main_head_usr]
l_main_head_usr = set([entity for entity in l_main_usr if entity.l_others_name])
l_set_main_head_name = [ set(e.l_name) for e in l_main_head_usr]
print_subgraph(l_set_main_head_name,'usr',color='blue')

View File

@ -113,7 +113,7 @@ class Irpy_comm_world(object):
Ent_part = partial(Entity, buf, icount, comm_world=self)
ent = Ent_part()
l_ent += [ent] + [Ent_part(name) for name in ent.others_entity_name]
l_ent += [ent] + [Ent_part(name) for name in ent.l_others_name]
# O(2) but who care
l_duplicate = [x for x in l_ent if l_ent.count(x) > 1]

View File

@ -57,7 +57,7 @@ def check_touch(variables, line, vars, main_vars):
if main_var not in variables:
error.fail(line, "Variable %s unknown" % (main_var, ))
x = variables[main_var]
return [main_var] + x.others_entity_name
return [main_var] + x.l_others_name
all_others = uniquify(flatten(map(fun, main_vars)))
all_others.sort()