Changeset 189 for trunk


Ignore:
Timestamp:
02/05/10 16:03:25 (14 years ago)
Author:
bernard
Message:

debut d'implementation de la fonction setMacroGraph

Location:
trunk/yao
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/yao/src/YAOObjects/Order.cpp

    r187 r189  
    768768                for(int i = 0; i < outerComp.size(); i++) Read3D(i); 
    769769 
     770                setMacroGraph(); 
     771 
    770772                break; 
    771773 
     
    29282930}; 
    29292931         
     2932void Order::setMacroGraph() { 
     2933 
     2934 
     2935        // Data structure used by boost to register informations on component search  
     2936        // ------------------------------------------------------------------------- 
     2937 
     2938        std::vector<int> componentList; 
     2939 
     2940        // Resizign the structure : one element for each main graph vertex 
     2941        // ---------------------------------------------------------------- 
     2942 
     2943        componentList.resize(boost::num_vertices(myGraph)); 
     2944 
     2945        // Data strcture used by boost to perform component search 
     2946        // ------------------------------------------------------- 
     2947 
     2948        std::vector<vertexDescriptor> verticesDiscoverList(boost::num_vertices(myGraph)); 
     2949 
     2950        // Perform a component search on the main graph  
     2951        // -------------------------------------------- 
     2952 
     2953        boost::strong_components(myGraph, &componentList[0], boost::root_map(&verticesDiscoverList[0])); 
     2954 
     2955        // Register vertices properties on affected components 
     2956        // --------------------------------------------------- 
     2957 
     2958        for(int i = 0; i < componentList.size(); i++) put(get(boost::vertex_affected_comp_t(), myGraph), i, componentList[i]); 
     2959 
     2960        // Getting the number of components  
     2961        // -------------------------------- 
     2962 
     2963        int nbComponents = *max_element(componentList.begin(), componentList.end()) + 1; 
     2964 
     2965        // Graph that will be the reduced graph from the main graph  
     2966        // -------------------------------------------------------- 
     2967 
     2968        myGraphType cfcGraph; 
     2969 
     2970        // Reduce the main graph and set up the reduced graph  
     2971        // -------------------------------------------------- 
     2972 
     2973        reduceGraph(myGraph, cfcGraph, nbComponents); 
     2974 
     2975        // Data structure used by boost to register informations on topological sort  
     2976        // ------------------------------------------------------------------------- 
     2977 
     2978        std::deque<int> topoOrder; 
     2979 
     2980        // Do not perform a topological sort if there is just one vertex in the graph  
     2981        // -------------------------------------------------------------------------- 
     2982 
     2983        if(boost::num_vertices(cfcGraph) > 1) { 
     2984 
     2985        // Perform a topological sort on the reduced graph 
     2986        // ----------------------------------------------- 
     2987 
     2988        boost::topological_sort(cfcGraph, std::front_inserter(topoOrder), boost::vertex_index_map(boost::identity_property_map())); 
     2989 
     2990        // Sort the vertices affected components accordignly to the topological order  
     2991        // -------------------------------------------------------------------------- 
     2992 
     2993        for(int noComponent = 0; noComponent < topoOrder.size(); noComponent++) 
     2994                                        put(get(boost::vertex_affected_comp_t(), cfcGraph), noComponent, topoOrder[noComponent]); 
     2995        } 
     2996 
     2997}; 
     2998 
    29302999 
    29313000 
  • trunk/yao/src/YAOObjects/Order.hpp

    r187 r189  
    372372        void keepComponent(int noComp, myGraphType& upperGraph); 
    373373 
     374        /** 
     375        * Function that set-up a graph that will be used to perform the final groupping procedure  
     376        * 
     377        * This function create a graph composed by macro-vertices from the main graph : every vertex of this graph 
     378        * is made from a component of the main graph and every edge of this graph is an edge that link two components 
     379        * of the main graph.  
     380        *  
     381        * As the component Id affected to each vertex must match the component structure "outerComp" (because many  
     382        * relevant informations needed by the groupping procedure will be found inside the component structures), it  
     383        * is very important to keep the correct component Id in the "vertex_affected_comp" property of each macro-vertex.  
     384        * To keep the referencing between structures and macro-vertices, the same operations than those performed on the 
     385        * main graph inside the setOuter() function are performed here.  
     386        *  
     387        * As every vertex have an affected component (even a single vertex), this graph embed all the relevant informations 
     388        * to perform the final groupping procedure : 
     389        * 
     390        *       - Informations on edges linking components are already carried by the graph. 
     391        *       - Informations on components will be naturally found by looking at the tructures indexed by the macro-vertices 
     392        *         "vertex_affected_comp" property 
     393        * 
     394        * It could seems to be an overhead to perform the component search and the sorting on the main graph because it have already 
     395        * been done inside the setOuter() procedure but this is just a first step : 3D components,  2D components and 1D components 
     396        * should be mixed all together in the same graph, so several operations, not yet implemented, will be needed.  
     397        */ 
     398        void setMacroGraph(); 
     399 
     400 
     401 
    374402        // -- Fonction de gestion des signes et des axes -- 
    375403 
Note: See TracChangeset for help on using the changeset viewer.