Skip to content

Commit acbb5fc

Browse files
Add LoadParticlesFromFile function in load_particle.hpp
1 parent 03ab728 commit acbb5fc

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/io/load_particle.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include "struct/particle.h"
2+
#include "floatdef.h"
3+
4+
std::vector<Particle> LoadParticlesFromFile(const std::string& filename)
5+
{
6+
std::vector<Particle> p;
7+
std::ifstream in(filename);
8+
9+
Particle temp;
10+
while (in >> temp.x >> temp.y >> temp.z >> temp.vx >> temp.vy >> temp.vz >> temp.m)
11+
p.push_back(temp);
12+
13+
return p;
14+
}

0 commit comments

Comments
 (0)