MPS-Basic
Loading...
Searching...
No Matches
particle.cpp
Go to the documentation of this file.
1#include "particle.hpp"
2
3Particle::Particle(int id, ParticleType type, Eigen::Vector3d pos, Eigen::Vector3d vel, double density, int fluidType) {
4 this->id = id;
5 this->type = type;
6 this->position = pos;
7 this->velocity = vel;
8 this->density = density;
9 this->fluidType = fluidType;
10}
11
13 switch (type) {
15 return 1 / this->density;
16
20 default:
21 return 0;
22 }
23}
double inverseDensity() const
calculate inverse of density for collision
Definition particle.cpp:12
int fluidType
Definition particle.hpp:52
Eigen::Vector3d position
position of the particle
Definition particle.hpp:55
int id
index of the particle
Definition particle.hpp:50
double density
density of the particle. It is used only for fluid and wall particles.
Definition particle.hpp:60
Particle(int id, ParticleType type, Eigen::Vector3d pos, Eigen::Vector3d vel, double density, int fluidType=0)
constructor
Definition particle.cpp:3
Eigen::Vector3d velocity
velocity of the particle
Definition particle.hpp:56
ParticleType type
type of the particle
Definition particle.hpp:51
ParticleType
Enum class for particle type.
Definition particle.hpp:11
@ Ghost
Ghost particle (outside of the domain, not used for calculation)
@ Wall
Wall particle.
@ DummyWall
Dummy wall particle (pressure is not calculated)
@ Fluid
Fluid particle.