diff --git a/bfps/NavierStokes.py b/bfps/NavierStokes.py index ebae77dca043ed1a9c3ea1f8a5cbab864c7e023d..7f82de445391d8628e69bd4177f2ca201cda5779 100644 --- a/bfps/NavierStokes.py +++ b/bfps/NavierStokes.py @@ -75,7 +75,6 @@ class NavierStokes(_fluid_particle_base): self.parameters['max_R_estimate'] = 1.0 self.file_datasets_grow = """ //begincpp - std::string temp_string; hsize_t dims[4]; hid_t group; hid_t Cspace, Cdset; @@ -491,10 +490,8 @@ class NavierStokes(_fluid_particle_base): self.parameters['tracers{0}_integration_steps'.format(s0 + s)] = integration_steps[s] self.file_datasets_grow += """ //begincpp - temp_string = (std::string("/") + - std::string(ps{0}->name)); - group = H5Gopen(particle_file, temp_string.c_str(), H5P_DEFAULT); - grow_particle_datasets(group, temp_string.c_str(), NULL, NULL); + group = H5Gopen(particle_file, ps{0}->name, H5P_DEFAULT); + grow_particle_datasets(group, "", NULL, NULL); H5Gclose(group); //endcpp """.format(s0 + s) diff --git a/bfps/_fluid_base.py b/bfps/_fluid_base.py index 92aa5822498c90c026af8a4fc0a6fe0039edd283..aece581924900cf9b01548c8305eb852c2529815 100644 --- a/bfps/_fluid_base.py +++ b/bfps/_fluid_base.py @@ -117,17 +117,15 @@ class _fluid_particle_base(_code): 'H5Dclose(dset);\n}\n' + 'return 0;\n}\n') self.definitions += ('herr_t grow_particle_datasets(hid_t g_id, const char *name, const H5L_info_t *info, void *op_data)\n{\n' + - 'std::string full_name;\n' + 'hsize_t dset;\n') for key in ['state', 'velocity', 'acceleration']: - self.definitions += ('full_name = (std::string(name) + std::string("/{0}"));\n'.format(key) + - 'if (H5Lexists(g_id, full_name.c_str(), H5P_DEFAULT))\n{\n' + - 'dset = H5Dopen(g_id, full_name.c_str(), H5P_DEFAULT);\n' + + self.definitions += ('if (H5Lexists(g_id, "{0}", H5P_DEFAULT))\n'.format(key) + + '{\n' + + 'dset = H5Dopen(g_id, "{0}", H5P_DEFAULT);\n'.format(key) + 'grow_single_dataset(dset, niter_todo/niter_part);\n' + 'H5Dclose(dset);\n}\n') - self.definitions += ('full_name = (std::string(name) + std::string("/rhs"));\n' + - 'if (H5Lexists(g_id, full_name.c_str(), H5P_DEFAULT))\n{\n' + - 'dset = H5Dopen(g_id, full_name.c_str(), H5P_DEFAULT);\n' + + self.definitions += ('if (H5Lexists(g_id, "rhs", H5P_DEFAULT))\n{\n' + + 'dset = H5Dopen(g_id, "rhs", H5P_DEFAULT);\n' + 'grow_single_dataset(dset, 1);\n' + 'H5Dclose(dset);\n}\n' + 'return 0;\n}\n')