From 484a45b907ffc45cb0d3f81bcb109fe3d07bede1 Mon Sep 17 00:00:00 2001 From: hinder Date: Mon, 3 Jan 2011 18:50:53 +0000 Subject: 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 --- src/multipole.cc | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'src/multipole.cc') 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) { -- cgit v1.2.3