Changeset 886

Show
Ignore:
Timestamp:
03/06/08 18:12:11
Author:
robert
Message:

Added reporting of the source files that contribute to an osgdem run.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/include/vpb/DataSet

    r881 r886  
    170170        bool generateTasks(TaskManager* taskManager); 
    171171 
    172         bool generateTasks_new(TaskManager* taskManager); 
    173         bool generateTasks_old(TaskManager* taskManager); 
     172        bool generateTasksImplementation(TaskManager* taskManager); 
    174173 
    175174 
  • trunk/include/vpb/Destination

    r859 r886  
    286286    bool getSubTilesGenerated() const { return _subTileGenerated; } 
    287287 
     288    DestinationTile::Sources getAllContributingSources(); 
    288289 
    289290    typedef std::vector< osg::ref_ptr<DestinationTile> > TileList; 
  • trunk/src/vpb/DataSet.cpp

    r885 r886  
    17031703     
    17041704    updateSourcesForDestinationGraphNeeds(); 
     1705     
    17051706 
    17061707    log(osg::NOTICE, "completed DataSet::createDestination(%u)",numLevels); 
     
    23652366    } 
    23662367 
    2367     bool result = false; 
    2368     if (getBuildOptionsString().find("old_tm")!=std::string::npos) 
    2369     { 
    2370         result = generateTasks_old(taskManager); 
    2371     } 
    2372     else 
    2373     { 
    2374         result = generateTasks_new(taskManager); 
    2375     } 
     2368    bool result = generateTasksImplementation(taskManager); 
    23762369 
    23772370    if (getBuildLog()) 
     
    24832476} 
    24842477 
    2485 bool DataSet::generateTasks_new(TaskManager* taskManager) 
     2478bool DataSet::generateTasksImplementation(TaskManager* taskManager) 
    24862479{ 
    24872480    log(osg::NOTICE,"DataSet::generateTasks_new"); 
     
    25002493 
    25012494 
    2502 #if 1 
    25032495    if (!prepareForDestinationGraphCreation()) return false; 
    25042496 
     
    26692661    } 
    26702662 
    2671 #else 
    2672  
    2673     computeDestinationGraphFromSources(bottomDistributedBuildLevel+1); 
    2674  
    2675     if (!_destinationGraph.valid()) return false; 
    2676  
    2677     // initialize various tasks related settings 
    2678     std::string sourceFile = taskManager->getSourceFileName(); 
    2679     std::string basename = taskManager->getBuildName(); 
    2680  
    2681     std::string taskDirectory = getTaskDirectory(); 
    2682     if (!taskDirectory.empty()) taskDirectory += "/"; 
    2683  
    2684     std::string logDirectory = getLogDirectory(); 
    2685     if (!logDirectory.empty()) logDirectory += "/"; 
    2686  
    2687     std::string fileCacheName; 
    2688     if (System::instance()->getFileCache()) fileCacheName = System::instance()->getFileCache()->getFileName();  
    2689  
    2690     bool logging = getNotifyLevel() > ALWAYS; 
    2691  
    2692      
    2693     // create root task 
    2694     { 
    2695         std::ostringstream taskfile; 
    2696         taskfile<<taskDirectory<<basename<<"_root_L0_X0_Y0.task"; 
    2697  
    2698         std::ostringstream app; 
    2699         app<<"osgdem --run-path "<<taskManager->getRunPath()<<" -s "<<sourceFile<<" --record-subtile-on-leaf-tiles -l "<<getDistributedBuildSplitLevel()<<" --task "<<taskfile.str(); 
    2700  
    2701         if (!fileCacheName.empty()) 
    2702         { 
    2703             app<<" --cache "<<fileCacheName; 
    2704         } 
    2705  
    2706         if (logging) 
    2707         { 
    2708             std::ostringstream logfile; 
    2709             logfile<<logDirectory<<basename<<"_root_L0_X0_Y0.log"; 
    2710             app<<" --log "<<logfile.str(); 
    2711         } 
    2712  
    2713         taskManager->addTask(taskfile.str(), app.str(), sourceFile); 
    2714     } 
    2715      
    2716      
    2717     // need to create an intermediate level if required. 
    2718     if (getDistributedBuildSecondarySplitLevel()!=0) 
    2719     { 
    2720  
    2721         CollectSubtiles cs(getDistributedBuildSplitLevel()-1); 
    2722         _destinationGraph->accept(cs); 
    2723  
    2724         for(CollectSubtiles::SubtileList::iterator itr = cs._subtileList.begin(); 
    2725             itr != cs._subtileList.end(); 
    2726             ++itr) 
    2727         { 
    2728             CompositeDestination* cd = itr->get(); 
    2729  
    2730             std::ostringstream taskfile; 
    2731             taskfile<<taskDirectory<<basename<<"_subtile_L"<<cd->_level<<"_X"<<cd->_tileX<<"_Y"<<cd->_tileY<<".task"; 
    2732  
    2733  
    2734             std::ostringstream app; 
    2735             app<<"osgdem --run-path "<<taskManager->getRunPath()<<" -s "<<sourceFile<<" --record-subtile-on-leaf-tiles -l "<<getDistributedBuildSecondarySplitLevel()<<" --subtile "<<cd->_level<<" "<<cd->_tileX<<" "<<cd->_tileY<<" --task "<<taskfile.str(); 
    2736  
    2737  
    2738             if (!fileCacheName.empty()) 
    2739             { 
    2740                 app<<" --cache "<<fileCacheName; 
    2741             } 
    2742  
    2743             if (logging) 
    2744             { 
    2745                 std::ostringstream logfile; 
    2746  
    2747                 logfile<<logDirectory<<basename<<"_subtile_L"<<cd->_level<<"_X"<<cd->_tileX<<"_Y"<<cd->_tileY<<".log"; 
    2748                 app<<" --log "<<logfile.str(); 
    2749             } 
    2750  
    2751             taskManager->addTask(taskfile.str(), app.str(), sourceFile); 
    2752         } 
    2753     } 
    2754      
    2755     // create the bottom level split 
    2756     {     
    2757  
    2758         // bottom set of tasks 
    2759         CollectSubtiles cs(bottomDistributedBuildLevel-1); 
    2760         _destinationGraph->accept(cs); 
    2761  
    2762         for(CollectSubtiles::SubtileList::iterator itr = cs._subtileList.begin(); 
    2763             itr != cs._subtileList.end(); 
    2764             ++itr) 
    2765         { 
    2766             CompositeDestination* cd = itr->get(); 
    2767  
    2768             std::ostringstream taskfile; 
    2769             taskfile<<taskDirectory<<basename<<"_subtile_L"<<cd->_level<<"_X"<<cd->_tileX<<"_Y"<<cd->_tileY<<".task"; 
    2770  
    2771  
    2772             std::ostringstream app; 
    2773             app<<"osgdem --run-path "<<taskManager->getRunPath()<<" -s "<<sourceFile<<" --subtile "<<cd->_level<<" "<<cd->_tileX<<" "<<cd->_tileY<<" --task "<<taskfile.str(); 
    2774  
    2775             if (!fileCacheName.empty()) 
    2776             { 
    2777                 app<<" --cache "<<fileCacheName; 
    2778             } 
    2779  
    2780             if (logging) 
    2781             { 
    2782                 std::ostringstream logfile; 
    2783  
    2784                 logfile<<logDirectory<<basename<<"_subtile_L"<<cd->_level<<"_X"<<cd->_tileX<<"_Y"<<cd->_tileY<<".log"; 
    2785                 app<<" --log "<<logfile.str(); 
    2786             } 
    2787  
    2788             taskManager->addTask(taskfile.str(), app.str(), sourceFile); 
    2789         } 
    2790     } 
    2791 #endif 
    27922663 
    27932664    return false; 
    2794 } 
    2795  
    2796 bool DataSet::generateTasks_old(TaskManager* taskManager) 
    2797 { 
    2798     loadSources(); 
    2799  
    2800     if (!prepareForDestinationGraphCreation()) return false; 
    2801  
    2802     selectAppropriateSplitLevels(); 
    2803  
    2804     if (getDistributedBuildSplitLevel()==0) return false; 
    2805  
    2806  
    2807     computeDestinationGraphFromSources(getDistributedBuildSplitLevel()+1); 
    2808  
    2809     if (_destinationGraph.valid()) 
    2810     { 
    2811         CollectSubtiles cs(getDistributedBuildSplitLevel()-1); 
    2812          
    2813         _destinationGraph->accept(cs); 
    2814          
    2815         std::string sourceFile = taskManager->getSourceFileName(); 
    2816          
    2817         std::string basename = taskManager->getBuildName(); 
    2818         std::string taskDirectory = getTaskDirectory(); 
    2819         if (!taskDirectory.empty()) taskDirectory += "/"; 
    2820          
    2821         std::string logDirectory = getLogDirectory(); 
    2822         if (!logDirectory.empty()) logDirectory += "/"; 
    2823  
    2824         std::string fileCacheName; 
    2825         if (System::instance()->getFileCache()) fileCacheName = System::instance()->getFileCache()->getFileName();  
    2826          
    2827         bool logging = getNotifyLevel() > ALWAYS; 
    2828          
    2829         // create root task 
    2830         { 
    2831             std::ostringstream taskfile; 
    2832             taskfile<<taskDirectory<<basename<<"_root_L0_X0_Y0.task"; 
    2833  
    2834             std::ostringstream app; 
    2835             app<<"osgdem --run-path "<<taskManager->getRunPath()<<" -s "<<sourceFile<<" --record-subtile-on-leaf-tiles -l "<<getDistributedBuildSplitLevel()<<" --task "<<taskfile.str(); 
    2836  
    2837             if (!fileCacheName.empty()) 
    2838             { 
    2839                 app<<" --cache "<<fileCacheName; 
    2840             } 
    2841  
    2842             if (logging) 
    2843             { 
    2844                 std::ostringstream logfile; 
    2845                 logfile<<logDirectory<<basename<<"_root_L0_X0_Y0.log"; 
    2846                 app<<" --log "<<logfile.str(); 
    2847             } 
    2848 #if 0             
    2849             else 
    2850             { 
    2851                 app<<" > /dev/null"; 
    2852             } 
    2853 #endif             
    2854  
    2855             taskManager->addTask(taskfile.str(), app.str(), sourceFile); 
    2856         } 
    2857          
    2858         // taskManager->nextTaskSet(); 
    2859          
    2860         for(CollectSubtiles::SubtileList::iterator itr = cs._subtileList.begin(); 
    2861             itr != cs._subtileList.end(); 
    2862             ++itr) 
    2863         { 
    2864             CompositeDestination* cd = itr->get(); 
    2865              
    2866             std::ostringstream taskfile; 
    2867             taskfile<<taskDirectory<<basename<<"_subtile_L"<<cd->_level<<"_X"<<cd->_tileX<<"_Y"<<cd->_tileY<<".task"; 
    2868  
    2869  
    2870             std::ostringstream app; 
    2871             app<<"osgdem --run-path "<<taskManager->getRunPath()<<" -s "<<sourceFile<<" --subtile "<<cd->_level<<" "<<cd->_tileX<<" "<<cd->_tileY<<" --task "<<taskfile.str(); 
    2872  
    2873             if (!fileCacheName.empty()) 
    2874             { 
    2875                 app<<" --cache "<<fileCacheName; 
    2876             } 
    2877  
    2878             if (logging) 
    2879             { 
    2880                 std::ostringstream logfile; 
    2881  
    2882                 logfile<<logDirectory<<basename<<"_subtile_L"<<cd->_level<<"_X"<<cd->_tileX<<"_Y"<<cd->_tileY<<".log"; 
    2883                 app<<" --log "<<logfile.str(); 
    2884             } 
    2885 #if 0 
    2886             else 
    2887             { 
    2888                 app<<" > /dev/null"; 
    2889             } 
    2890 #endif 
    2891             taskManager->addTask(taskfile.str(), app.str(), sourceFile); 
    2892         } 
    2893  
    2894     } 
    2895      
    2896     return true; 
    28972665} 
    28982666 
     
    29732741            osgDB::writeNodeFile(*terrain,getIntermediateBuildName()); 
    29742742            requiresGenerationOfTiles = false; 
     2743        } 
     2744    } 
     2745     
     2746     
     2747    bool printOutContributingSources = true; 
     2748    if (printOutContributingSources) 
     2749    { 
     2750        CompositeDestination* startPoint = _destinationGraph.get(); 
     2751        if (getGenerateSubtile()) 
     2752        { 
     2753            startPoint = getComposite(getSubtileLevel(), getSubtileX(), getSubtileY()); 
     2754        } 
     2755     
     2756        DestinationTile::Sources sources = startPoint->getAllContributingSources(); 
     2757        log(osg::NOTICE,"There are %d contributing source files:",sources.size()); 
     2758 
     2759        for(DestinationTile::Sources::iterator itr = sources.begin(); 
     2760            itr != sources.end(); 
     2761            ++itr) 
     2762        { 
     2763            log(osg::NOTICE,"    %s",(*itr)->getFileName().c_str()); 
    29752764        } 
    29762765    } 
  • trunk/src/vpb/Destination.cpp

    r880 r886  
    29412941    } 
    29422942} 
     2943 
     2944DestinationTile::Sources CompositeDestination::getAllContributingSources() 
     2945{ 
     2946    typedef std::set<Source*> SourceSet; 
     2947    SourceSet sourceSet; 
     2948     
     2949    for(TileList::iterator titr=_tiles.begin(); 
     2950        titr!=_tiles.end(); 
     2951        ++titr) 
     2952    { 
     2953        DestinationTile* dt = titr->get(); 
     2954        for(DestinationTile::Sources::iterator itr = dt->_sources.begin(); 
     2955             itr != dt->_sources.end(); 
     2956             ++itr) 
     2957        { 
     2958            sourceSet.insert(itr->get()); 
     2959        } 
     2960    }     
     2961     
     2962    return DestinationTile::Sources(sourceSet.begin(), sourceSet.end()); 
     2963}