mirror of
https://gitlab.com/scemama/irpf90.git
synced 2024-12-22 04:13:33 +01:00
Add vitali reduction in -G
This commit is contained in:
parent
6f48bc966c
commit
cb7838d068
@ -58,7 +58,7 @@ def main():
|
||||
# Create a dot reprenstion of the dependency graph.
|
||||
# Merge inside a subgraph the Entity provided together
|
||||
comm_world.t_filename_parsed_text # Initialize entity need. Dirty I know.
|
||||
from util import mangled
|
||||
from util import mangled, l_dummy_entity
|
||||
|
||||
print 'digraph { '
|
||||
|
||||
@ -72,7 +72,14 @@ def main():
|
||||
print ' subgraph cluster%s {' % name
|
||||
print ' %s ' % ' '.join([entity.name] + entity.others_entity_name)
|
||||
print ' }'
|
||||
print '}'
|
||||
|
||||
for i,s in enumerate(l_dummy_entity(comm_world.d_entity)):
|
||||
print ' subgraph cluster%s {' % i
|
||||
print ' %s ' % ' '.join(s)
|
||||
print ' color = blue'
|
||||
print ' }'
|
||||
print '}'
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
23
src/util.py
23
src/util.py
@ -308,3 +308,26 @@ def build_call_provide(l_ent, d_ent):
|
||||
|
||||
return flatten(map(bld_f90, l_same_as))
|
||||
|
||||
def che_merge(sets):
|
||||
#(List[Set] -> List[Set]
|
||||
"""Merge a list of set is they are not disjoint.
|
||||
Note:
|
||||
This will destry sets
|
||||
"""
|
||||
results = []
|
||||
upd, isd, pop = set.update, set.isdisjoint, sets.pop
|
||||
while sets:
|
||||
if not [upd(sets[0],pop(i)) for i in range(len(sets)-1,0,-1) if not isd(sets[0],sets[i])]:
|
||||
results.append(pop(0))
|
||||
return results
|
||||
|
||||
|
||||
def l_dummy_entity(d_entity):
|
||||
from itertools import combinations
|
||||
l_candidate_botom = [ (i,j) for i,j in combinations(d_entity.keys(),2) if d_entity[i].children == d_entity[j].children]
|
||||
l_dummy = [set([i,j]) for i,j in l_candidate_botom if d_entity[i].parents == d_entity[j].parents]
|
||||
|
||||
return che_merge(l_dummy)
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user