src/matOptimize/VCF_load_tree.cpp
//Warpper for the preceding functor to clean tree
Warpper for the preceding functor to clean tree
Warpper for the preceding functor to clean tree
static void clean_up_internal_nodes_single_child_or_no_mutation(MAT::Node* this_node,MAT::Tree& tree,std::unordered_set<std::string>& changed_nodes,std::unordered_set<std::string>& node_with_inconsistent_state) {
    tbb::concurrent_vector<std::string> changed_nodes_rep;
    tbb::concurrent_vector<std::string> node_with_inconsistent_state_rep;
    tbb::concurrent_vector<std::string> removed_nodes;
    auto dfs=tree.depth_first_expansion();
    std::vector<std::mutex> node_mutexes(dfs.size());
    tbb::task::spawn_root_and_wait(*new(tbb::task::allocate_root())struct clean_up_internal_nodes_single_child_or_no_mutation(this_node,changed_nodes_rep,node_with_inconsistent_state_rep,removed_nodes,node_mutexes));
    changed_nodes.insert(changed_nodes_rep.begin(),changed_nodes_rep.end());
    node_with_inconsistent_state.insert(node_with_inconsistent_state_rep.begin(),node_with_inconsistent_state_rep.end());
    for( const auto& node_id:removed_nodes) {
        changed_nodes.erase(node_id);
        node_with_inconsistent_state.erase(node_id);
        tree.all_nodes.erase(node_id);
    }
}
static void clean_up_internal_nodes_single_child_or_no_mutation ( MAT :: Node * this_node , MAT :: Tree & tree , std :: unordered_set < std :: string > & changed_nodes , std :: unordered_set < std :: string > & node_with_inconsistent_state ) { tbb :: concurrent_vector < std :: string > changed_nodes_rep ; tbb :: concurrent_vector < std :: string > node_with_inconsistent_state_rep ; tbb :: concurrent_vector < std :: string > removed_nodes ; auto dfs = tree . depth_first_expansion ( ) ; std :: vector < std :: mutex > node_mutexes ( dfs . size ( ) ) ; tbb :: task :: spawn_root_and_wait ( * new ( tbb :: task :: allocate_root ( ) ) struct clean_up_internal_nodes_single_child_or_no_mutation ( this_node , changed_nodes_rep , node_with_inconsistent_state_rep , removed_nodes , node_mutexes ) ) ; changed_nodes . insert ( changed_nodes_rep . begin ( ) , changed_nodes_rep . end ( ) ) ; node_with_inconsistent_state . insert ( node_with_inconsistent_state_rep . begin ( ) , node_with_inconsistent_state_rep . end ( ) ) ; for ( const auto & node_id : removed_nodes ) { changed_nodes . erase ( node_id ) ; node_with_inconsistent_state . erase ( node_id ) ; tree . all_nodes . erase ( node_id ) ; } }
Warpper for the preceding functor to clean tree
Warpper for the preceding functor to clean tree