diff options
author | hinder <hinder@4f5cb9a8-4dd8-4c2d-9bbd-173fa4467843> | 2011-01-03 18:50:53 +0000 |
---|---|---|
committer | hinder <hinder@4f5cb9a8-4dd8-4c2d-9bbd-173fa4467843> | 2011-01-03 18:50:53 +0000 |
commit | 484a45b907ffc45cb0d3f81bcb109fe3d07bede1 (patch) | |
tree | 9751c105738e6e7a440b5ea7a45a3c9d537f8d7c /src/multipole.cc | |
parent | 8a261b82b40e89d433499fd8ac82a1050c02bbce (diff) |
Add HDF5 output support
One HDF5 file per variable, and one extensible dataset per radius per mode. HDF5 is required only optionally, so this thorn can be compiled without it.
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/Multipole/trunk@74 4f5cb9a8-4dd8-4c2d-9bbd-173fa4467843
Diffstat (limited to 'src/multipole.cc')
-rw-r--r-- | src/multipole.cc | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/multipole.cc b/src/multipole.cc index 975d589..8a6a6ea 100644 --- a/src/multipole.cc +++ b/src/multipole.cc @@ -97,15 +97,28 @@ static void parse_variables_string(const string &var_string, variable_desc v[max static void output_mode(CCTK_ARGUMENTS, const variable_desc *v, CCTK_REAL rad, CCTK_REAL real_lm, CCTK_REAL imag_lm, int l, int m) { - DECLARE_CCTK_ARGUMENTS - DECLARE_CCTK_PARAMETERS + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; - if (CCTK_MyProc(cctkGH) == 0) + if (output_ascii) + { + if (CCTK_MyProc(cctkGH) == 0) + { + ostringstream name; + name << "mp_" << v->name << "_l" << l << "_m" << m << + "_r" << setiosflags(ios::fixed) << setprecision(2) << rad << ".asc"; + Multipole_OutputComplexToFile(CCTK_PASS_CTOC, name.str(), real_lm, imag_lm); + } + } + if (output_hdf5) { - ostringstream name; - name << "mp_" << v->name << "_l" << l << "_m" << m << - "_r" << setiosflags(ios::fixed) << setprecision(2) << rad << ".asc"; - Multipole_OutputComplexToFile(CCTK_PASS_CTOC, name.str(), real_lm, imag_lm); + if (CCTK_MyProc(cctkGH) == 0) + { + ostringstream h5datasetname; + h5datasetname << "l" << l << "_m" << m << "_r" << setiosflags(ios::fixed) << setprecision(2) << rad; + Multipole_OutputComplexToH5File(CCTK_PASS_CTOC, "mp_" + v->name + ".h5", h5datasetname.str(), + real_lm, imag_lm); + } } } @@ -116,7 +129,7 @@ static void output_1D(CCTK_ARGUMENTS, const variable_desc *v, CCTK_REAL rad, DECLARE_CCTK_ARGUMENTS DECLARE_CCTK_PARAMETERS - if (CCTK_MyProc(cctkGH) == 0) + if (CCTK_MyProc(cctkGH) == 0 && output_ascii) { if (out_1d_every != 0 && cctk_iteration % out_1d_every == 0) { |