DEarthquake::DEarthquake (AActor *center, int intensity, int duration, int damrad, int tremrad) { m_Spot = center; setbox (m_TremorBox, center, tremrad * FRACUNIT * 64); setbox (m_DamageBox, center, damrad * FRACUNIT * 64); m_Intensity = intensity; m_Countdown = duration; }
FormatXTC::FormatXTC(float len) { prec_xtc = 1000.; time_xtc=step_xtc=0; setbox(len); xd=NULL; x_xtc=NULL; }
void redraw(void) { int i, j; window(); draw(screen, screen->r, display->white, nil, ZP); for (i = i0; i <= i1; i++) for (j = j0; j <= j1; j++) if (life[i][j] & 1) setbox(i, j); }
/* * Record a birth at (i,j). */ void birth(int i, int j) { char *lp; if (i < 1 || NLIFE - 1 <= i || j < 1 || NLIFE - 1 <= j || life[i][j] & 1) return; lp = &life[i][j]; ++*lp; ++row[i]; ++col[j]; neighbours(+); setbox(i, j); }
/*! * Save all particles in Cuboid to xtc file. Molecules added to the ioxtc::g * vector will be made whole (periodic boundaries are temporarily undone). Box * dimensions are taken from the Cuboid class and the particles are shifted so * that origin is in the corner of the box (Gromacs practice) * * \param file Name of the output xtc file * \param c Cuboid container from which particles and box dimensions are read. */ bool FormatXTC::save(string file, Space &c) { Geometry::Cuboid* geo = dynamic_cast<Geometry::Cuboid*>(c.geo); assert(geo!=nullptr && "Only Cuboid geometries classes allowed."); if (geo==nullptr) return false; setbox(geo->len.x(), geo->len.y(), geo->len.z()); p=c.p; for (auto gi : g) { gi->translate( c, -gi->cm ); // b.trial is moved to origo -> whole! for (auto j : *gi) p[j] = c.trial[j] + gi->cm; // move back to cm without periodicity gi->undo(c); // restore to original PBC location } for (auto &pi : p) pi+=geo->len_half; // gromacs origo is in the corner of the box return save(file, p); // while in Cuboid we use the middle }
int generate(void) { char *lp; char **p, **addp, **delp; int i, j, j0 = NLIFE, j1 = -1; int drow[NLIFE], dcol[NLIFE]; for (j = 1; j != NLIFE - 1; j++) { drow[j] = dcol[j] = 0; if (interest(col, j)) { if (j < j0) j0 = j; if (j1 < j) j1 = j; } } addp = adjust; delp = &adjust[NADJUST]; for (i = 1; i != NLIFE - 1; i++) if (interest(row, i)) { for (j = j0, lp = &life[i][j0]; j <= j1; j++, lp++) switch (action[*lp]) { case 'b': ++*lp; ++drow[i]; ++dcol[j]; setbox(i, j); *addp++ = lp; break; case 'd': --*lp; --drow[i]; --dcol[j]; clrbox(i, j); *--delp = lp; break; } } if (addp == adjust && delp == &adjust[NADJUST]) return 0; if (delp < addp) sysfatal("Out of space (delp < addp)"); p = adjust; while (p != addp) { lp = *p++; neighbours(+); } p = delp; while (p != &adjust[NADJUST]) { lp = *p++; neighbours(-); } for (i = 1; i != NLIFE - 1; i++) { row[i] += drow[i]; col[i] += dcol[i]; } if (row[1] || row[NLIFE-2] || col[1] || col[NLIFE-2]) centerlife(); return 1; }
void FormatXTC::setbox(const Point &p) { setbox(p.x(), p.y(), p.z()); }
void FormatXTC::setbox(float len) { setbox(len,len,len); }
oop defineGlobal(oop name, oop kind, oop value) { binary *s = (binary *) symbol_name(name); box *b = lookup_global(s->data, oop_len(s)); setbox(b, value); return b; }