@@ -459,6 +459,28 @@ namespace libmpdataxx
459459 group.createAttribute (name, type, H5::DataSpace (1 , &one)).write (type, data.data ());
460460 }
461461
462+ // record 1D profiles, assumes that z is the last dimension
463+ void record_prof_hlpr (H5::H5File hdff, const std::string &name, typename solver_t ::real_t *data, const bool vctr)
464+ {
465+ assert (this ->rank == 0 );
466+
467+ auto &_shape (vctr ? cshape : shape);
468+
469+ auto aux = hdff.createDataSet (
470+ name,
471+ flttype_output,
472+ H5::DataSpace (1 , &_shape[parent_t ::n_dims - 1 ])
473+ );
474+
475+ #if defined(USE_MPI)
476+ if (this ->mem ->distmem .rank () == 0 )
477+ #endif
478+ {
479+ auto space = aux.getSpace ();
480+ space.selectHyperslab (H5S_SELECT_SET, &_shape[parent_t ::n_dims - 1 ], &offst[parent_t ::n_dims - 1 ]);
481+ aux.write (data, flttype_solver, H5::DataSpace (1 , &_shape[parent_t ::n_dims - 1 ]), space);
482+ }
483+ }
462484
463485 // ---- functions for auxiliary output in timestep files ----
464486
@@ -483,6 +505,11 @@ namespace libmpdataxx
483505 record_aux_scalar (name, " /" , data);
484506 }
485507
508+ void record_aux_prof (const std::string &name, typename solver_t ::real_t *data, const bool vctr = false )
509+ {
510+ record_prof_hlpr (*hdfp, name, data, vctr);
511+ }
512+
486513
487514 // ---- functions for auxiliary output in const.h5 file ----
488515
@@ -530,33 +557,16 @@ namespace libmpdataxx
530557 record_aux_dsc_hlpr (name, arr, hdfcp);
531558 }
532559
533- // see above, also assumes that z is the last dimension
560+ // see above
534561 void record_prof_const_hlpr (const std::string &name, typename solver_t ::real_t *data, const bool vctr)
535562 {
536- assert (this ->rank == 0 );
537-
538- auto &_shape (vctr ? cshape : shape);
539-
540563 H5::H5File hdfcp (const_file, H5F_ACC_RDWR
541564#if defined(USE_MPI)
542565 , H5P_DEFAULT, fapl_id
543566#endif
544567 ); // reopen the const file
545568
546- auto aux = hdfcp.createDataSet (
547- name,
548- flttype_output,
549- H5::DataSpace (1 , &_shape[parent_t ::n_dims - 1 ])
550- );
551-
552- #if defined(USE_MPI)
553- if (this ->mem ->distmem .rank () == 0 )
554- #endif
555- {
556- auto space = aux.getSpace ();
557- space.selectHyperslab (H5S_SELECT_SET, &_shape[parent_t ::n_dims - 1 ], &offst[parent_t ::n_dims - 1 ]);
558- aux.write (data, flttype_solver, H5::DataSpace (1 , &_shape[parent_t ::n_dims - 1 ]), space);
559- }
569+ record_prof_hlpr (hdfcp, name, data, vctr);
560570 }
561571
562572 void record_prof_const (const std::string &name, typename solver_t ::real_t *data)
0 commit comments