Skip to content
Snippets Groups Projects
Commit 7f9cf2c4 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

code compiles and links successfully

It also successfully gives the "wrong number of command line arguments"
message.
parent 48629ea6
No related branches found
No related tags found
1 merge request!21Bugfix/nansampling
......@@ -76,21 +76,26 @@ class _base(object):
function_suffix = '',
template_class = '',
template_prefix = '',
file_group = 'parameters'):
file_group = 'parameters',
just_declaration = False,
simname_variable = 'simname'):
if type(parameters) == type(None):
parameters = self.parameters
key = sorted(list(parameters.keys()))
src_txt = (template_prefix +
'int ' +
template_class +
'read_parameters' + function_suffix + '()\n{\n' +
'hid_t parameter_file;\n' +
'hid_t dset, memtype, space;\n' +
'char fname[256];\n' +
'hsize_t dims[1];\n' +
'char *string_data;\n' +
'sprintf(fname, "%s.h5", simname);\n' +
'parameter_file = H5Fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT);\n')
'read_parameters' + function_suffix + '()')
if just_declaration:
return src_txt + ';\n'
src_txt += ('\n{\n' +
'hid_t parameter_file;\n' +
'hid_t dset, memtype, space;\n' +
'char fname[256];\n' +
'hsize_t dims[1];\n' +
'char *string_data;\n' +
'sprintf(fname, "%s.h5", {0});\n'.format(simname_variable) +
'parameter_file = H5Fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT);\n')
for i in range(len(key)):
src_txt += 'dset = H5Dopen(parameter_file, "/{0}/{1}", H5P_DEFAULT);\n'.format(
file_group, key[i])
......
......@@ -56,6 +56,7 @@ int main_code(
std::cerr <<
"Wrong number of command line arguments. Stopping." <<
std::endl;
MPI_Init(&argc, &argv);
MPI_Finalize();
return EXIT_SUCCESS;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment