本文整理汇总了C++中params::read_file方法的典型用法代码示例。如果您正苦于以下问题:C++ params::read_file方法的具体用法?C++ params::read_file怎么用?C++ params::read_file使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类params
的用法示例。
在下文中一共展示了params::read_file方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main ( int argc, char **argv )
{
int i, j, n, pid, t;
double pix;
double ir, ic;
int req, task, value;
char task_name[16];
log_start();
if ( argc < 2 ) {
fprintf(stderr,"Usage: %s param_file\n", argv[0]);
exit(1);
}
pe.mq = msgget ( getpid(), 0777|IPC_CREAT );
set_defaults();
p.read_file(argv[1]);
GDALAllRegister();
east1 = p.dvalue("easting_left");
east2 = p.dvalue("easting_right");
north1 = p.dvalue("northing_bottom");
north2 = p.dvalue("northing_top");
wid = p.dvalue("output_cell_size");
pix = p.dvalue("input_cell_size");
ir = p.dvalue("input_rows");
ic = p.dvalue("input_columns");
input_rows = (int)ir;
input_cols = (int)ic;
max_dist = 1.2 * pix * sqrt(ir*ir+ic*ic) / wid;
max_dist_2 = max_dist/2;
max_dist = max_dist * max_dist;
readers = p.ivalue("readers");
mappers = p.ivalue("mappers");
writers = p.ivalue("writers");
rows = int((north2 - north1) / wid);
cols = int((east2 - east1) / wid);
cindex = new int[cols];
dist.create(rows,cols);
img.create(rows,cols);
srand(time(NULL));
read_image_file(img);
fill ( img, dist, 0, rows );
//spread_dist ( img, dist );
//if ( p.value("dist_file") != "" ) output_dist_geotiff ( dist, v );
//if ( p.value("blob_file") != "" ) output_pcolor_geotiff ( img, dist, v );
sort ( img_indices, img_indices+img_ct, comp_row );
valid_img = new int[max_img_id];
for ( i = 0; i < img_ct; i++ ) {
j = img_indices[i];
valid_img[j] = 0;
if ( xy[j][0]+max_dist_2 >= 0 && xy[j][0]-max_dist_2 < rows ) {
pe.add_task ( "image", j );
}
}
read_dem_header(dem);
pe.launch ( dem_reader );
out.create_image(rows,cols);
for ( i = 0; i < out.rows; i += bs ) pe.add_task ( "mapper", i );
for ( i = 0; i < readers; i++ ) {
pe.launch ( reader );
}
for ( i = 0; i < mappers; i++ ) {
pe.launch ( mapper );
}
for ( i = 0; i < writers; i++ ) {
pe.launch ( writer );
}
while ( pe.children > 0 ) {
t = msgrcv ( pe.mq, &pe.msg, MSG_SIZE, 1, 0 );
if ( t < 0 ) perror("");
sscanf(pe.msg.s,"%d %d %s %d", &req, &pid, task_name, &value );
switch ( req ) {
case EXIT:
log("exit %d",pid);
pe.children--;
break;
case WAIT:
if ( pe.ready(task_name,value) ) {
sprintf(pe.msg.s,"1");
pe.msg.t = pid;
//printf("Sending %d task %d\n",pid,task);
log("wait %d %s %d",pid,task_name,value);
t = msgsnd ( pe.mq, &pe.msg, MSG_SIZE, 0 );
} else {
log("sleep %d %s %d",pid,task_name,value);
pe.enqueue ( task_name, value, pid );
//.........这里部分代码省略.........