@@ -13,6 +13,8 @@ int main(int argc, char** argv)
1313 std::string fn_bary;
1414 std::string fn_dev;
1515 std::string fn_out;
16+ unsigned int nbSample;
17+ unsigned short int seed;
1618
1719 boostPO::variables_map vm;
1820 boostPO::options_description desc (" Allowed options" );
@@ -23,14 +25,20 @@ int main(int argc, char** argv)
2325 boostPO::value<std::string>(&fn_rules)->required (),
2426 " REQUIRED | Subdivision rule filename" )
2527 (" bary,b" ,
26- boostPO::value<std::string>(&fn_bary),
27- " Barycenter offset filename (for each rule id)" )
28+ boostPO::value<std::string>(&fn_bary)-> required () ,
29+ " REQUIRED | Barycenter offset filename (for each rule id)" )
2830 (" dev,d" ,
2931 boostPO::value<std::string>(&fn_dev),
30- " Offset filename (for each structural indices)" )
32+ " Offset LUT filename (for each structural indices)" )
3133 (" out,o" ,
3234 boostPO::value<std::string>(&fn_out),
3335 " Output filename" )
36+ (" nbSample,n" ,
37+ boostPO::value<unsigned int >(&nbSample)->default_value (1024 ),
38+ " Number of sample de generate" )
39+ (" seed,s" ,
40+ boostPO::value<unsigned short int >(&seed)->default_value (0 ),
41+ " Initial tile to use for sampling ([1-408], 0 = random)" )
3442 ;
3543
3644 try
@@ -55,39 +63,22 @@ int main(int argc, char** argv)
5563
5664 /* PROG ***********************************************************/
5765 Sampler sampler (fn_rules, fn_bary, fn_dev);
58- /*
59- WriterFilePts write(fn_out);
60- /*/
61- WriterEmpty write;
62- // */
63- char ans;
64- float density = 2 ;
65- unsigned short int seed = 0 ;
66- float spaceScale = 0.21 ;
67- while (true )
68- {
69- std::cout << " =================================" << std::endl;
70- std::cout << " ? Generate a distribution (Y/n) ? " ;
71- if ( std::cin.peek () == ' \n ' ) ans=' y' ;
72- else if ( !(std::cin >> ans) ) break ;
73- std::cin.ignore ();
74- if ( std::cin.fail () || ans==' n' || ans==' N' ) break ;
75-
76- std::cout << " ? set initial seed [0-" << sampler.tiling ().ruleSize ()-1 << " ] (" << ++seed << " ): " ;
77- if ( std::cin.peek () == ' \n ' );
78- else if ( !(std::cin >> seed) ) break ;
79- std::cin.ignore ();
8066
81- std::cout << " ? set final density [0-inf] (" << density << " ): " ;
82- if ( std::cin.peek () == ' \n ' );
83- else if ( !(std::cin >> density) ) break ;
84- std::cin.ignore ();
85-
86- std::cout << " ? set boundary (" << spaceScale << " ): " ;
87- if ( std::cin.peek () == ' \n ' );
88- else if ( !(std::cin >> spaceScale) ) break ;
89- std::cin.ignore ();
67+ if ( seed == 0 )
68+ {
69+ srand48 (time (NULL ));
70+ seed = std::ceil (drand48 ()*408 );
71+ }
72+ if ( vm.count (" seed" ) ) seed = (seed-1 )%408 ;
9073
91- sampler.generateUniform (density, -1 , write, seed, spaceScale);
74+ if ( vm.count (" out" ) )
75+ {
76+ WriterFileRaw write (fn_out);
77+ sampler.generateUniform (nbSample, -1 , write, seed);
78+ }
79+ else
80+ {
81+ WriterEmpty write;
82+ sampler.generateUniform (nbSample, -1 , write, seed);
9283 }
9384}
0 commit comments