@@ -600,52 +600,64 @@ void Series::init(
600600 std::make_unique<DummyIOHandler>(parsed_directory, at));
601601 auto &series = get ();
602602 series.iterations .linkHierarchy (writable ());
603- series.m_deferred_initialization = [called_this_already = false ,
604- filepath,
605- options,
606- at,
607- comm...](Series &s) mutable {
608- if (called_this_already)
609- {
610- throw std::runtime_error (" Must be called one time only" );
611- }
612- else
613- {
614- called_this_already = true ;
615- }
616-
617- auto [parsed_input, tracing_json] =
618- s.initIOHandler <json::TracingJSON>(filepath, options, at, true );
603+ series.m_deferred_initialization =
604+ [called_this_already = false , filepath, options, at, comm...](
605+ Series &s) mutable {
606+ if (called_this_already)
607+ {
608+ throw std::runtime_error (" Must be called one time only" );
609+ }
610+ else
611+ {
612+ called_this_already = true ;
613+ }
619614
620- auto io_handler = createIOHandler (
621- parsed_input->path ,
622- at,
623- parsed_input->format ,
624- parsed_input->filenameExtension .value_or (std::string ()),
625- comm...,
626- tracing_json,
627- filepath);
628- auto res = io_handler.get ();
629- s.initSeries (std::move (io_handler), std::move (parsed_input));
630- json::warnGlobalUnusedOptions (tracing_json);
631- return res;
632- };
615+ auto [parsed_input, tracing_json] =
616+ s.initIOHandler <json::TracingJSON>(
617+ filepath,
618+ options,
619+ at,
620+ true ,
621+ std::forward<MPI_Communicator>(comm)...);
622+
623+ auto io_handler = createIOHandler (
624+ parsed_input->path ,
625+ at,
626+ parsed_input->format ,
627+ parsed_input->filenameExtension .value_or (std::string ()),
628+ comm...,
629+ tracing_json,
630+ filepath);
631+ auto res = io_handler.get ();
632+ s.initSeries (std::move (io_handler), std::move (parsed_input));
633+ json::warnGlobalUnusedOptions (tracing_json);
634+ return res;
635+ };
633636 };
634637
635638 switch (at)
636639 {
637640 case Access::CREATE:
638641 case Access::READ_WRITE:
639642 case Access::READ_ONLY: {
640- auto [parsed_input, tracing_json] =
641- initIOHandler<json::TracingJSON>(filepath, options, at, true );
643+ auto [parsed_input, tracing_json] = initIOHandler<json::TracingJSON>(
644+ filepath,
645+ options,
646+ at,
647+ true ,
648+ std::forward<MPI_Communicator>(comm)...);
642649 init_directly (std::move (parsed_input), std::move (tracing_json));
643650 }
644651 break ;
645652 case Access::READ_LINEAR:
646653 case Access::APPEND: {
647654 auto [first_parsed_input, first_tracing_json] =
648- initIOHandler<json::TracingJSON>(filepath, options, at, false );
655+ initIOHandler<json::TracingJSON>(
656+ filepath,
657+ options,
658+ at,
659+ false ,
660+ std::forward<MPI_Communicator>(comm)...);
649661 if (first_parsed_input->filenameExtension .has_value ())
650662 {
651663 init_directly (
@@ -666,16 +678,19 @@ void Series::init(
666678 }
667679}
668680
669- template <typename TracingJSON>
681+ template <typename TracingJSON, typename ... MPI_Communicator >
670682auto Series::initIOHandler (
671683 std::string const &filepath,
672684 std::string const &options,
673685 Access at,
674- bool resolve_generic_extension)
686+ bool resolve_generic_extension,
687+ MPI_Communicator &&...comm)
675688 -> std::tuple<std::unique_ptr<ParsedInput>, TracingJSON>
676689{
677- json::TracingJSON optionsJson =
678- json::parseOptions (options, /* considerFiles = */ true );
690+ json::TracingJSON optionsJson = json::parseOptions (
691+ options,
692+ std::forward<MPI_Communicator>(comm)...,
693+ /* considerFiles = */ true );
679694 auto input = parseInput (filepath);
680695 if (resolve_generic_extension && input->format == Format::GENERIC &&
681696 at != Access::CREATE)
0 commit comments