forked from Kambrian/HBTplus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHBT.cpp
More file actions
74 lines (62 loc) · 1.6 KB
/
HBT.cpp
File metadata and controls
74 lines (62 loc) · 1.6 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
using namespace std;
#include <iostream>
#include <string>
#include <cstdlib>
#include <omp.h>
#include "src/datatypes.h"
#include "src/config_parser.h"
#include "src/snapshot.h"
#include "src/halo.h"
#include "src/subhalo.h"
#include "src/mymath.h"
int main(int argc, char **argv)
{
#ifdef _OPENMP
omp_set_nested(0);
#endif
int snapshot_start, snapshot_end;
ParseHBTParams(argc, argv, HBTConfig, snapshot_start, snapshot_end);
mkdir(HBTConfig.SubhaloPath.c_str(), 0755);
HBTConfig.DumpParameters();
SubhaloSnapshot_t subsnap;
subsnap.Load(snapshot_start-1, SubReaderDepth_t::SrcParticles);
Timer_t timer;
ofstream time_log(HBTConfig.SubhaloPath+"/timing.log", fstream::out|fstream::app);
time_log<<fixed<<setprecision(1);//<<setw(8);
for(int isnap=snapshot_start;isnap<=snapshot_end;isnap++)
{
timer.Tick();
ParticleSnapshot_t partsnap;
partsnap.Load(isnap);
subsnap.SetSnapshotIndex(isnap);
HaloSnapshot_t halosnap;
halosnap.Load(isnap);
timer.Tick();
#pragma omp parallel
{
halosnap.ParticleIdToIndex(partsnap);
subsnap.ParticleIdToIndex(partsnap);
//subsnap.star_formation(); //add star formation code here
#pragma omp master
timer.Tick();
subsnap.AssignHosts(halosnap);
}
subsnap.PrepareCentrals(halosnap);
timer.Tick();
subsnap.RefineParticles();
timer.Tick();
subsnap.MergeSubhalos();
timer.Tick();
subsnap.UpdateTracks();
// subsnap.ParticleIndexToId();//moved inside Save().
timer.Tick();
subsnap.Save();
timer.Tick();
time_log<<isnap;
for(int i=1;i<timer.Size();i++)
time_log<<"\t"<<timer.GetSeconds(i);
time_log<<endl;
timer.Reset();
}
return 0;
}