void Scene::renderDbg( Graphics2D& g , Vec2f const& pos , int index ) { bool isEven = mLevel.isEvenLayer( index ); Vec2f cPos = mLevel.calcCellCenterPos( index ); g.setBrush( ColorKey3( 0 , 0 , 255 ) ); g.drawCircle( pos + cPos , int( g_BubbleRadius - 10) ); g.setBrush( ColorKey3( 255 , 255 , 0 ) ); for( int i = 0 ; i < NUM_LINK_DIR ; ++i ) { int linkIdx = mLevel.getLinkCellIndex( index , LinkDir(i) , isEven ); //BubbleCell& linkCell = mLevel.getCell( linkIdx ); Vec2f cPos = mLevel.calcCellCenterPos( linkIdx ); g.drawCircle( pos + cPos , int( g_BubbleRadius -10) ); } //g.setBrush( ColorKey3( 255 , 0 , 0 ) ); //for( int i = 0 ; i < mLevel.mNumFallCell ; ++i ) //{ // Vec2f cPos = mLevel.calcCellCenterPos( mLevel.mIndexFallCell[i] ); // g.drawCircle( pos + cPos , g_BubbleRadius - 5 ); //} }
bool DoPdeFit( int nId, CClientSession* pSession, void* pParam ) { SERVERINFO sysinfo; char buf[MAXPATH], path[MAXPATH]; if( !pSession->Logon( "smyan_new", "" ) )return false; strcpy( path, "uma_sga" ); strcat( path, "_" ); strcat( path, GetLocalName().substr(0,8).c_str() ); pSession->MkDir( path ); pSession->ChDir( path ); pSession->ServerInfo( sysinfo ); sprintf( path, "slave%d", nId ); char* cmd = NULL; if( sysinfo.nOpSystem==SI_WIN32 ){ cmd = "surrga.exe"; }else if( sysinfo.nOpSystem==SI_LINUX ){ cmd = "surrga.ln"; }else if( sysinfo.nOpSystem==SI_UNIX ){ cmd = "surrga.un"; } //send all the static files in the static folder to the remote host pSession->FileMode( O_TEXT ); bool bOk = true; // bool bOk = SendDir( pSession, "static", false ); pSession->FileMode( O_BINARY ); // pSession->CopyTo( cmd, cmd, COPY_OLD_OVERWRITE ); pSession->ChMod( cmd, 0x700 ); //for shared disk, make sub compuation folder and enter it. if( sysinfo.bShareDisk ){ pSession->MkDir( path ); pSession->ChDir( path ); } //delete the surrbak.data file now pSession->Remove( "surrbak.dat" ); // cdump<<lock<<nId<<"--check point 1"<<endl<<unlock; //send the files in the slave folder. pSession->FileMode( O_TEXT ); SendDir( pSession, path, true ); //for shared disk, make soft link in the computation folder if( sysinfo.bShareDisk ){ LinkDir( pSession, "static" ); char buf[100]; // pSession->Remove( cmd ); sprintf( buf, "../%s", cmd ); pSession->SoftLink( buf, cmd ); } //run the pdefit DWORD dwExit = 0; bOk = pSession->RunCommand( cmd, true, dwExit ); // bOk = pSession->CopyTo( "surrbak.dat", "surrbak.dat", COPY_NO_OVERWRITE ); if( bOk && dwExit==0 ){ //retrieve surrback.dat strcpy( buf, path ); strcat( buf, "/surrbak.dat" ); bOk = pSession->CopyFrom( "surrbak.dat", buf ); }else{ bOk = false; } if( sysinfo.bShareDisk ){ pSession->ChDir( ".." ); pSession->RemoveDir( path, true ); // pSession->EmptyDir( "." ); //remove the intemediate files to save disk space. // pSession->Remove( "optdemo_fine.ftl" ); // pSession->Remove( "fort.30" ); // pSession->Remove( "fort.35" ); } // pSession->ChDir( "~" ); return bOk; }
int DoPdeFit( int nId, CClientSession* pSession, void* pParam ) { SYSINFO sysinfo; char buf[MAXPATH], path[MAXPATH]; sprintf( path, "slave%d", nId ); pSession->MkDir( "pnnga" ); pSession->ChDir( "pnnga" ); pSession->GetSysInfo( &sysinfo ); char* cmd = NULL; if( sysinfo.nOpSystem==SI_WIN32 ) { cmd = "pdefit.exe"; } else if( sysinfo.nOpSystem==SI_LINUX ) { cmd = "pdefit.ln"; } else if( sysinfo.nOpSystem==SI_UNIX ) { cmd = "pdefit.un"; } //send all the static files in the static folder to the remote host pSession->FileMode( O_TEXT ); int nRet = SendDir( pSession, "static", false ); // if( sysinfo.nOpSystem!=SI_WIN32 && nRet!=S_EXIST){ // pSession->RunImage( "../dos2unix *" ); // } pSession->FileMode( O_BINARY ); pSession->PutFile( cmd, cmd, false ); pSession->ChMod( cmd, 0x700 ); //for shared disk, make sub compuation folder and enter it. if( sysinfo.bShareDisk ) { pSession->MkDir( path ); pSession->ChDir( path ); } // cdump<<lock<<nId<<"--check point 1"<<endl<<unlock; //send the slave specific files and dos2unix it. pSession->FileMode( O_TEXT ); // cdump<<lock<<nId<<"--check point 1.1"<<endl<<unlock; SendDir( pSession, path, true ); // if( sysinfo.nOpSystem!=SI_WIN32 ){ // if( sysinfo.bShareDisk ){ // pSession->RunImage( "../../dos2unix *" ); // }else{ // pSession->RunImage( "../dos2unix surrgo.dat" ); // } // } // cdump<<lock<<nId<<"--check point 2"<<endl<<unlock; //for shared disk, make soft link in the computation folder if( sysinfo.bShareDisk ) { LinkDir( pSession, "static" ); char buf[100]; sprintf( buf, "../%s", cmd ); pSession->SoftLink( buf, cmd ); } // cdump<<lock<<nId<<"--check point 3"<<endl<<unlock; //run the pdefit pSession->Remove( "surrbak.dat" ); nRet = pSession->RunImage( cmd, true ); if( nRet==0 ) { //retrieve surrback.dat strcpy( buf, path ); strcat( buf, "/surrbak.dat" ); nRet = pSession->GetFile( "surrbak.dat", buf ); } else { nRet = E_IMGEXIT; } if( sysinfo.bShareDisk ) { //remove the intemediate files to save disk space. // pSession->Remove( "optdemo_fine.ftl" ); // pSession->Remove( "fort.30" ); // pSession->Remove( "fort.35" ); } pSession->ChDir( "~" ); return SUCCEEDED(nRet); }