1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-08-25 06:31:43 +02:00

Exclude write_determinant_num funcs from the public API

This commit is contained in:
q-posev 2022-04-29 14:59:25 +02:00
parent e37e950d85
commit 0ec37e59b5
3 changed files with 19 additions and 6 deletions

View File

@ -42,6 +42,10 @@ cat populated/pop_*.h >> trexio.h
cat hrw_determinant_front.h >> trexio.h
cat *_determinant_front.c >> trexio.c
# private API header file
cat populated/private_pop_front.h >> trexio_private.h
echo "#endif" >> trexio_private.h
# fortran front end
cat populated/pop_*.f90 >> trexio_f.f90
# add determinant part

View File

@ -5664,10 +5664,6 @@ contains
#endif
#+end_src
#+begin_src c :tangle trexio_private.h
#endif
#+end_src
#+begin_src f90 :tangle suffix_fortran.f90
end module trexio
#+end_src

View File

@ -37,7 +37,10 @@ def get_files_todo(source_files: dict) -> dict:
all_files += source_files[key]
files_todo = {}
files_todo['all'] = [f for f in all_files if 'read' in f or 'write' in f or 'has' in f or 'flush' in f or 'free' in f or 'hrw' in f or 'delete' in f]
files_todo['all'] = [
f for f in all_files
if 'read' in f or 'write' in f or 'has' in f or 'flush' in f or 'free' in f or 'hrw' in f or 'delete' in f
]
for key in ['dset_data', 'dset_str', 'dset_sparse', 'attr_num', 'attr_str', 'group']:
files_todo[key] = list(filter(lambda x: key in x, files_todo['all']))
@ -116,6 +119,11 @@ def recursive_populate_file(fname: str, paths: dict, detailed_source: dict) -> N
'group_dset', 'group_num', 'group_str', 'group']
for item in detailed_source.keys():
# special case to exclude write_determinant_num funcs from the public APIs
if 'determinant_num' in item and 'write' in fname and 'front' in fname and ('.f90' in fname or '.py' in fname):
continue
with open(join(templ_path,fname), 'r') as f_in :
with open(join(templ_path,fname_new), 'a') as f_out :
num_written = []
@ -144,6 +152,11 @@ def recursive_populate_file(fname: str, paths: dict, detailed_source: dict) -> N
# general case of recursive replacement of inline triggers
else:
populated_line = recursive_replace_line(line, triggers, detailed_source[item])
# special case to include write_determinant_num funcs in the private header
if 'determinant_num' in item and 'write' in line and 'front.h' in fname:
with open(join(templ_path,'populated/private_pop_front.h'), 'a') as f_priv:
f_priv.write(populated_line)
else:
f_out.write(populated_line)
f_out.write("\n")