@@ -321,12 +321,6 @@ namespace Core::IO
321321
322322 namespace
323323 {
324- /* *
325- * Sections that contain at least this number of entries are considered huge and are only
326- * available on rank 0.
327- */
328- constexpr std::size_t huge_section_threshold = 10'000 ;
329-
330324 // ! The different ways we want to handle sections in the input file.
331325 enum class SectionType
332326 {
@@ -726,31 +720,28 @@ namespace Core::IO
726720 // Communicate the dat content
727721 if (Core::Communication::my_mpi_rank (pimpl_->comm_ ) == 0 )
728722 {
729- // Temporarily move the sections that are not huge into a separate map.
730- std::unordered_map<std::string, Internal::SectionContent> non_huge_sections ;
723+ // Temporarily move the sections that we want to broadcast into a separate map.
724+ std::unordered_map<std::string, Internal::SectionContent> non_legacy_sections ;
731725
732726 for (auto && [section_name, content] : pimpl_->content_by_section_ )
733727 {
734- if (std::holds_alternative<Internal::SectionContent::DatContent>(content.content ))
728+ if (std::holds_alternative<Internal::SectionContent::DatContent>(content.content ) &&
729+ !pimpl_->is_legacy_section (section_name))
735730 {
736- if (content.as_dat ().lines .size () < huge_section_threshold)
737- {
738- non_huge_sections[section_name] = std::move (content);
739- }
731+ non_legacy_sections[section_name] = std::move (content);
740732 }
741733 }
742734
743- Core::Communication::broadcast (non_huge_sections , 0 , pimpl_->comm_ );
735+ Core::Communication::broadcast (non_legacy_sections , 0 , pimpl_->comm_ );
744736
745- // Move the non-huge sections back into the main map.
746- for (auto && [section_name, content] : non_huge_sections)
737+ for (auto && [section_name, content] : non_legacy_sections)
747738 {
748739 pimpl_->content_by_section_ [section_name] = std::move (content);
749740 }
750741 }
751742 else
752743 {
753- // Other ranks receive the non-huge sections.
744+ // Other ranks receive the non-legacy sections.
754745 Core::Communication::broadcast (pimpl_->content_by_section_ , 0 , pimpl_->comm_ );
755746 }
756747
@@ -760,7 +751,7 @@ namespace Core::IO
760751 {
761752 ryml::Tree tree_with_small_sections = init_yaml_tree_with_exceptions ();
762753 tree_with_small_sections.rootref () |= ryml::MAP;
763- // Go through the tree and drop the huge sections from the tree.
754+ // Go through the tree and drop the legacy sections from the tree.
764755 for (auto file_node : pimpl_->yaml_tree_ .rootref ())
765756 {
766757 auto new_file_node = tree_with_small_sections.rootref ().append_child ();
@@ -769,8 +760,7 @@ namespace Core::IO
769760
770761 for (auto section_node : file_node.children ())
771762 {
772- if (section_node.is_map () ||
773- (section_node.is_seq () && section_node.num_children () < huge_section_threshold))
763+ if (!pimpl_->is_legacy_section (to_string (section_node.key ())))
774764 {
775765 // Copy the node to the new tree.
776766 auto new_section_node = new_file_node.append_child ();
0 commit comments