Skip to content

Commit 4fa59db

Browse files
Update vtk_save.h
1 parent 46a27ae commit 4fa59db

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

src/io/vtk_save.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,31 @@ inline void SaveVTK(const std::vector<Particle>& p, const std::string& filename)
3232
constexpr const char* vtkType = "float";
3333
#endif
3434

35-
// draw points
35+
// Points
3636
out << "POINTS " << N << " " << vtkType << "\n";
3737
for (const auto& a : p)
3838
out << a.x << " " << a.y << " " << a.z << "\n";
3939

40-
// draw vertices
40+
// Vertices
4141
out << "VERTICES " << N << " " << N*2 << "\n";
4242
for (size_t i = 0; i < N; i++)
4343
out << "1 " << i << "\n";
4444

45-
// that too
4645
out << "POINT_DATA " << N << "\n";
46+
47+
// Type (0 for Star, 1 for DM)
48+
// In ParaView, use the "Threshold" filter on this to hide DM
49+
out << "SCALARS type int 1\n";
50+
out << "LOOKUP_TABLE default\n";
51+
for (const auto& a : p)
52+
out << a.type << "\n";
53+
54+
// Velocity Vectors
4755
out << "VECTORS velocity " << vtkType << "\n";
4856
for (const auto& a : p)
4957
out << a.vx << " " << a.vy << " " << a.vz << "\n";
5058

59+
// Mass
5160
out << "SCALARS mass " << vtkType << " 1\n";
5261
out << "LOOKUP_TABLE default\n";
5362
for (const auto& a : p)

0 commit comments

Comments
 (0)