1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-11-03 20:54:07 +01:00

minor cleaning in the generator

This commit is contained in:
q-posev 2021-03-18 21:12:28 +01:00
parent e322a6e42d
commit 696d867725

View File

@ -19,8 +19,6 @@ for k,v in config0.items():
#if k == 'nucleus': #if k == 'nucleus':
config[k] = v config[k] = v
#print(config)
groups = [group for group in config.keys()] groups = [group for group in config.keys()]
dim_variables = {} dim_variables = {}
@ -39,9 +37,6 @@ for k1,v1 in config.items():
dim_dict[grname] = dim_list dim_dict[grname] = dim_list
dim_list = [] dim_list = []
#print(dim_variables)
#print(dim_dict)
datasets = {} datasets = {}
numbers = {} numbers = {}
for k1,v1 in config.items(): for k1,v1 in config.items():
@ -53,8 +48,9 @@ for k1,v1 in config.items():
if var_name not in dim_variables.keys(): if var_name not in dim_variables.keys():
numbers[var_name] = v2[0] numbers[var_name] = v2[0]
print('Strings I/O currently not supported')
# TODO, for now remove char-related stuff # TODO, for now remove char-related stuff
print('Strings I/O currently not supported')
datasets_nostr = {} datasets_nostr = {}
for k,v in datasets.items(): for k,v in datasets.items():
tmp_dict = {} tmp_dict = {}
@ -74,21 +70,14 @@ for k,v in datasets.items():
tmp_dict['dim_list'] = dim_str tmp_dict['dim_list'] = dim_str
datasets_nostr[k] = tmp_dict datasets_nostr[k] = tmp_dict
#print(datasets_nostr['nucleus_coord'])
#put also dimensioning variables in numbers #put also dimensioning variables in numbers
numbers.update(dim_variables) numbers.update(dim_variables)
print(numbers)
templ_path_text = join(fileDir,'templates_text') templ_path_text = join(fileDir,'templates_text')
templ_path_hdf5 = join(fileDir,'templates_hdf5') templ_path_hdf5 = join(fileDir,'templates_hdf5')
templ_path_front = join(fileDir,'templates_front') templ_path_front = join(fileDir,'templates_front')
#clean the populated/ directory
#for popdir in [templ_path_front, templ_path_front, templ_path_text]:
# cleandir = join(popdir, 'populated')
# for f in scandir(cleandir):
# remove(f.path)
files_exclude = ['prefix_hdf5.c', 'prefix_hdf5.h', 'suffix_hdf5.h', files_exclude = ['prefix_hdf5.c', 'prefix_hdf5.h', 'suffix_hdf5.h',
'prefix_text.c', 'prefix_text.h', 'suffix_text.h', 'prefix_text.c', 'prefix_text.h', 'suffix_text.h',
@ -106,14 +95,11 @@ files_funcs = [f for f in files if 'read_' in f or 'write_' in f or 'flush_' in
files_funcs_dsets = [f for f in files_funcs if 'dset' in f] files_funcs_dsets = [f for f in files_funcs if 'dset' in f]
files_funcs_nums = [f for f in files_funcs if 'num' in f] files_funcs_nums = [f for f in files_funcs if 'num' in f]
files_funcs_groups = [f for f in files_funcs if 'group' in f] files_funcs_groups = [f for f in files_funcs if 'group' in f]
files_funcs_groups.append('struct_text_group_dset.h')
#print(files_funcs_groups)
files_auxil = [f for f in files if not ('read_' in f or 'write_' in f or 'rw_' in f)] files_auxil = [f for f in files if not ('read_' in f or 'write_' in f or 'rw_' in f)]
# build files with functions for text groups files_funcs_groups.append('struct_text_group_dset.h')
# build files with functions for text groups
for fname in files_funcs_groups: for fname in files_funcs_groups:
fname_new = join('populated',f'pop_{fname}') fname_new = join('populated',f'pop_{fname}')
if '_text' in fname: if '_text' in fname:
@ -173,7 +159,6 @@ for fname in files_funcs_groups:
else: else:
print('fishy') print('fishy')
#print(loop_body)
loop_body = '' loop_body = ''
subloop = False subloop = False
do_dset = False do_dset = False
@ -232,7 +217,6 @@ for fname in files_funcs_groups:
f_out.write(line) f_out.write(line)
# build files with functions # build files with functions
for fname in files_funcs_dsets: for fname in files_funcs_dsets:
fname_new = join('populated',f'pop_{fname}') fname_new = join('populated',f'pop_{fname}')