void plD_init_plm(PLStream *pls) { PLmDev *dev; U_CHAR c = (U_CHAR) INITIALIZE; dbug_enter("plD_init_plm"); pls->color = 1; /* Is a color device */ pls->dev_fill0 = 1; /* Handle solid fills */ pls->dev_fill1 = 1; /* Handle pattern fills */ /* Initialize family file info */ plFamInit(pls); /* Prompt for a file name if not already set */ plOpenFile(pls); pls->pdfs = pdf_finit(pls->OutFile); /* Allocate and initialize device-specific data */ pls->dev = calloc(1, (size_t) sizeof(PLmDev)); if (pls->dev == NULL) plexit("plD_init_plm: Out of memory."); dev = (PLmDev *) pls->dev; dev->xold = PL_UNDEFINED; dev->yold = PL_UNDEFINED; dev->xmin = 0; dev->xmax = PIXELS_X - 1; dev->ymin = 0; dev->ymax = PIXELS_Y - 1; dev->pxlx = (double) PIXELS_X / (double) LPAGE_X; dev->pxly = (double) PIXELS_Y / (double) LPAGE_Y; plP_setpxl(dev->pxlx, dev->pxly); plP_setphy(dev->xmin, dev->xmax, dev->ymin, dev->ymax); /* Write Metafile header. */ WriteFileHeader(pls); /* Write color map state info */ plD_state_plm(pls, PLSTATE_CMAP0); plD_state_plm(pls, PLSTATE_CMAP1); /* Write initialization command. */ DEBUG_PRINT_LOCATION("before init"); plm_wr( pdf_wr_1byte(pls->pdfs, c) ); }
int Cosisim::full_ik( RandomPath begin, RandomPath end, Progress_notifier* progress_notifier ) { typedef FullIK_cdf_estimator< geostat_utils::CoKrigingConstraints, geostat_utils::CoKrigingCombiner, MarkovBayesCovariance > FullIkEstimator; FullIkEstimator cdf_estimator( marginal_->p_begin(),marginal_->p_end(), covariances_.begin(), covariances_.end(), combiners_.begin(), combiners_.end(), *kconstraints_ ); // set up the sampler Random_number_generator gen; Monte_carlo_sampler_t< Random_number_generator > sampler( gen ); // this vector will contain the indicies of the indicators to be estimated // at a given grid node std::vector< unsigned int > unestimated_indicators; for( ; begin != end ; ++begin ) { if( !progress_notifier->notify() ) return 1; get_current_local_cdf( *begin, unestimated_indicators ); if( unestimated_indicators.empty() ) { sampler( *begin, *ccdf_ ); continue; } geostat_utils::NeighborhoodVector neighborhoods = full_ik_find_neighbors( *begin, unestimated_indicators ); DEBUG_PRINT_LOCATION( "center", begin->location() ); DEBUG_PRINT_NEIGHBORHOOD( "hard1", &neighborhoods[0] ); DEBUG_PRINT_NEIGHBORHOOD( "soft1", &neighborhoods[1] ); DEBUG_PRINT_NEIGHBORHOOD( "hard2", &neighborhoods[2] ); DEBUG_PRINT_NEIGHBORHOOD( "soft2", &neighborhoods[3] ); GsTLPoint watch( 52, 95, 13 ); if( begin->location() == watch ) { std::cout << "found" << std::endl; } clear_ccdf(); int status = cdf_estimator( *begin, neighborhoods.begin(), neighborhoods.end(), *ccdf_ ); sampler( *begin, *ccdf_ ); code_into_indicators( *begin ); } return 0; }