亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? nbody_sh1p.c

?? mpi編程
?? C
?? 第 1 頁 / 共 3 頁
字號:
	   << dt_dia << ",\n  and snapshot output interval dt_out = "	   << dt_out << "." << endl;    real tcpu = MPI_Wtime();           // check CPU usage    real epot = 0;                     // potential energy of the n-body system    real coll_time = VERY_LARGE_NUMBER;// collision (close encounter) time scale    get_acc_jerk_pot_coll(p, n, epot, coll_time, pipe);    int nsteps = 0;               // number of integration time steps completed    real einit;                   // initial total energy of the system    write_diagnostics(p, n, t, epot, nsteps, einit,		      true, x_flag, tcpu);    if (init_out)                                    // flag for initial output      put_snapshot(p, n, t, particletype);    real t_dia = t + dt_dia;           // next time for diagnostics output    real t_out = t + dt_out;           // next time for snapshot output    real t_end = t + dt_tot;           // final time, to finish the integration    while (true){        while (t < t_dia && t < t_out && t < t_end){            real dt_local = dt_param * coll_time;	    real dt;	    MPI_Allreduce(&dt_local, &dt, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); // synchronize time step	    evolve_step(p, n, t, dt, epot, coll_time, pipe);            nsteps++;        }        if (t >= t_dia){            write_diagnostics(p, n, t, epot, nsteps,                              einit, false, x_flag, tcpu);            t_dia += dt_dia;        }        if (t >= t_out){            put_snapshot(p, n, t, particletype);            t_out += dt_out;        }        if (t >= t_end)            break;    }}/*----------------------------------------------------------------------------- *  evolve_step  --  takes one integration step for an N-body system, using the *                   Hermite algorithm. *----------------------------------------------------------------------------- */void evolve_step(Particle p[], int n, real & t,                 real dt, real & epot, real & coll_time,		 void *pipe){  Particle *po = new Particle[n];    for (int i = 0; i < n ; i++)        for (int k = 0; k < NDIM ; k++){          po[i].pos[k] = p[i].pos[k];          po[i].vel[k] = p[i].vel[k];          po[i].acc[k] = p[i].acc[k];          po[i].jerk[k] = p[i].jerk[k];        }    predict_step(p, n, dt);    get_acc_jerk_pot_coll(p, n, epot, coll_time, pipe);    correct_step(p, po, n, dt);    t += dt;    delete[] po;}/*----------------------------------------------------------------------------- *  predict_step  --  takes the first approximation of one Hermite integration *                    step, advancing the positions and velocities through a *                    Taylor series development up to the order of the jerks. *----------------------------------------------------------------------------- */void predict_step(Particle p[], int n, real dt){    for (int i = 0; i < n ; i++)        for (int k = 0; k < NDIM ; k++){            p[i].pos[k] += p[i].vel[k]*dt + p[i].acc[k]*dt*dt/2                                      + p[i].jerk[k]*dt*dt*dt/6;            p[i].vel[k] += p[i].acc[k]*dt + p[i].jerk[k]*dt*dt/2;        }}/*----------------------------------------------------------------------------- *  correct_step  --  takes one iteration to improve the new values of position *                    and velocities, effectively by using a higher-order *                    Taylor series constructed from the terms up to jerk at *                    the beginning and the end of the time step. *----------------------------------------------------------------------------- */void correct_step(Particle p[], Particle po[], int n, real dt){    for (int i = 0; i < n ; i++)        for (int k = 0; k < NDIM ; k++){            p[i].vel[k] = po[i].vel[k] + (po[i].acc[k] + p[i].acc[k])*dt/2                                       + (po[i].jerk[k] - p[i].jerk[k])*dt*dt/12;            p[i].pos[k] = po[i].pos[k] + (po[i].vel[k] + p[i].vel[k])*dt/2                                       + (po[i].acc[k] - p[i].acc[k])*dt*dt/12;        }}/*----------------------------------------------------------------------------- *  get_acc_jerk_pot_coll  --  calculates accelerations and jerks, and as side *                             effects also calculates potential energy and *                             the time scale coll_time for significant changes *                             in local configurations to occur. *                                                  __                     __ *                                                 |          -->  -->       | *               M                           M     |           r  . v        | *   -->          j    -->       -->          j    | -->        ji   ji -->  | *    a   ==  --------  r    ;    j   ==  -------- |  v   - 3 ---------  r   | *     ji     |-->  |3   ji        ji     |-->  |3 |   ji      |-->  |2   ji | *            | r   |                     | r   |  |           | r   |       | *            |  ji |                     |  ji |  |__         |  ji |     __| *                              *  note: it would be cleaner to calculate potential energy and collision time *        in a separate function.  However, the current function is by far the *        most time consuming part of the whole program, with a double loop *        over all particles that is executed every time step.  Splitting off *        some of the work to another function would significantly increase *        the total computer time (by an amount close to a factor two). * *  We determine the values of all four quantities of interest by walking *  through the system in a double {i,j} loop.  The first three, acceleration, *  jerk, and potential energy, are calculated by adding successive terms; *  the last, the estimate for the collision time, is found by determining the  *  minimum value over all particle pairs and over the two choices of collision *  time, position/velocity and sqrt(position/acceleration), where position and *  velocity indicate their relative values between the two particles, while *  acceleration indicates their pairwise acceleration.  At the start, the *  first three quantities are set to zero, to prepare for accumulation, while *  the last one is set to a very large number, to prepare for minimization. *       The integration loops only over half of the pairs, with j > i, since *  the contributions to the acceleration and jerk of particle j on particle i *  is the same as those of particle i on particle j, apart from a minus sign *  and a different mass factor. *----------------------------------------------------------------------------- */void get_acc_jerk_pot_coll(Particle pl[], int nl, 			   Particle po[], int no, 			   real & epot, real & coll_time){    real coll_time_q = VERY_LARGE_NUMBER;      // collision time to 4th power    real coll_est_q;                           // collision time scale estimate                                               // to 4th power (quartic)    for (int i = 0; i < nl ; i++){        for (int j = 0; j < no ; j++){            // rji[] is the vector from	  if(pl[i].id!=po[j].id) {            real rji[NDIM];                        // particle i to particle j            real vji[NDIM];                        // vji[] = d rji[] / d t            for (int k = 0; k < NDIM ; k++){                rji[k] = po[j].pos[k] - pl[i].pos[k];                vji[k] = po[j].vel[k] - pl[i].vel[k];            }            real r2 = 0;                           // | rji |^2            real v2 = 0;                           // | vji |^2            real rv_r2 = 0;                        // ( rij . vij ) / | rji |^2            for (int k = 0; k < NDIM ; k++){                r2 += rji[k] * rji[k];                v2 += vji[k] * vji[k];                rv_r2 += rji[k] * vji[k];            }            rv_r2 /= r2;            real r = sqrt(r2);                     // | rji |            real r3 = r * r2;                      // | rji |^3// add the {i,j} contribution to the total potential energy for the system:            epot -= pl[i].mass * po[j].mass / r;// add the {j (i)} contribution to the {i (j)} values of acceleration and jerk:            real da[3];                            // main terms in pairwise            real dj[3];                            // acceleration and jerk            for (int k = 0; k < NDIM ; k++){                da[k] = rji[k] / r3;                           // see equations                dj[k] = (vji[k] - 3 * rv_r2 * rji[k]) / r3;    // in the header            }            for (int k = 0; k < NDIM ; k++){                pl[i].acc[k] += po[j].mass * da[k];           // using symmetry		pl[i].jerk[k] += po[j].mass * dj[k];          // acceleration		// in the original version pij = -pji for acc and jerk.		// in this parallel version this is unpractical.                //po[j].acc[k] -= pl[i].mass * da[k];      // find pairwise		//po[j].jerk[k] -= pl[i].mass * dj[k];     // and jerk            }// first collision time estimate, based on unaccelerated linear motion:            coll_est_q = (r2*r2) / (v2*v2);            if (coll_time_q > coll_est_q)                coll_time_q = coll_est_q;// second collision time estimate, based on free fall:            real da2 = 0;                                  // da2 becomes the             for (int k = 0; k < NDIM ; k++)                // square of the                 da2 += da[k] * da[k];                      // pair-wise accel-            double mij = pl[i].mass + po[j].mass;            // eration between            da2 *= mij * mij;                              // particles i and j            coll_est_q = r2/da2;            if (coll_time_q > coll_est_q)                coll_time_q = coll_est_q;	  }        }                                         }        // from q for quartic back to linear collision time and taking the minimum    coll_time = min(coll_time, sqrt(sqrt(coll_time_q))); }                                             /*----------------------------------------------------------------------------- *  get_acc_jerk_pot_coll  --  the distribution of particles over  *                             neighboring processors and subsequent force *                             calculation. *----------------------------------------------------------------------------- */void get_acc_jerk_pot_coll(Particle p[], int n, real &epot, real &coll_time, 			   void *pipe) {  int rank, size;  MPI_Comm_rank( MPI_COMM_WORLD, &rank );  MPI_Comm_size( MPI_COMM_WORLD, &size );    int rlen;    Particle *recvbuf;    for (int i = 0; i < n ; i++)      for (int k = 0; k < NDIM ; k++) {	p[i].acc[k] = p[i].jerk[k] = 0;      }    MPE_Pipe_start( pipe, p, n, 1 ); // load the initial sendbuffer     epot = 0;                        // initialize epot and coll_time    coll_time = VERY_LARGE_NUMBER;    get_acc_jerk_pot_coll(p, n, p, n, epot, coll_time);    for (int step=1; step<size; step++) { // compute forces for other particles      MPE_Pipe_push( pipe, (void**)&recvbuf, &rlen );        // get new data            // Compute forces       get_acc_jerk_pot_coll(p, n, recvbuf, rlen, epot, coll_time);     }}/*----------------------------------------------------------------------------- *                                                                    \\   o *  end of file:  nbody_sh1.C                                         /\\'  O *                                                                   /\     | *============================================================================= */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲人xxxx| 水野朝阳av一区二区三区| 亚洲精品免费播放| 日韩和欧美一区二区三区| 福利一区在线观看| 在线成人高清不卡| 亚洲精品视频一区| 成人久久18免费网站麻豆| 欧美日韩国产高清一区二区三区 | 1000部国产精品成人观看| 五月天久久比比资源色| 99综合电影在线视频| 欧美精品一区二区高清在线观看 | 国产精品丝袜91| 久久国内精品视频| 欧美日韩精品一区二区天天拍小说| 国产午夜精品理论片a级大结局| 视频在线观看国产精品| 色婷婷精品久久二区二区蜜臂av | 成人免费在线视频| 粉嫩av一区二区三区| 精品久久人人做人人爰| 日本成人在线视频网站| 欧美久久久久免费| 亚洲午夜免费电影| 欧亚一区二区三区| 亚洲综合偷拍欧美一区色| 色婷婷综合久久久| 亚洲美女一区二区三区| 91社区在线播放| 亚洲欧美视频在线观看视频| 99麻豆久久久国产精品免费| 国产欧美精品一区二区三区四区| 精品亚洲免费视频| 精品黑人一区二区三区久久| 精品一区二区三区视频 | 国产精品亚洲综合一区在线观看| 精品理论电影在线观看| 国产一区二区精品久久| 久久天堂av综合合色蜜桃网| 国产精品1区2区3区| 久久精品亚洲精品国产欧美 | 日韩 欧美一区二区三区| 欧美美女黄视频| 久久精品国内一区二区三区| 欧美成人国产一区二区| 国产成人自拍网| 国产精品成人一区二区艾草 | 午夜精品福利在线| 91精品久久久久久久91蜜桃 | 亚洲3atv精品一区二区三区| 欧美日本韩国一区| 精品午夜久久福利影院| 国产日产欧美一区二区视频| av资源站一区| 亚洲午夜视频在线观看| 欧美成人性福生活免费看| 国产精品一二三在| 一区二区三区四区高清精品免费观看 | 欧美主播一区二区三区| 亚洲福利视频三区| 2021国产精品久久精品| 91美女精品福利| 日本在线不卡一区| 中文字幕成人网| 欧美日韩精品一区二区三区蜜桃 | 久久先锋资源网| 91麻豆福利精品推荐| 日韩高清不卡一区二区| 久久精品人人做| 欧美丝袜丝交足nylons图片| 美女脱光内衣内裤视频久久网站 | 青青草91视频| 国产精品视频你懂的| 欧美日韩不卡视频| 丁香婷婷综合五月| 奇米色777欧美一区二区| 国产精品视频一二| 久久亚洲影视婷婷| 91精品黄色片免费大全| 色香蕉久久蜜桃| 成人激情午夜影院| 久久国产精品99久久久久久老狼| 一区二区三区在线观看国产 | 亚洲成人一区二区在线观看| 国产三级精品在线| 日韩欧美专区在线| 欧美老肥妇做.爰bbww视频| 91在线一区二区三区| 国产一区二区在线电影| 五月天网站亚洲| 亚洲乱码国产乱码精品精小说| 精品福利视频一区二区三区| 欧美日韩免费在线视频| 99re热这里只有精品视频| 韩国v欧美v亚洲v日本v| 天天亚洲美女在线视频| 一区二区三国产精华液| 国产精品伦理一区二区| 久久久天堂av| 精品久久国产老人久久综合| 欧美日韩国产首页| 欧美日韩一区久久| 日本精品免费观看高清观看| hitomi一区二区三区精品| 国产最新精品免费| 极品少妇xxxx偷拍精品少妇| 免播放器亚洲一区| 蜜乳av一区二区| 青青草成人在线观看| 久久精品二区亚洲w码| 青娱乐精品视频| 精品一二线国产| 国产精品一区三区| 国产很黄免费观看久久| 国产精品 日产精品 欧美精品| 精品一区免费av| 激情亚洲综合在线| 国产在线精品一区二区夜色| 久久99国内精品| 狠狠狠色丁香婷婷综合激情 | 亚洲国产经典视频| 国产精品天天摸av网| 日本一区免费视频| 国产精品进线69影院| 中文字幕一区二| 一区二区激情小说| 婷婷开心久久网| 麻豆一区二区在线| 国产精品 日产精品 欧美精品| 成人免费毛片app| 91久久一区二区| 欧美高清hd18日本| 久久久国产一区二区三区四区小说| 国产精品传媒视频| 亚洲mv大片欧洲mv大片精品| 日本va欧美va欧美va精品| 看电视剧不卡顿的网站| 国产精品18久久久久久久久| 色天使色偷偷av一区二区| 91麻豆精品国产91久久久使用方法 | 亚洲一区二区在线观看视频 | 性做久久久久久久免费看| 午夜亚洲福利老司机| 久久精品国产一区二区三区免费看| 国内精品在线播放| 91免费版pro下载短视频| 91精品国产欧美一区二区18| 久久久久久亚洲综合| 亚洲精品大片www| 久久66热偷产精品| 99精品久久99久久久久| 日韩亚洲欧美在线观看| 国产精品久久午夜夜伦鲁鲁| 午夜影视日本亚洲欧洲精品| 国产一区二区91| 欧美日韩国产另类一区| 国产精品久久午夜| 美日韩黄色大片| 91极品视觉盛宴| 国产欧美日韩激情| 日韩主播视频在线| 99精品久久免费看蜜臀剧情介绍| 欧美成人三级电影在线| 亚洲六月丁香色婷婷综合久久| 紧缚奴在线一区二区三区| 91国在线观看| 国产情人综合久久777777| 日本欧美在线观看| 91蝌蚪国产九色| 久久精品免费在线观看| 免费在线一区观看| 欧美在线视频全部完| 国产精品伦一区二区三级视频| 久久99精品国产麻豆婷婷| 在线电影一区二区三区| 亚洲已满18点击进入久久| 99精品偷自拍| 国产亚洲精品aa| 国模冰冰炮一区二区| 欧美一激情一区二区三区| 一区二区久久久| 91黄视频在线| 一区二区三区色| 色偷偷久久一区二区三区| 一区在线观看免费| 成人激情开心网| 国产蜜臀97一区二区三区| 国产一区二区不卡在线| 久久色视频免费观看| 久久99日本精品| 精品国产91久久久久久久妲己| 蜜桃一区二区三区四区| 777午夜精品视频在线播放| 一区二区三区 在线观看视频| 在线视频国内自拍亚洲视频| 一区二区三区在线观看欧美| 欧美影视一区在线| 亚洲成在人线免费| 91精品国产综合久久国产大片|