scenario_obj.c
来自「CA仿真模型中SLEUTH模型」· C语言 代码 · 共 2,197 行 · 第 1/5 页
C
2,197 行
{ return scenario.write_avg_file;}/*************************************************************************************************************************************************************** FUNCTION NAME: scen_GetLogBaseStatsFlag** PURPOSE: return log base statistics flag** AUTHOR: Keith Clarke** PROGRAMMER: Tommy E. Cathey of NESC (919)541-1500** CREATION DATE: 11/11/1999** DESCRIPTION:*****/BOOLEAN scen_GetLogBaseStatsFlag (){ return scenario.log_base_stats;}/*************************************************************************************************************************************************************** FUNCTION NAME: scen_GetLogDebugFlag** PURPOSE: return log base statistics flag** AUTHOR: Keith Clarke** PROGRAMMER: Tommy E. Cathey of NESC (919)541-1500** CREATION DATE: 11/11/1999** DESCRIPTION:*****/BOOLEAN scen_GetLogDebugFlag (){ return scenario.log_debug;}/*************************************************************************************************************************************************************** FUNCTION NAME: scen_GetLogUrbanizationAttemptsFlag** PURPOSE: return log urbanization attempts flag** AUTHOR: Keith Clarke** PROGRAMMER: Tommy E. Cathey of NESC (919)541-1500** CREATION DATE: 11/11/1999** DESCRIPTION:*****/BOOLEAN scen_GetLogUrbanizationAttemptsFlag (){ return scenario.log_urbanization_attempts;}/*************************************************************************************************************************************************************** FUNCTION NAME: scen_GetLogCoeffFlag** PURPOSE: return log coeff flag** AUTHOR: Keith Clarke** PROGRAMMER: Tommy E. Cathey of NESC (919)541-1500** CREATION DATE: 11/11/1999** DESCRIPTION:*****/BOOLEAN scen_GetLogCoeffFlag (){ return scenario.log_coeff;}/*************************************************************************************************************************************************************** FUNCTION NAME: scen_GetLogTimingsFlag** PURPOSE: return log timings flag** AUTHOR: Keith Clarke** PROGRAMMER: Tommy E. Cathey of NESC (919)541-1500** CREATION DATE: 11/11/1999** DESCRIPTION:*****/int scen_GetLogTimingsFlag (){ return scenario.log_timings;}/*************************************************************************************************************************************************************** FUNCTION NAME: scen_GetWriteStdDevFileFlag** PURPOSE: return log processing status flag** AUTHOR: Keith Clarke** PROGRAMMER: Tommy E. Cathey of NESC (919)541-1500** CREATION DATE: 11/11/1999** DESCRIPTION:*****/BOOLEAN scen_GetWriteStdDevFileFlag (){ return scenario.write_std_dev_file;}/*************************************************************************************************************************************************************** FUNCTION NAME: scen_GetLogTransitionMatrixFlag** PURPOSE: return log processing status flag** AUTHOR: Keith Clarke** PROGRAMMER: Tommy E. Cathey of NESC (919)541-1500** CREATION DATE: 11/11/1999** DESCRIPTION:*****/BOOLEAN scen_GetLogTransitionMatrixFlag (){ return scenario.log_trans_matrix;}/*************************************************************************************************************************************************************** FUNCTION NAME: scen_GetLogProcessingStatusFlag** PURPOSE: return log processing status flag** AUTHOR: Keith Clarke** PROGRAMMER: Tommy E. Cathey of NESC (919)541-1500** CREATION DATE: 11/11/1999** DESCRIPTION:*****/BOOLEAN scen_GetLogProcessingStatusFlag (){ return scenario.log_processing_status;}/*************************************************************************************************************************************************************** FUNCTION NAME: scen_GetViewGrowthTypesFlag** PURPOSE: return view growth types flag** AUTHOR: Keith Clarke** PROGRAMMER: Tommy E. Cathey of NESC (919)541-1500** CREATION DATE: 11/11/1999** DESCRIPTION:*****/BOOLEAN scen_GetViewGrowthTypesFlag (){ if (scenario.view_growth_types) { if ((proc_GetCurrentRun () >= scenario.growth_type_window.run1) && (proc_GetCurrentRun () <= scenario.growth_type_window.run2) && (proc_GetCurrentMonteCarlo () >= scenario.growth_type_window.monte_carlo1) && (proc_GetCurrentMonteCarlo () <= scenario.growth_type_window.monte_carlo2) && (proc_GetCurrentYear () >= scenario.growth_type_window.year1) && (proc_GetCurrentYear () <= scenario.growth_type_window.year2)) { return scenario.view_growth_types; } } return FALSE;}/*************************************************************************************************************************************************************** FUNCTION NAME: scen_GetViewDeltatronAgingFlag** PURPOSE: return view deltatron aging flag** AUTHOR: Keith Clarke** PROGRAMMER: Tommy E. Cathey of NESC (919)541-1500** CREATION DATE: 11/11/1999** DESCRIPTION:*****/BOOLEAN scen_GetViewDeltatronAgingFlag (){ if (scenario.view_deltatron_aging) { if ((proc_GetCurrentRun () >= scenario.deltatron_aging_window.run1) && (proc_GetCurrentRun () <= scenario.deltatron_aging_window.run2) && (proc_GetCurrentMonteCarlo () >= scenario.deltatron_aging_window.monte_carlo1) && (proc_GetCurrentMonteCarlo () <= scenario.deltatron_aging_window.monte_carlo2) && (proc_GetCurrentYear () >= scenario.deltatron_aging_window.year1) && (proc_GetCurrentYear () <= scenario.deltatron_aging_window.year2)) { return scenario.view_deltatron_aging; } } return FALSE;}/*************************************************************************************************************************************************************** FUNCTION NAME: scen_GetDeltatronColorCount** PURPOSE: return deltatron color count** AUTHOR: Keith Clarke** PROGRAMMER: Tommy E. Cathey of NESC (919)541-1500** CREATION DATE: 11/11/1999** DESCRIPTION:*****/int scen_GetDeltatronColorCount (){ return scenario.deltatron_color_count;}/*************************************************************************************************************************************************************** FUNCTION NAME: scen_GetDeltatronColor** PURPOSE: return deltatron color by index** AUTHOR: Keith Clarke** PROGRAMMER: Tommy E. Cathey of NESC (919)541-1500** CREATION DATE: 11/11/1999** DESCRIPTION:*****/int scen_GetDeltatronColor (int index){ assert (index < scenario.deltatron_color_count); return scenario.deltatron_color[index];}/*************************************************************************************************************************************************************** FUNCTION NAME: scen_GetPhase0GrowthColor** PURPOSE: return scenario.phase0g_growth_color** AUTHOR: Keith Clarke** PROGRAMMER: Tommy E. Cathey of NESC (919)541-1500** CREATION DATE: 11/11/1999** DESCRIPTION:*****/int scen_GetPhase0GrowthColor (){ return scenario.phase0g_growth_color;}/*************************************************************************************************************************************************************** FUNCTION NAME: scen_GetPhase1GrowthColor** PURPOSE: scenario.phase1g_growth_color** AUTHOR: Keith Clarke** PROGRAMMER: Tommy E. Cathey of NESC (919)541-1500** CREATION DATE: 11/11/1999** DESCRIPTION:*****/int scen_GetPhase1GrowthColor (){ return scenario.phase1g_growth_color;}/*************************************************************************************************************************************************************** FUNCTION NAME: scen_GetPhase2GrowthColor** PURPOSE: return scenario.phase2g_growth_color** AUTHOR: Keith Clarke** PROGRAMMER: Tommy E. Cathey of NESC (919)541-1500** CREATION DATE: 11/11/1999** DESCRIPTION:*****/int scen_GetPhase2GrowthColor (){ return scenario.phase2g_growth_color;}/*************************************************************************************************************************************************************** FUNCTION NAME: scen_GetPhase3GrowthColor** PURPOSE: return scenario.phase3g_growth_color** AUTHOR: Keith Clarke** PROGRAMMER: Tommy E. Cathey of NESC (919)541-1500** CREATION DATE: 11/11/1999** DESCRIPTION:*****/int scen_GetPhase3GrowthColor (){ return scenario.phase3g_growth_color;}/*************************************************************************************************************************************************************** FUNCTION NAME: scen_GetPhase4GrowthColor** PURPOSE: return scenario.phase4g_growth_color** AUTHOR: Keith Clarke** PROGRAMMER: Tommy E. Cathey of NESC (919)541-1500** CREATION DATE: 11/11/1999** DESCRIPTION:*****/int scen_GetPhase4GrowthColor (){ return scenario.phase4g_growth_color;}/*************************************************************************************************************************************************************** FUNCTION NAME: scen_GetPhase5GrowthColor** PURPOSE: return scenario.phase5g_growth_color** AUTHOR: Keith Clarke** PROGRAMMER: Tommy E. Cathey of NESC (919)541-1500** CREATION DATE: 11/11/1999** DESCRIPTION:*****/int scen_GetPhase5GrowthColor (){ return scenario.phase5g_growth_color;}/*************************************************************************************************************************************************************** FUNCTION NAME: scen_init** PURPOSE: initialize scenario object** AUTHOR: Keith Clarke** PROGRAMMER: Tommy E. Cathey of NESC (919)541-1500** CREATION DATE: 11/11/1999** DESCRIPTION:*****/void scen_init (char *filename){ char func[] = "scen_init"; FUNC_INIT; scenario.deltatron_color_count = 0; if (glb_mype == 0) { scen_read_file (filename); }#ifdef MPI MPI_Bcast (&scenario, sizeof (scenario), MPI_BYTE, 0, MPI_COMM_WORLD);#endif wgrid_SetWGridCount (scenario.num_working_grids); scen_open_log (); FUNC_END;}/*************************************************************************************************************************************************************** FUNCTION NAME: scen_read_file** PURPOSE: read the scenario file** AUTHOR: Keith Clarke** PROGRAMMER: Tommy E. Cathey of NESC (919)541-1500** CREATION DATE: 11/11/1999** DESCRIPTION:*****/static void scen_read_file (char *filename){ char func[] = "scen_init"; FILE *fp; char line[SCEN_MAX_FILENAME_LEN]; char orig_line[SCEN_MAX_FILENAME_LEN]; char *keyword; char *object_ptr; int index; assert (filename != NULL); strcpy (scenario.filename, filename); FILE_OPEN (fp, scenario.filename, "r"); scenario.num_landuse_classes = 0; scenario.urban_data_file_count = 0; scenario.road_data_file_count = 0; scenario.landuse_data_file_count = 0; scenario.probability_color_count = 0; strcpy (scenario.whirlgif_binary, ""); while (fgets (line, SCEN_MAX_FILENAME_LEN, fp) != NULL) { strncpy (orig_line, line, strlen (line)); /* * * IGNORE LINES BEGINNING WITH # * */ if (strncmp (line, "#", 1)) { /* * * IGNORE TEXT TO RIGHT OF # AND BLANK LINES * */ strtok (line, "#"); util_trim (line); if (strlen (line) > 0) { keyword = strtok (line, "="); if (!strcmp (keyword, "INPUT_DIR")) { object_ptr = strtok (NULL, " \n"); util_trim (object_ptr); strcpy (scenario.input_dir, object_ptr); } else if (!strcmp (keyword, "OUTPUT_DIR")) { object_ptr = strtok (NULL, " \n"); util_trim (object_ptr); strcpy (scenario.output_dir, object_ptr); } else if (!strcmp (keyword, "WHIRLGIF_BINARY")) { object_ptr = strtok (NULL, " \n");
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?