Пример #1
0
 void PCR::setup(){
   set_abd_current();
   setup_X();
   setup_beta();
   setup_aliases();
   set_observers();
 }
Пример #2
0
static void init_predictions(PRED_AT w) {
	int i;
	DPOINT *bp;
	DATA **d = NULL;
#ifdef WITH_SPIRAL
	DATA_GRIDMAP *grid;
#endif

	est = (double *) emalloc(get_n_outfile() * sizeof(double));
	bp = get_block_p();
	d = get_gstat_data();
	switch (w) {
	  case AT_POINTS:
		if (o_filename == NULL) 
			ErrMsg(ER_VARNOTSET, "please specify output file");
		write_points(o_filename, val_data, NULL, NULL, get_n_outfile());
		if (bp->x == -1.0) { /* set default */
			bp->x = bp->y = 1.0;
			pr_warning("default block size set to: dx=1, dy=1");
		}
		break;
	  case AT_GRIDMAP:
		/* open mask files: */
		get_maskX(NULL, NULL, 0, 0); /* re-initializes static arrays */
		masks = (GRIDMAP **) emalloc(get_n_masks() * sizeof(GRIDMAP *));
		for (i = 0; i < get_n_masks(); i++)
			masks[i] = check_open(get_mask_name(i), i); /* read as float */
		if (n_pred_locs > 0)
			strata_min = floor(masks[0]->cellmin);
		outmap = (GRIDMAP **) emalloc(get_n_outfile() * sizeof(GRIDMAP *));
		printlog("initializing maps ");
		for (i = 0; i < get_n_outfile(); i++) {
			if (get_outfile_namei(i) != NULL) {
				printlog("."); /* creating maps ..... */
				if (get_method() == ISI)
					masks[0]->celltype = CT_UINT8;
				outmap[i] = map_dup(get_outfile_namei(i), masks[0]);
			} else
				outmap[i] = NULL;
		}
		printlog("\n");
		if (bp->x == -1.0) { /* set default to map cellsize */
			bp->x = masks[0]->cellsizex;
			bp->y = masks[0]->cellsizey;
			pr_warning("default block size set to dx=%g, dy=%g", bp->x, bp->y);
		}
		for (i = 0; i < get_n_vars(); i++) {
 			if (d[i]->dummy) {
 				d[i]->minX = masks[0]->x_ul + 0.5 * masks[0]->cellsizex;
 				d[i]->maxX = masks[0]->x_ul + masks[0]->cellsizex * 
						(masks[0]->cols - 0.5);
 				d[i]->maxY = masks[0]->y_ul - 0.5 * masks[0]->cellsizey;
 				d[i]->minY = masks[0]->y_ul - masks[0]->cellsizey * 
						(masks[0]->rows - 0.5);
 				d[i]->minZ = d[i]->maxZ = 0.0;
 			} 
 			if (d[i]->togrid)
 				datagrid_rebuild(d[i], 1);
		}
		break;
	}
	if (gl_nsim > 1)
		init_simulations(d);
	if (is_simulation(get_method()) && get_n_beta_set() != get_n_vars())
		setup_beta(d, get_n_vars(), gl_nsim);
} /* init_predictions() */