@@ -1896,7 +1896,7 @@ namespace PR {
18961896
18971897 std::vector<std::string> ParticleReader::readerTypes
18981898 {" PSPout" , " PSPspl" , " GadgetNative" , " GadgetHDF5" , " PSPhdf5" ,
1899- " TipsyNative" , " TipsyXDR" , " Bonsai" };
1899+ " TipsyNative" , " TipsyXDR" , " ChaNGa " , " Bonsai" };
19001900
19011901
19021902 std::vector<std::vector<std::string>>
@@ -2031,7 +2031,8 @@ namespace PR {
20312031 exit (1 );
20322032 }
20332033#endif
2034-
2034+ else if (reader.find (" ChaNGa" ) == 0 )
2035+ ret = std::make_shared<Tipsy>(file, Tipsy::TipsyType::changa, verbose);
20352036 else if (reader.find (" Bonsai" ) == 0 )
20362037 ret = std::make_shared<Tipsy>(file, Tipsy::TipsyType::bonsai, verbose);
20372038 else {
@@ -2184,8 +2185,7 @@ namespace PR {
21842185 P.pos [k] = ps->gas_particles [pcount].pos [k];
21852186 P.vel [k] = ps->gas_particles [pcount].vel [k];
21862187 }
2187- if (ttype == TipsyType::bonsai) P.indx = ps->gas_particles [pcount].ID ();
2188- else P.indx = ps->getIndexOffset (TipsyReader::Ptype::gas) + pcount + 1 ;
2188+ P.indx = ps->getIndexOffset (TipsyReader::Ptype::gas) + pcount + 1 ;
21892189
21902190 pcount++;
21912191 return ;
@@ -2198,8 +2198,12 @@ namespace PR {
21982198 P.pos [k] = ps->dark_particles [pcount].pos [k];
21992199 P.vel [k] = ps->dark_particles [pcount].vel [k];
22002200 }
2201- if (ttype == TipsyType::bonsai) P.indx = ps->dark_particles [pcount].ID ();
2202- else P.indx = ps->getIndexOffset (TipsyReader::Ptype::dark) + pcount + 1 ;
2201+ if (ttype == TipsyType::bonsai)
2202+ P.indx = ps->dark_particles [pcount].ID2 ();
2203+ else if (ttype == TipsyType::changa)
2204+ P.indx = ps->dark_particles [pcount].ID ();
2205+ else
2206+ P.indx = ps->getIndexOffset (TipsyReader::Ptype::dark) + pcount + 1 ;
22032207
22042208 pcount++;
22052209 return ;
@@ -2212,8 +2216,12 @@ namespace PR {
22122216 P.pos [k] = ps->star_particles [pcount].pos [k];
22132217 P.vel [k] = ps->star_particles [pcount].vel [k];
22142218 }
2215- if (ttype == TipsyType::bonsai) P.indx = ps->star_particles [pcount].ID ();
2216- else P.indx = ps->getIndexOffset (TipsyReader::Ptype::star) + pcount + 1 ;
2219+ if (ttype == TipsyType::bonsai)
2220+ P.indx = ps->star_particles [pcount].ID2 ();
2221+ else if (ttype == TipsyType::changa)
2222+ P.indx = ps->star_particles [pcount].ID ();
2223+ else
2224+ P.indx = ps->getIndexOffset (TipsyReader::Ptype::star) + pcount + 1 ;
22172225
22182226 pcount++;
22192227 return ;
0 commit comments