Beispiel #1
0
void InitializeSystem(vector<Particle>& p, double box, int nSideX, int nSideY) {

	int N=nSideX*nSideY;
	p.resize(N);
	RNG rng;

	const Vector2D centerer = Vector2D(-0.5,-0.5)*box;
	const double stepX = box/nSideX;
	const double stepY = box/nSideY;
	int idx = 0;
	for (int i=0; i<nSideX; i++) {
		for (int j=0; j<nSideY; j++) {
			p[idx].r = Vector2D(i*stepX,j*stepY) + centerer;
			p[idx].v = Vector2D(rng.UniCentered(), rng.UniCentered());
			idx++;
		}
	}
}