-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathField.h
37 lines (32 loc) · 1 KB
/
Field.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once
#include "Cell.h"
#include "FieldConfig.h"
#include <vector>
#include <cstdint>
#include <cmath>
#include <stdexcept>
class Field
{
public:
Field(FieldConfig config);
void Advance();
void InsertParticle(const Particle& p);
void ChangeVelocity(double factor);
void DeleteParticlesWithinRaduis(double x, double y, double radius);
void ChangeVelocityWithinRadius(double x, double y, double radius, double factor);
void UpdateGravityMode();
uint32_t NumberOfParticlesAt(uint32_t x, uint32_t y) const;
uint32_t NumberOfParticles() const;
double GetTemperature() const;
FieldConfig GetConfig() const;
Vector2 ComputeForce(const Particle& p1, const Particle& p2) const;
std::vector<std::vector<Cell>>::const_iterator begin() const;
std::vector<std::vector<Cell>>::const_iterator end() const;
private:
void updateField();
void reflectParticles();
private:
std::vector<std::vector<Cell>> _cells;
FieldConfig _config;
double _wallElasticity;
};