int main(int argc, char * argv[]) { int i,j; #ifdef _CIVL // elaborating nx, ny, NPROCSX and NPROCSY... //$elaborate(NPROCSY); //$elaborate(nx); //$elaborate(ny); //$elaborate(NPROCSX); #endif MPI_Init(&argc, &argv); MPI_Comm_rank(comm, &rank); MPI_Comm_size(comm, &nprocs); initialization(argc, argv); initData(); for (i=0; i<nsteps; i++) { if (nxl != 0 && nyl != 0) { if (i%wstep == 0) write_frame(i); exchange(); update(); } } for (i=0; i<nyl+2; i++) { free(u_curr[i]); free(u_next[i]); } free(u_curr); free(u_next); if (rank == 0) free(recvbuf); return 0; }
//----------------------------------------------------------------------------- int main(int argNumber, char **arguments) { initialization(argNumber, arguments); getPlatformDevice(&PLATFORM_ID, &DEVICE_ID); platform = new Platform(PLATFORM_ID); Context *context = platform->getContext(); Device device = platform->getDevice(DEVICE_ID); setNDRangeSizes(); std::cout << "Device name: " << device.getName() << "\n"; hostMemoryAlloc(); deviceMemoryAlloc(); std::string kernelFile = KERNEL_DIR + kernelFileName; Program program(context, std::string(kernelFile.c_str())); Queue queue(*context, device, Queue::EnableProfiling); enqueWriteCommands(queue); if (!program.build(device)) { std::cout << "Error building the program: " << "\n"; std::cout << program.getBuildLog(device) << "\n"; return 1; } kernel = program.createKernel(kernelName.c_str()); setKernelArguments(); run(queue); enqueReadCommands(queue); verify(); freeMemory(); return 0; }
int main(void) { initialization(); forward(); countfunc(); }
int main() { int n, g_x, g_y; int flag = 0; while(scanf("%d%d%d", &n, &g_x, &g_y) && (n || g_x || g_y)){ flag = 0; initialization(board); char _type[100] = {0}; int x[100] = {0}, y[100] = {0}; int i = 0; while(n--){ /* char _type; int x, y;*/ getchar(); scanf("%c%d%d", &_type[i], &x[i], &y[i]); board[x[i] + 1][y[i] + 1] = 100; i++; } n = i; for(int i = 0; i < n; i++){ switch(_type[i]){ case 'G':flag = red_gereral(board, x[i], y[i], g_y); break; case 'R':red_chariot(board, x[i], y[i]); break; case 'H':red_horse(board, x[i], y[i]); break; case 'C':red_cannon(board, x[i], y[i]); break; } } if(is_checkmate(board, g_x, g_y) && !flag){ printf("YES\n"); } else printf("NO\n"); } return 0; }
int main() { // Initialization Sequence if (!get_flag(FLAG_ENUM)) { initialization(); mbus_sleep_all(); while(1); } // Display cycle number for debugging purpose arb_debug_reg(0x20, cyc_num); // Enable IRQs irq_handled = 0; *NVIC_ISER = (0x1 << IRQ_GOCEP) | (0x1 << IRQ_WAKEUP); // Wait until the IRQ has been handled, then go to sleep while (1) { if (irq_handled) { cyc_num++; mbus_sleep_all(); break; } } //Never Quit (should not come here.) while(1){ arb_debug_reg(0xFF, 0xDEADBEEF); asm("nop;"); } return 1; }
int InstallationParser::parse() { if (initialization() == 1) // Problem during the initialisation. return(1); SAXParser* parser = new SAXParser(); parser->setDoValidation(true); parser->setDoNamespaces(true); InstallationSAXHandler* handler = new InstallationSAXHandler(); parser->setDocumentHandler(handler); parser->setErrorHandler(handler); try { const char* file = xmlFile.c_str(); // Name of the descriptor file in the current directory. parser->parse(file); // Parsing procedure. handler->get_pkgname(pkgname); // Result of the parsing. handler->get_pkgUUID(pkgUUID); handler->get_implementations(codefiles); // Result of the parsing. } catch (const XMLException& toCatch) { // File not found for the parsing. std::cerr << "\nFile not found : '" << xmlFile << "'\n"; std::cerr << "Exception message is : \n" << toCatch.getMessage() << "\n"; return(4); } int err = handler->get_error(); // The error codes are got from the handler object. delete(handler); // Object deleted. delete(parser); // Object deleted. return(err); // 0, 2 or 3 is returned. }
int main() { // Enable IRQ clear_all_pend_irq(); enable_all_irq(); // Initialization Sequence if (enumerated != 0xDEADBEEF) { initialization(); } // Send an MBus message mbus_write_message32 (0xEE, cyc_num); cyc_num++; // Reset XOT Timer *XOT_RESET = 1; // Send an MBus sleep message mbus_sleep_all(); while(1){ //Never Quit (should not come here.) asm("nop;"); } return 1; }
int* kPartitioning(double ** comm, int n, int k, int * constraints, int nb_constraints, int greedy_trials) { /* ##### declarations & allocations ##### */ PriorityQueue Qpart, *Q = NULL, *Qinst = NULL; double **D = NULL; int deficit, surplus, *part = NULL; int real_n = n-nb_constraints; part = build_p_vector(comm, n, k, greedy_trials, constraints, nb_constraints); memory_allocation(&Q, &Qinst, &D, real_n, k); /* ##### Initialization ##### */ initialization(part, comm, &Qpart, Q, Qinst, D, real_n, k, &deficit, &surplus); /* ##### Main loop ##### */ while((nextGain(&Qpart, Q, &deficit, &surplus))>0) { algo(part, comm, &Qpart, Q, Qinst, D, real_n, &deficit, &surplus); } /* ##### Balancing the partition ##### */ balancing(real_n, deficit, surplus, D, part); /*if partition isn't balanced we have to make one last move*/ /* ##### Memory deallocation ##### */ destruction(&Qpart, Q, Qinst, D, real_n, k); return part; }
VPiano::VPiano( QWidget * parent, Qt::WindowFlags flags ) : QMainWindow(parent, flags), m_midiout(0), m_midiin(0), m_currentOut(-1), m_currentIn(-1), m_inputActive(false), m_midiThru(false), m_initialized(false), m_dlgAbout(NULL), m_dlgPreferences(NULL), m_dlgMidiSetup(NULL), m_dlgKeyMap(NULL), m_dlgExtra(NULL), m_dlgRiffImport(NULL) { ui.setupUi(this); ui.actionStatusBar->setChecked(false); connect(ui.actionAbout, SIGNAL(triggered()), SLOT(slotAbout())); connect(ui.actionAbout_Qt, SIGNAL(triggered()), SLOT(slotAboutQt())); connect(ui.actionConnections, SIGNAL(triggered()), SLOT(slotConnections())); connect(ui.actionPreferences, SIGNAL(triggered()), SLOT(slotPreferences())); connect(ui.actionEditKM, SIGNAL(triggered()), SLOT(slotEditKeyboardMap())); connect(ui.actionContents, SIGNAL(triggered()), SLOT(slotHelpContents())); connect(ui.actionWebSite, SIGNAL(triggered()), SLOT(slotOpenWebSite())); connect(ui.actionImportSoundFont, SIGNAL(triggered()), SLOT(slotImportSF())); connect(ui.actionEditExtraControls, SIGNAL(triggered()), SLOT(slotEditExtraControls())); connect(ui.actionNoteNames, SIGNAL(triggered()), SLOT(slotShowNoteNames())); ui.pianokeybd->setPianoHandler(this); initialization(); }
ControllerData::ControllerData(ControllerDataConfig arg) : //controllerDataConfigObj(arg) fillFirst(false) { initialization(arg); }
//Konstruktor mit Parametern Player::Player( int id, QString name, TypePlayer type, ColorPawn color ) { this->id = id; setName( name ); setType( type ); setColor( color ); initialization(); }
/*main function*/ int main(void) { initialization(); while (1) { } }
SuffixTree::SuffixTree(int left, int right, std::vector <int> &buffer) { for (int i = left; i <= right; i++) { line.push_back(buffer[i]); } initialization(); buildSuffixTree(); }
//Default-Konstruktor Player::Player( int id ) { this->id = id; name = "Player 1"; type = Local; color = White; initialization(); }
Layer::Layer(int prevLayerSize, int layerSize) { myPrevSize = prevLayerSize+1; mySize = layerSize; myWeights = new double * [myPrevSize]; for (int i = 0; i < myPrevSize; ++i) { myWeights[i] = new double [mySize]; } initialization(); }
////////////////////////////////////////////////////////////////////////// ///public ////////////////////////////////////////////////////////////////////////// void PointGridIndex::createIndex(list<GeoPoint*>& pts, Area* area, int gridWidth) { this->area = area; this->gridWidth = gridWidth; initialization(); for (list<GeoPoint*>::iterator ptIter = pts.begin(); ptIter != pts.end(); ptIter++) { insertOnePt(*ptIter); } }
CNN1DComponent::CNN1DComponent(size_t kernelSize, size_t stride, size_t featureMapNum, size_t num, size_t visualRow, size_t scheme) { this->kernelSize = kernelSize; this->stride = stride; this->featureMapNum = featureMapNum; this->visualRow = visualRow; initialization(scheme); }
int main( int argc, char* args[] ) { int user_input; sizeX = sizeX_predef; sizeY = sizeY_predef; /* Asks user for window size. */ // printf("Please give the dimension of the X axis: \n"); // scanf("%d", &sizeX); // printf("Please give the dimension of the Y axis: \n"); // scanf("%d", &sizeY); if (sizeX > sizeY) { scaleX = (double) sizeX / sizeY; scaleY = 1; } else if (sizeX < sizeY) { scaleX = 1; scaleY = (double) sizeY / sizeX; } else { scaleX = 1; scaleY = 1; } /* Loops until the user makes a valid choice */ while(1) { printf("Please press 1 to see one set, or 2 to zoom in continusouly. Press 0 to exit.\n"); scanf("%d", &user_input); if (user_input == 1) { initialization(user_input); break; } else if (user_input == 2) { initialization(user_input); break; } else if (user_input == 0) { printf("Exiting...\n"); break; } else { printf("Invalid choice, please try again.\n"); } } return 0; }
void KinectV2Camera::run() { if(!initOk) { perror("GVDEVICE KINECT V2 CAMERA: Can't start because error during initialitation."); return; } emit initialization(); exec(); }
sync_network::sync_network(const unsigned int size, const double weight_factor, const double frequency_factor, const conn_type connection_type, const size_t height, const size_t width, const initial_type initial_phases) : network(size, connection_type, height, width), m_oscillators(size, sync_oscillator()) { initialization(weight_factor, frequency_factor, initial_phases); }
/*Main Function*/ int main(int argc,char* argv[]) { struct stackElement rootstackElement; int count = 0; FILE *fp; char* filepath; char temp[128]={0}; if(argc < 2) { usage(); return -1; } if(argc == 3) { threshold = atoi(argv[1]); filepath = argv[2]; } if((ROOT = initialization()) == NULL) { cout<<"initialize the Trie error!\n"; return -1; } if((fp = fopen(filepath,"r"))== NULL) { cout<<"can't not find file\n"; return -1; } while(fgets(temp,128,fp) != NULL) //construct a new Trie { count++; temp[strlen(temp)-1]='\0'; insert(temp,strlen(temp),count); memset(temp,0,sizeof(temp)); } cout<<"Trie is Inserted "<< count <<" Words!\n"; /*Initialize the ROOT */ rootstackElement.ptr = ROOT; rootstackElement.activeNode.insert(pair<struct Node*,int>(ROOT,0)); ROOT->bVisited = true; TrieStack.push(rootstackElement); TravseWithPreOrder(ROOT); return 0; }
WinMain_Menu::WinMain_Menu(QWidget *parent) : QWidget(parent) , p_musicListButton(NULL), p_voiceButton(NULL), p_playSequnceButton(NULL) , p_closeButton(NULL), p_nextButton(NULL), p_preButton(NULL), p_stopButton(NULL) , p_imageWidget(NULL), p_wordWidget(NULL), p_soundSpectrum(NULL), p_listWidget(NULL) , p_songInfoLabel(NULL), p_groupButton(NULL), p_titleLayout(NULL) , p_bottomLayout(NULL), p_mainLayout(NULL), p_stackWidget(NULL) { initialization(); windowLayout(); setMyStyleSheet(); loadImage(); }
void mmEM::training(param myParam) { vector_2str wordX; vector_2str wordY; bool stillTrain = true; // reading file // readFileXY(myParam, myParam.inputFilename, &wordX, &wordY); // initialization // cout << "Initialization ... "; initialization(myParam, wordX, wordY); // maximization // cout << "Maximization ... " << endl; maximization(myParam); cout << endl; int atIter = 0; // still training // while (stillTrain) { atIter++; cout << "Iteration " << atIter << endl; // for each x and y pair // cout << "Expectation ... " ; for (int i = 0; i < wordX.size(); i++) { // expectation // expectation(myParam, wordX[i], wordY[i]); } cout << "Maximization ... "; long double totalChange = maximization(myParam); cout << "Total probability change = " << totalChange << endl; // stop by the probability change condition // if ((totalChange <= myParam.cutOff) && (myParam.cutOff < 1)) { stillTrain = false; } // stop by the number of iteration condition // if ((myParam.cutOff >= 1) && (atIter >= myParam.cutOff)) { stillTrain = false; } } cout << endl; }
void draw() { if (play_mode == false) { draw_Title(); if (keyboard.checkKey(KEY_INPUT_SPACE) == 1) { play_mode = true; } } else { if (over_flag == false) { SetUseZBuffer3D(TRUE); SetWriteZBuffer3D(TRUE); setCamera(); //draw_Planet(); draw_Dust(); draw_Player_shot(); draw_Enemy_shot(); draw_Player(); draw_Enemy(); draw_Effect(); draw_Player_HP(); if (clear_flag == true) { draw_GameClear(); if (keyboard.checkKey(KEY_INPUT_SPACE) == 1) { play_mode = true; initialization(); } } } else { draw_GameOver(); if (keyboard.checkKey(KEY_INPUT_SPACE) == 1) { play_mode = true; initialization(); } } } }
Soma::Soma(QWidget *parent) : QDialog(parent) { setModal(true); QVBoxLayout * mainLayout = createSomaBoxLayout(); initialization(); connect(accErrorCheckBox, SIGNAL(stateChanged(int)), this, SLOT(accErrorAvaliable())); connect(saveButton, SIGNAL(clicked()), this, SLOT(saveSettings())); setLayout(mainLayout); setWindowTitle(tr("SOMA Settings")); }
//removes all the nodes in the list void removeAll(){ if(size != 0){ Node<Type>* curr = head; Node<Type>* prev = head; while(size > 1){ curr = curr->getNext(); head = curr; delete(prev); prev = curr; size--; } delete curr; initialization(); } }
int main(int argc , char *argv[]) { /***********************************************************************************/ /* LOCAL VARIABLES */ /***********************************************************************************/ //Store pthread ID pthread_t tid; //Store threads errors int err; int port; //Check of input arguments if(argc !=3) { printf("\nUsage: argv[0] -p [port]\n"); exit(-1); } //Initialize initialization(); //Retrieve input parameters port=atoi(argv[2]); printf("--------------------------------------\n"); printf("\nStarting File manager on port:%d ....\n" , port); printf("--------------------------------------\n"); // SIGINT is signal name create when Ctrl+c will pressed signal(SIGINT,signal_handler); //Handle segmentation corrupt signal(SIGSEGV, signal_handler); //Create a thread for the bind. if(err=pthread_create(&tid , NULL ,(void *) &bind_thread , (void *)(intptr_t)port)) { perror2("pthread_create", err); exit(1); } //Wait until all threads to finish. Normally Bind thread //is always running pthread_join(tid , (void *) 0); return 0; }//Main Function
int compress_frame(void *data, void *jpeg_data, struct lavcData *lavc_data, VidBuff *proc_buff) { struct JPEG_ENCODER_STRUCTURE **jpeg_struct = (struct JPEG_ENCODER_STRUCTURE **) jpeg_data; BYTE *prgb =NULL; struct ALL_DATA *all_data = (struct ALL_DATA *) data; struct GLOBAL *global = all_data->global; struct VideoFormatData *videoF = all_data->videoF; long framesize = 0; int jpeg_size = 0; int ret = 0; videoF->vpts = proc_buff->time_stamp; switch (global->VidCodec) { case CODEC_MJPEG: /*MJPG*/ /* save MJPG frame */ if((global->Frame_Flags==0) && (global->format==V4L2_PIX_FMT_MJPEG)) { ret = write_video_data (all_data, proc_buff->frame, proc_buff->bytes_used); } else { /* use built in encoder */ if (!global->jpeg) { global->jpeg = g_new0(BYTE, ((global->width)*(global->height))>>1); } if(!(*jpeg_struct)) { *jpeg_struct = g_new0(struct JPEG_ENCODER_STRUCTURE, 1); /* Initialization of JPEG control structure */ initialization (*jpeg_struct,global->width,global->height); /* Initialization of Quantization Tables */ initialize_quantization_tables (*jpeg_struct); } jpeg_size = encode_image(proc_buff->frame, global->jpeg, *jpeg_struct, 0, global->width, global->height); ret = write_video_data (all_data, global->jpeg, jpeg_size); }
int main(int argc, char** argv) { buildEnvironment(); glutInit( &argc, argv ); glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH ); glutInitWindowSize( 600, 600 ); glutInitWindowPosition( 0, 0 ); glutCreateWindow( "2D Beam Tracing" ); glutDisplayFunc( display ); glutReshapeFunc( reshape ); initialization( ); glutMainLoop( ); return 0; }
//*************************************************************************************** // MAIN function starts here //*************************************************************************************** int main() { //Initialize Interrupts init_interrupt(); // Initialization sequence if (enumerated != 0xDEADBEEF){ initialization(); } while(1); // Should not reach here mbus_sleep_all(); while(1); }