int Main( int argc , char ** argv ) { int policy; int start; int elapsed; int quantum; int scr_sem; /* sid of screen semaphore */ int id1, id2, id3; /* ID of child process */ if (argc == 3) { if (!strcmp(argv[1], "rr")) { policy = SCHEDPOLICY_RR; } else if (!strcmp(argv[1], "mlf")) { policy = SCHEDPOLICY_MF; } else { Printf("usage: %s [rr|mlf] <quantum>\n", argv[0]); Exit(); } quantum = atoi(argv[2]); Set_Scheduling_Policy(policy, quantum); } else { Printf("usage: %s [rr|mlf] <quantum>\n", argv[0]); Exit(); } start = Get_Time(); scr_sem = Init_Semaphore ( "screen" , 1 ) ; P ( scr_sem ) ; Printf ("************* Start Workload Generator *********\n"); V ( scr_sem ) ; id1 = Spawn_Program ( "/c/long.exe" ) ; P ( scr_sem ) ; Printf ("Process Long has been created with ID = %d\n",id1); V ( scr_sem ) ; id2 = Spawn_Program ( "/c/ping.exe" ) ; P ( scr_sem ) ; Printf ("Process Ping has been created with ID = %d\n",id2); V ( scr_sem ) ; id3 = Spawn_Program ( "/c/pong.exe" ) ; P ( scr_sem ) ; Printf ("Process Pong has been created with ID = %d\n",id3); V ( scr_sem ) ; Wait(id1); Wait(id2); Wait(id3); elapsed = Get_Time() - start; Printf ("\nTests Completed at %d\n", elapsed) ; return 0; }
void Compute_NonBonded_Forces(reax_system *system, control_params *control, simulation_data *data, static_storage *workspace, list** lists, output_controls *out_control) { real t_start, t_elapsed; #ifdef TEST_ENERGY fprintf( out_control->evdw, "step: %d\n%6s%6s%12s%12s%12s\n", data->step, "atom1", "atom2", "r12", "evdw", "total" ); fprintf( out_control->ecou, "step: %d\n%6s%6s%12s%12s%12s%12s%12s\n", data->step, "atom1", "atom2", "r12", "q1", "q2", "ecou", "total" ); #endif t_start = Get_Time(); if (control->qeq) QEq(system, control, data, workspace, lists[FAR_NBRS], out_control); t_elapsed = Get_Timing_Info(t_start); data->timing.QEq += t_elapsed; #if defined(DEBUG_FOCUS) fprintf( stderr, "qeq - " ); #endif if (control->tabulate == 0) vdW_Coulomb_Energy(system, control, data, workspace, lists, out_control); else Tabulated_vdW_Coulomb_Energy(system, control, data, workspace, lists, out_control); #if defined(DEBUG_FOCUS) fprintf( stderr, "nonb forces - " ); #endif #ifdef TEST_FORCES Print_vdW_Coulomb_Forces( system, control, data, workspace, lists, out_control ); #endif }
void Set_Alarm_Time(uint8_t Sec) { uint32_t sec_time; RTC_AlarmCmd(RTC_Alarm_A, DISABLE); sec_time = Get_Time().Hour*3600 + Get_Time().Min*60 + Get_Time().Sec + Sec; RTC_AlarmStructure.RTC_AlarmTime.RTC_Hours = (sec_time / 3600) % 24; RTC_AlarmStructure.RTC_AlarmTime.RTC_Minutes = (sec_time % 3600) / 60; RTC_AlarmStructure.RTC_AlarmTime.RTC_Seconds = sec_time % 60; RTC_AlarmStructure.RTC_AlarmDateWeekDay = Get_Time().Day + (sec_time > 86400 ? 1 : 0); RTC_AlarmStructure.RTC_AlarmDateWeekDaySel = RTC_AlarmDateWeekDaySel_Date; RTC_AlarmStructure.RTC_AlarmMask = RTC_AlarmMask_None; RTC_SetAlarm(RTC_Format_BIN, RTC_Alarm_A, &RTC_AlarmStructure); RTC_ITConfig(RTC_IT_ALRA, ENABLE); RTC_AlarmCmd(RTC_Alarm_A, ENABLE); RTC_ClearFlag(RTC_FLAG_ALRAF); PWR_ClearFlag(PWR_FLAG_WU); }
/****************************************************************************** 函数名称:TimeModify 功能描述:要求输入时间,进行修改 参数描述: 参数名称: 输入/输出? 类型 描述 返 回 值:无 作 者 :许岩 日 期:2004-09-02 修改历史: 日期 修改人 修改描述 ------ --------- ------------- ******************************************************************************/ void TimeModify(void) { INT8U i = 0; INT8U input[50]; INT8U buf[50]; BUS_TIME ltime; for (;;) { EA_vCls(); Get_Time(<ime); EA_vDisp(1, 1, "当前时间:"); sprintf((void *)buf, "%02X%02X-%02X-%02X-%02X:%02X:%02X", ltime.century, ltime.year, ltime.month, ltime.day, ltime.hour, ltime.minute, ltime.second); EA_vDisp(2, 1, (void *)buf); EA_vDisp(3, 1, "请输入新的时间:"); (void)EA_ucClrKeyBuf(); strcpy((void *)input, ""); i = EA_ucGetInputStr(4, 1, 20, EM_BIG_FONT | EM_MODE_NUMBER | EM_ALIGN_LEFT | EM_SHOW_ORIGINALLY , 14, 14, 0, (void *)input); // sprintf(dbuf, "%s", input); // EA_vDisp(3, 1, dbuf); // sprintf(dbuf, "result:%02X", i); // EA_vDisp(4, 1, dbuf); if ( i == EM_ABOLISH ) return; if ( i != EM_SUCCESS ) continue; ltime.century = (ascii_to_hex(input[0]) << 4) | ascii_to_hex(input[1]); ltime.year = (ascii_to_hex(input[2]) << 4) | ascii_to_hex(input[3]); ltime.month = (ascii_to_hex(input[4]) << 4) | ascii_to_hex(input[5]); ltime.day = (ascii_to_hex(input[6]) << 4) | ascii_to_hex(input[7]); ltime.hour = (ascii_to_hex(input[8]) << 4) | ascii_to_hex(input[9]); ltime.minute = (ascii_to_hex(input[10]) << 4) | ascii_to_hex(input[11]); ltime.second = (ascii_to_hex(input[12]) << 4) | ascii_to_hex(input[13]); i = CheckTimeFormat(<ime); if ( i != ok ) { EA_vCls(); EA_vDisp(4, 1, "时间格式错误"); SleepMs(1500); // EA_vCls(); continue; } Modify_Time(<ime); EA_vCls(); EA_vDisp(4, 1, "时间修改成功"); SleepMs(1500); break; } }
int Main(int argc, char ** argv) { int i, j ; /* loop index */ int scr_sem; /* id of screen semaphore */ int now, start, elapsed; start = Get_Time(); scr_sem = Init_Semaphore ( "screen" , 1 ) ; /* register for screen use */ for (i=0; i < 200; i++) { for ( j=0 ; j < 10000 ; j++) ; now = Get_Time(); } elapsed = Get_Time() - start; P ( scr_sem ) ; Printf ("Process Long is done at time: %d\n", elapsed) ; V( scr_sem ); return 0; }
void Reset_Timing( reax_timing *rt ) { rt->total = Get_Time(); rt->comm = 0; rt->nbrs = 0; rt->init_forces = 0; rt->bonded = 0; rt->nonb = 0; rt->qEq = 0; rt->s_matvecs = 0; rt->t_matvecs = 0; }
/****************************************************************************** 函数名称:TimeFormatChk 功能描述:读时钟,看时钟格式是否正确 参数描述: 参数名称: 输入/输出? 类型 描述 返 回 值:ok(0)-自检成功 notok(0xFF)-自检失败 作 者 :许岩 日 期:2004-09-02 修改历史: 日期 修改人 修改描述 ------ --------- ------------- ******************************************************************************/ INT8U TimeFormatChk(void) { INT8U i = 0; BUS_TIME ltime; i = Get_Time(<ime); if ( i != ok ) { return notok; } i = CheckTimeFormat(<ime); return i; }
int Game_Location::Compare_Digits() { for (int i = 0; i < 3; i++) { if(hero_digit.Get_Digit() == digits[i]) { if (DROP::BAD == drops.Check_Type(i)) // если имелась хотя бы одна красная капля в трубе { // вы проиграли if (game_manager->isSoundOn == true) game_manager->Play_Sound("fail"); isDigitsSame = false; break; } if(DROP::GOLD == drops.Check_Type(i)) // если вам удалось "словить особую каплю" { // вы получаете 10 очков if (game_manager->isSoundOn == true) game_manager->Play_Sound("bonus"); gold_drops_amount++; for (int i = 0; i < 10; i++) { score.Add_Point(); } Set_Pile_Signal(i, sf::Color(0, 255, 34)); // труба вам об этом просигнализирует } if(DROP::NORMAL == drops.Check_Type(i)) // если же капля обычная { // получаете 1 очко if (game_manager->isSoundOn == true) game_manager->Play_Sound("same"); score.Add_Point(); Set_Pile_Signal(i, sf::Color(0, 255, 34)); // о чем вам скажет сигнал на трубе } isDigitsSame = true; digits.Change_Container_Digit(i); // если числа совпали и тип капли был не красный return i; // число мгновенно поменяется } else isDigitsSame = false; // в противном случае флаг будет установлен в 'ложно' и ... } if(!isDigitsSame) // ... вы проиграли { if (game_manager->isSoundOn == true) game_manager->Play_Sound("fail"); game_manager->result.Set_Score(score.Get_Score(), Get_Time(), Get_Gold_Poins()); game_manager->Set_Active_Location(Space::RESULTLOCATION); game_manager->previousLocation = &game_manager->game; return -1; } }
int Init_Simulation_Data( reax_system *system, control_params *control, simulation_data *data, char *msg ) { Reset_Simulation_Data( data, control->virial ); /* initialize the timer(s) */ if( system->my_rank == MASTER_NODE ) { data->timing.start = Get_Time( ); #if defined(LOG_PERFORMANCE) Reset_Timing( &data->timing ); #endif } //if( !control->restart ) data->step = data->prev_steps = 0; return SUCCESS; }
/***************************************************************** 函数原型:DisplayWelcomeMenu 功能描述:本函数为显示欢迎界面 参数描述:无 参数名称: 输入/输出? 类型 描述 ----------- ----------- ------ ------- 返 回 值:无 *****************************************************************/ void DisplayWelcomeMenu(void) { BUS_TIME ltime; INT8U buf[22]; EA_vCls(); EA_ucSetInverse(EM_lcd_INVOFF); EA_vDisp(1, 1, " 淄博市公共汽车公司 "); EA_vDisp(2, 1, " 手持POS加油机 "); Get_Time(<ime); sprintf((void *)buf, " %02X%02X-%02X-%02X %02X:%02X", ltime.century, ltime.year, ltime.month, ltime.day, ltime.hour, ltime.minute); EA_vDisplay(3, (void *)buf); if ( DevStat.record_number >= MAX_REC_NUM ) { EA_vDisp(3, 1, " 记录已满, 请上传 "); } EA_vDisp(4, 1, "F1设置 F2上传 F3登陆"); return ; }
Dtime Walk (void) { return (Get_Time (walk)); }
int main( int argc, char** argv ) { int i, total, mode, base, rendered_glyphs; char filename[128 + 4]; char alt_filename[128 + 4]; char* execname; long t, t0, tz0; execname = argv[0]; gray_render = 0; visual = 0; while ( argc > 1 && argv[1][0] == '-' ) { switch ( argv[1][1] ) { case 'g': gray_render = 1; break; case 'v': visual = 1; break; default: Panic( "Unknown argument '%s'!\n", argv[1] ); } argc--; argv++; } if ( argc != 2 ) { fprintf( stderr, "fttimer: simple performance timer -- part of the FreeType project\n" ); fprintf( stderr,"-----------------------------------------------------------------\n\n" ); fprintf( stderr,"Usage: %s [-g] [-v] fontname[.ttf|.ttc]\n\n", execname ); fprintf( stderr," where '-g' asks for gray-levels rendering\n" ); fprintf( stderr," '-v' displays while rendering (slower)\n" ); exit( EXIT_FAILURE ); } i = strlen( argv[1] ); while ( i > 0 && argv[1][i] != '\\' ) { if ( argv[1][i] == '.' ) i = 0; i--; } filename[128] = '\0'; alt_filename[128] = '\0'; strncpy( filename, argv[1], 128 ); strncpy( alt_filename, argv[1], 128 ); if ( i >= 0 ) { strncpy( filename + strlen( filename ), ".ttf", 4 ); strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 ); } /* Initialize engine */ if ( (error = TT_Init_FreeType( &engine )) ) Panic( "Error while initializing engine, code = 0x%x.\n", error ); /* Load face */ error = TT_Open_Face( engine, filename, &face ); if ( error == TT_Err_Could_Not_Open_File ) { strcpy( filename, alt_filename ); error = TT_Open_Face( engine, alt_filename, &face ); } if ( error == TT_Err_Could_Not_Open_File ) Panic( "Could not find/open %s.\n", filename ); else if ( error ) Panic( "Error while opening %s, error code = 0x%x.\n", filename, error ); /* get face properties and allocate preload arrays */ TT_Get_Face_Properties( face, &properties ); num_glyphs = properties.num_Glyphs; tab_glyphs = MAX_GLYPHS; if ( tab_glyphs > num_glyphs ) tab_glyphs = num_glyphs; /* create glyph */ error = TT_New_Glyph( face, &glyph ); if ( error ) Panic( "Could not create glyph container.\n" ); /* create instance */ error = TT_New_Instance( face, &instance ); if ( error ) Panic( "Could not create instance for %s.\n", filename ); error = TT_Set_Instance_CharSize( instance, 400*64 ); if ( error ) Panic( "Could not reset instance for %s.\n", filename ); if ( gray_render ) mode = Graphics_Mode_Gray; else mode = Graphics_Mode_Mono; if ( visual ) { if ( !SetGraphScreen( mode ) ) Panic( "Could not set graphics mode.\n" ); TT_Set_Raster_Gray_Palette( engine, gray_palette ); } else { /* This is the default bitmap size used */ vio_Width = 640; vio_Height = 450; } Init_Engine(); Num = 0; Fail = 0; total = num_glyphs; base = 0; rendered_glyphs = 0; t0 = 0; /* Initial time */ tz0 = Get_Time(); while ( total > 0 ) { /* First, preload 'tab_glyphs' in memory */ cur_glyph = 0; cur_point = 0; cur_contour = 0; printf( "loading %d glyphs", tab_glyphs ); for ( Num = 0; Num < tab_glyphs; Num++ ) { error = LoadTrueTypeChar( base + Num ); if ( error ) Fail++; total--; } base += tab_glyphs; if ( tab_glyphs > total ) tab_glyphs = total; printf( ", rendering... " ); /* Now, render the loaded glyphs */ t = Get_Time(); for ( Num = 0; Num < cur_glyph; Num++ ) { if ( (error = ConvertRaster( Num )) ) Fail++; else { rendered_glyphs ++; if ( visual ) { sprintf( Header, "Glyph: %5d", Num ); Display_Bitmap_On_Screen( Bit.bitmap, Bit.rows, Bit.cols ); Clear_Buffer(); } } } t = Get_Time() - t; if ( t < 0 ) t += 100L * 60 * 60; printf( " = %f s\n", (double)t / 1000 ); t0 += t; /* Now free all loaded outlines */ for ( Num = 0; Num < cur_glyph; Num++ ) TT_Done_Outline( &outlines[Num] ); } tz0 = Get_Time() - tz0; if ( visual ) RestoreScreen(); TT_Close_Face( face ); printf( "\n" ); printf( "rendered glyphs = %d\n", rendered_glyphs ); printf( "render time = %f s\n", (double)t0 / 1000 ); printf( "fails = %d\n", Fail ); printf( "average glyphs/s = %f\n", (double)rendered_glyphs / t0 * 1000 ); printf( "total timing = %f s\n", (double)tz0 / 1000 ); printf( "Fails = %d\n", Fail ); TT_Done_FreeType( engine ); exit( EXIT_SUCCESS ); /* for safety reasons */ return 0; /* never reached */ }
Dtime Time (void) { return (Get_Time (time)); }
void Compute_Forces( reax_system *system, control_params *control, simulation_data *data, storage *workspace, reax_list **lists, output_controls *out_control, mpi_datatypes *mpi_data ) { MPI_Comm comm; int qeq_flag; #if defined(LOG_PERFORMANCE) real t_start = 0; //MPI_Barrier( mpi_data->world ); if( system->my_rank == MASTER_NODE ) t_start = Get_Time( ); #endif comm = mpi_data->world; /********* init forces ************/ #if defined(PURE_REAX) if( control->qeq_freq && (data->step-data->prev_steps)%control->qeq_freq==0 ) qeq_flag = 1; else qeq_flag = 0; #elif defined(LAMMPS_REAX) qeq_flag = 0; #endif if( qeq_flag ) Init_Forces( system, control, data, workspace, lists, out_control, comm ); else Init_Forces_noQEq( system, control, data, workspace, lists, out_control, comm ); #if defined(LOG_PERFORMANCE) //MPI_Barrier( mpi_data->world ); if( system->my_rank == MASTER_NODE ) Update_Timing_Info( &t_start, &(data->timing.init_forces) ); #endif /********* bonded interactions ************/ Compute_Bonded_Forces( system, control, data, workspace, lists, out_control, mpi_data->world ); #if defined(LOG_PERFORMANCE) //MPI_Barrier( mpi_data->world ); if( system->my_rank == MASTER_NODE ) Update_Timing_Info( &t_start, &(data->timing.bonded) ); #endif #if defined(DEBUG_FOCUS) fprintf( stderr, "p%d @ step%d: completed bonded\n", system->my_rank, data->step ); MPI_Barrier( mpi_data->world ); #endif /**************** qeq ************************/ #if defined(PURE_REAX) if( qeq_flag ) QEq( system, control, data, workspace, out_control, mpi_data ); #if defined(LOG_PERFORMANCE) //MPI_Barrier( mpi_data->world ); if( system->my_rank == MASTER_NODE ) Update_Timing_Info( &t_start, &(data->timing.qEq) ); #endif #if defined(DEBUG_FOCUS) fprintf(stderr, "p%d @ step%d: qeq completed\n", system->my_rank, data->step); MPI_Barrier( mpi_data->world ); #endif #endif //PURE_REAX /********* nonbonded interactions ************/ Compute_NonBonded_Forces( system, control, data, workspace, lists, out_control, mpi_data->world ); #if defined(LOG_PERFORMANCE) //MPI_Barrier( mpi_data->world ); if( system->my_rank == MASTER_NODE ) Update_Timing_Info( &t_start, &(data->timing.nonb) ); #endif #if defined(DEBUG_FOCUS) fprintf( stderr, "p%d @ step%d: nonbonded forces completed\n", system->my_rank, data->step ); MPI_Barrier( mpi_data->world ); #endif /*********** total force ***************/ Compute_Total_Force( system, control, data, workspace, lists, mpi_data ); #if defined(LOG_PERFORMANCE) //MPI_Barrier( mpi_data->world ); if( system->my_rank == MASTER_NODE ) Update_Timing_Info( &t_start, &(data->timing.bonded) ); #endif #if defined(DEBUG_FOCUS) fprintf( stderr, "p%d @ step%d: total forces computed\n", system->my_rank, data->step ); //Print_Total_Force( system, data, workspace ); MPI_Barrier( mpi_data->world ); #endif #if defined(TEST_FORCES) Print_Force_Files( system, control, data, workspace, lists, out_control, mpi_data ); #endif }
void Compute_Forces(reax_system *system, control_params *control, simulation_data *data, static_storage *workspace, list** lists, output_controls *out_control) { real t_start, t_elapsed; t_start = Get_Time(); if (!control->tabulate) Init_Forces(system, control, data, workspace, lists, out_control); else Init_Forces_Tab(system, control, data, workspace, lists, out_control); t_elapsed = Get_Timing_Info(t_start); data->timing.init_forces += t_elapsed; #if defined(DEBUG_FOCUS) fprintf( stderr, "init_forces - "); #endif t_start = Get_Time(); Compute_Bonded_Forces(system, control, data, workspace, lists, out_control); t_elapsed = Get_Timing_Info(t_start); data->timing.bonded += t_elapsed; #if defined(DEBUG_FOCUS) fprintf( stderr, "bonded_forces - "); #endif t_start = Get_Time(); Compute_NonBonded_Forces(system, control, data, workspace, lists, out_control); t_elapsed = Get_Timing_Info(t_start); data->timing.nonb += t_elapsed; #if defined(DEBUG_FOCUS) fprintf( stderr, "nonbondeds - "); #endif Compute_Total_Force(system, control, data, workspace, lists); // implement amd simulation if (control->amd) { Compute_AMD_Force(system, control, data, workspace, lists); } if (control->bboost == 1) Compute_Bond_Boost_Force(system, control, data, workspace, lists, out_control); else if (control->bboost == 2) Compute_Bond_Boost_Force_All(system, control, data, workspace, lists, out_control); else if (control->bboost == 3) Compute_Bond_Boost_Force_All_Couple(system, control, data, workspace, lists, out_control); //Print_Total_Force( system, control, data, workspace, lists, out_control ); //Bias Potential //Bias_Spring(system, control, data, workspace, lists, out_control); if (control->bias_con_de) Bias_COn_Decompose(system, control, data, workspace, lists, out_control); else if (control->bias_con_com) Bias_COn_Combine(system, control, data, workspace, lists, out_control); if (control->bias_lj126 == 1) Bias_LJ_126(system, control, data, workspace, lists, out_control); if (control->bias_charge == 1) Bias_Charge(system, control, data, workspace, lists, out_control); #if defined(DEBUG_FOCUS) fprintf( stderr, "totalforces - "); //Print_Total_Force( system, control, data, workspace, lists, out_control ); #endif #ifdef TEST_FORCES Print_Total_Force( system, control, data, workspace, lists, out_control ); Compare_Total_Forces( system, control, data, workspace, lists, out_control ); #endif #if defined(DEBUG_FOCUS) fprintf( stderr, "forces - "); #endif }
int main(int argc, char *argv[]) { int x; time_t the_time; struct tm *tm_ptr; struct tm tm_struct; unsigned char TimeBuffer[8]; char * ctime_result; //this works here! const char days[7][4] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; tm_ptr = &tm_struct; //get Dallas clock port ready Setup_1302_Port(); if (argc > 1) { if (argc == 2) { if (!strcmp(argv[1], "--sys")) { //we want to set the Linux OS system time time from Dallas RTC Chip Get_Time(&TimeBuffer[0]); printf("Setting Linux Clock from Dallas DS1302 RTC: "); //tm_year is # of years since 1900, so assume 00-98 is 2000-2098 tm_ptr->tm_year = ((TimeBuffer[6]>>4) * 10) + (TimeBuffer[6]& 0xf); if (tm_ptr->tm_year < 99) tm_ptr->tm_year = tm_ptr->tm_year+100; //tm_mon: Jan = 0, TimeBuffer Jan = 1 tm_ptr->tm_mon = ((TimeBuffer[4]>>4) * 10) + (TimeBuffer[4]& 0xf)-1; tm_ptr->tm_mday = ((TimeBuffer[3]>>4) * 10) + (TimeBuffer[3]& 0xf); tm_ptr->tm_hour =(((TimeBuffer[2]&0x30)>>4) * 10) + (TimeBuffer[2]& 0xf); tm_ptr->tm_min = ((TimeBuffer[1]>>4) * 10) + (TimeBuffer[1]& 0xf); tm_ptr->tm_sec = ((TimeBuffer[0]>>4) * 10) + (TimeBuffer[0]& 0xf); the_time = mktime(tm_ptr); stime(&the_time); //# of sec in epoch printf("%s",asctime(tm_ptr)); //tm_tm_mon: Jan = 0 //printf("date: %s %02i/%02i/%02i\n",&days[TimeBuffer[5]-1][0], // tm_ptr->tm_year, tm_ptr->tm_mon+1, tm_ptr->tm_mday); //printf("time: %02i:%02i:%02i\n", tm_ptr->tm_hour, tm_ptr->tm_min, tm_ptr->tm_sec); return(0); //Ok } else { if (!strcmp(argv[1], "--stop")) { Lock_1302(); //stop the clock, go to low power mode printf("Dallas DS1302 RTC Stopped! RTC Time is now invalid.\n"); return(0); } else { //printf("Illegal arguments.\n"); //printf("Usage: clock [--sys] | [--set YY/MM/DD HH:MM]\n"); //printf("YY 00-98 = 20xx, Use 24Hr Format\n"); error_exit("Illegal arguments.\n"); //return(1); } } } //end if 2 args
Dtime Depart (void) { return (Get_Time (depart)); }
Dtime Activity (void) { return (Get_Time (activity)); }
Dtime Arrive (void) { return (Get_Time (arrive)); }
Dtime Leg_Time (void) { return (Get_Time (leg_time)); }
Dtime End (void) { return (Get_Time (end)); }
Dtime Wait (void) { return (Get_Time (wait)); }
/***************************************************************** 函数原型:main() 功能描述:主函数 参数描述: 返回值: 无 作 者: 许岩/刘及华 日 期: 2012-11-24 修改历史: 日期 修改人 修改描述 ------ --------- ------------- *****************************************************************/ int main(void) { INT8U ret = 0; char mainflag = 1; INT8S buf[30]; uchar uckey; uint uikey; BUS_TIME ltime; (void)EA_ucSetStopFlag( EM_DISABLE_STOP ); //不允许系统进入睡眠状态; reboot: ret = System_Init(); //系统初始化,包括PSAM,参数表,GPRS初始化 if( ret != ok ) { lcddisperr("系统初始化失败!"); goto reboot; } Beep(1000); for ( ;; ) { Get_Time(<ime); sprintf((void *)buf, " %02X%02X-%02X-%02X %02X:%02X", ltime.century, ltime.year, ltime.month, ltime.day, ltime.hour, ltime.minute); // EA_vTextOut(0, 0, EM_key_FONT8X16, 0, 1, 1, (char *)buf); EA_vDisplay(3, (void *)buf); if( mainflag == 1 ) { DisplayWelcomeMenu(); mainflag = 0; } uckey = EA_ucKBHit(); if(uckey == EM_key_HIT) //有按键 { uikey = EA_uiInkey(0); //读取按键键值 switch ( uikey ) { case EM_key_EXIT: //关机 { mainflag = 1; goto shutdown; break; } case EM_key_F3: { Login(); //登录界面 mainflag = 1; break; } case EM_key_F1: { Parm_Setting(); //参数配置 mainflag = 1; break; } case EM_key_1: { GPRS_TEST(); //无线连接测试 mainflag = 1; break; } case EM_key_F2: { // QUERY_NOTE_RECORD(); Gprs_Upload_data(); //数据上传 mainflag = 1; break; } default: break; } } } shutdown: Power_Down(); }
Dtime Duration (void) { return (Get_Time (duration)); }
Dtime Drive (void) { return (Get_Time (drive)); }
/************************ initialize simulation data ************************/ int Init_Simulation_Data( reax_system *system, control_params *control, simulation_data *data, mpi_datatypes *mpi_data, char *msg ) { Reset_Simulation_Data( data, control->virial ); if( !control->restart ) data->step = data->prev_steps = 0; Compute_Total_Mass( system, data, mpi_data->comm_mesh3D ); Compute_Center_of_Mass( system, data, mpi_data, mpi_data->comm_mesh3D ); Compute_Kinetic_Energy( system, data, mpi_data->comm_mesh3D ); switch( control->ensemble ){ case NVE: data->N_f = 3 * system->bigN; Evolve = Velocity_Verlet_NVE; break; case bNVT: data->N_f = 3 * system->bigN + 1; Evolve = Velocity_Verlet_Berendsen_NVT; break; case nhNVT: fprintf( stderr, "WARNING: Nose-Hoover NVT is still under testing.\n" ); //return FAILURE; data->N_f = 3 * system->bigN + 1; Evolve = Velocity_Verlet_Nose_Hoover_NVT_Klein; if( !control->restart || (control->restart && control->random_vel) ) { data->therm.G_xi = control->Tau_T * (2.0 * data->sys_en.e_kin - data->N_f * K_B * control->T ); data->therm.v_xi = data->therm.G_xi * control->dt; data->therm.v_xi_old = 0; data->therm.xi = 0; } break; case sNPT: /* Semi-Isotropic NPT */ data->N_f = 3 * system->bigN + 4; Evolve = Velocity_Verlet_Berendsen_NPT; if( !control->restart ) Reset_Pressures( data ); break; case iNPT: /* Isotropic NPT */ data->N_f = 3 * system->bigN + 2; Evolve = Velocity_Verlet_Berendsen_NPT; if( !control->restart ) Reset_Pressures( data ); break; case NPT: /* Anisotropic NPT */ strcpy( msg, "init_simulation_data: option not yet implemented" ); return FAILURE; data->N_f = 3 * system->bigN + 9; Evolve = Velocity_Verlet_Berendsen_NPT; /*if( !control->restart ) { data->therm.G_xi = control->Tau_T * (2.0 * data->my_en.e_Kin - data->N_f * K_B * control->T ); data->therm.v_xi = data->therm.G_xi * control->dt; data->iso_bar.eps = 0.33333 * log(system->box.volume); data->inv_W = 1.0 / ( data->N_f * K_B * control->T * SQR(control->Tau_P) ); Compute_Pressure( system, control, data, out_control ); }*/ break; default: strcpy( msg, "init_simulation_data: ensemble not recognized" ); return FAILURE; } /* initialize the timer(s) */ MPI_Barrier( mpi_data->world ); // wait for everyone to come here if( system->my_rank == MASTER_NODE ) { data->timing.start = Get_Time( ); #if defined(LOG_PERFORMANCE) Reset_Timing( &data->timing ); #endif } #if defined(DEBUG) fprintf( stderr, "data->N_f: %8.3f\n", data->N_f ); #endif return SUCCESS; }
Dtime Transit (void) { return (Get_Time (transit)); }
Dtime Schedule (void) { return (Get_Time (schedule)); }
Dtime Other (void) { return (Get_Time (other)); }
Dtime Start (void) { return (Get_Time (start)); }