enbid-ananke 0.3.0__cp310-cp310-manylinux_2_39_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- .cpython-310-x86_64-linux-gnu.so +0 -0
- enbid_ananke/Enbid-2.0/.DS_Store +0 -0
- enbid_ananke/Enbid-2.0/COPYING +341 -0
- enbid_ananke/Enbid-2.0/COPYRIGHT +18 -0
- enbid_ananke/Enbid-2.0/Documentation/enbid.pdf +0 -0
- enbid_ananke/Enbid-2.0/Documentation/users-guide.pdf +0 -0
- enbid_ananke/Enbid-2.0/Documentation/users-guide.tex +679 -0
- enbid_ananke/Enbid-2.0/Documentation/users-guide.tex.flc +4 -0
- enbid_ananke/Enbid-2.0/Enbid +0 -0
- enbid_ananke/Enbid-2.0/Examples/hernquist1_small/snapshot_ici +0 -0
- enbid_ananke/Enbid-2.0/Examples/hernquist1_small/snapshot_ici_typelist +2 -0
- enbid_ananke/Enbid-2.0/Examples/uniform_6d_box_4/snapshot_ici +0 -0
- enbid_ananke/Enbid-2.0/Examples/uniform_6d_box_4/snapshot_ici_3d.ascii +10000 -0
- enbid_ananke/Enbid-2.0/Examples/uniform_6d_box_4/snapshot_ici_6d.ascii +10000 -0
- enbid_ananke/Enbid-2.0/parameterfiles/myparameterfile1 +37 -0
- enbid_ananke/Enbid-2.0/parameterfiles/myparameterfile2 +37 -0
- enbid_ananke/Enbid-2.0/parameterfiles/myparameterfile3 +37 -0
- enbid_ananke/Enbid-2.0/parameterfiles/myparameterfile4 +37 -0
- enbid_ananke/Enbid-2.0/periodic_lengths.txt +5 -0
- enbid_ananke/Enbid-2.0/src/Makefile +43 -0
- enbid_ananke/Enbid-2.0/src/allocate.cpp +47 -0
- enbid_ananke/Enbid-2.0/src/allocate.o +0 -0
- enbid_ananke/Enbid-2.0/src/allvars.cpp +62 -0
- enbid_ananke/Enbid-2.0/src/allvars.h +263 -0
- enbid_ananke/Enbid-2.0/src/allvars.o +0 -0
- enbid_ananke/Enbid-2.0/src/begrun.cpp +361 -0
- enbid_ananke/Enbid-2.0/src/begrun.o +0 -0
- enbid_ananke/Enbid-2.0/src/density_nd.cpp +130 -0
- enbid_ananke/Enbid-2.0/src/density_nd.o +0 -0
- enbid_ananke/Enbid-2.0/src/functions.cpp +256 -0
- enbid_ananke/Enbid-2.0/src/functions.h +20 -0
- enbid_ananke/Enbid-2.0/src/functions.o +0 -0
- enbid_ananke/Enbid-2.0/src/init.cpp +299 -0
- enbid_ananke/Enbid-2.0/src/init.o +0 -0
- enbid_ananke/Enbid-2.0/src/io.cpp +255 -0
- enbid_ananke/Enbid-2.0/src/io.o +0 -0
- enbid_ananke/Enbid-2.0/src/main.cpp +108 -0
- enbid_ananke/Enbid-2.0/src/main.o +0 -0
- enbid_ananke/Enbid-2.0/src/ngb_search.cpp +2315 -0
- enbid_ananke/Enbid-2.0/src/ngb_search.h +35 -0
- enbid_ananke/Enbid-2.0/src/ngb_search.o +0 -0
- enbid_ananke/Enbid-2.0/src/nr.cpp +186 -0
- enbid_ananke/Enbid-2.0/src/nr.h +13 -0
- enbid_ananke/Enbid-2.0/src/nr.o +0 -0
- enbid_ananke/Enbid-2.0/src/proto.h +22 -0
- enbid_ananke/Enbid-2.0/src/read_ic.cpp +434 -0
- enbid_ananke/Enbid-2.0/src/read_ic.o +0 -0
- enbid_ananke/Enbid-2.0/src/tree.cpp +973 -0
- enbid_ananke/Enbid-2.0/src/tree.h +34 -0
- enbid_ananke/Enbid-2.0/src/tree.o +0 -0
- enbid_ananke/Enbid-2.0/src/tree_search.cpp +597 -0
- enbid_ananke/Enbid-2.0/src/tree_search.o +0 -0
- enbid_ananke/__init__.py +318 -0
- enbid_ananke/__license__/LICENSE +339 -0
- enbid_ananke/__license__/__init__.py +9 -0
- enbid_ananke/__metadata__.py +160 -0
- enbid_ananke/_builtin_utils.py +62 -0
- enbid_ananke/_constants.py +56 -0
- enbid_ananke/_defaults.py +36 -0
- enbid_ananke/_name.py +10 -0
- enbid_ananke/_templates.py +71 -0
- enbid_ananke/_version.py +21 -0
- enbid_ananke/utils.py +11 -0
- enbid_ananke-0.3.0.dist-info/METADATA +44 -0
- enbid_ananke-0.3.0.dist-info/RECORD +68 -0
- enbid_ananke-0.3.0.dist-info/WHEEL +5 -0
- enbid_ananke-0.3.0.dist-info/licenses/LICENSE +339 -0
- enbid_ananke-0.3.0.dist-info/top_level.txt +2 -0
@@ -0,0 +1,255 @@
|
|
1
|
+
#include <stdio.h>
|
2
|
+
#include <stdlib.h>
|
3
|
+
#include <string.h>
|
4
|
+
#include <math.h>
|
5
|
+
#include "allvars.h"
|
6
|
+
#include "proto.h"
|
7
|
+
#include<fstream>
|
8
|
+
#include "tree.h"
|
9
|
+
#include "functions.h"
|
10
|
+
|
11
|
+
|
12
|
+
/* This wrapper function select the desired output
|
13
|
+
* routine for snapshot files.
|
14
|
+
*/
|
15
|
+
void savepositions(void )
|
16
|
+
{
|
17
|
+
int i,j;
|
18
|
+
|
19
|
+
for(i=1; i<=NumPart; i++) /* start-up initialization */
|
20
|
+
{
|
21
|
+
for(j=0;j<ND;j++)
|
22
|
+
{
|
23
|
+
P[i].Pos[j]=P[i].Pos[j]*All.hs[j];
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
printf("\nwriting snapshot file ....\n");
|
28
|
+
|
29
|
+
switch(All.ICFormat)
|
30
|
+
{
|
31
|
+
case 0:savepositions_ioformat0( );break;
|
32
|
+
case 1:savepositions_ioformat1( );break;
|
33
|
+
case 2:savepositions_ioformat2( );break;
|
34
|
+
default:cout<<"Parameter ICFormat should be between 0 to 2"<<endl;endrun(10);
|
35
|
+
}
|
36
|
+
|
37
|
+
printf("done with snapshot.\n");
|
38
|
+
|
39
|
+
}
|
40
|
+
|
41
|
+
|
42
|
+
//This function writes ASCII format file
|
43
|
+
void savepositions_ioformat0( )
|
44
|
+
{
|
45
|
+
int i;
|
46
|
+
char buf[100];
|
47
|
+
char file_suf[5]=".est";
|
48
|
+
sprintf(buf,"%s%s%s",All.InitCondFile,All.SnapshotFileBase,file_suf);
|
49
|
+
fprintf(stdout,"%s\n",buf); fflush(stdout);
|
50
|
+
|
51
|
+
ofstream fd (buf);
|
52
|
+
if (fd.is_open())
|
53
|
+
{
|
54
|
+
for(i=1;i<=NumPart;i++)
|
55
|
+
{
|
56
|
+
fd<<P[i].Density<<endl;
|
57
|
+
}
|
58
|
+
fd.close();
|
59
|
+
}
|
60
|
+
|
61
|
+
}
|
62
|
+
|
63
|
+
|
64
|
+
/* This function writes a density in Gadget type of format
|
65
|
+
* Each file contains a header first, then particle ID's if flag_id is enabled
|
66
|
+
* in header, then the density of particles.
|
67
|
+
*/
|
68
|
+
void savepositions_ioformat1( )
|
69
|
+
{
|
70
|
+
FILE *fd;
|
71
|
+
char buf[100];
|
72
|
+
float dummy[3];
|
73
|
+
int i,j;
|
74
|
+
int blklen;
|
75
|
+
int patterns[]={4,1,0},patternh[]={4,6,8,8,4,10,8,4,4,3,4,21,0};
|
76
|
+
|
77
|
+
#define BLKLEN my_fwrite1(&blklen,patterns,1,All.flag_swap,fd);
|
78
|
+
|
79
|
+
char file_suf[5]=".est";
|
80
|
+
sprintf(buf,"%s%s%s",All.InitCondFile,All.SnapshotFileBase,file_suf);
|
81
|
+
|
82
|
+
fprintf(stdout,"%s\n",buf); fflush(stdout);
|
83
|
+
if((fd=fopen(buf,"w")))
|
84
|
+
{
|
85
|
+
|
86
|
+
blklen=sizeof(header1);
|
87
|
+
BLKLEN;
|
88
|
+
my_fwrite1(&header1,patternh,1,All.flag_swap,fd);
|
89
|
+
BLKLEN;
|
90
|
+
|
91
|
+
// blklen=NumPart*3*sizeof(float);
|
92
|
+
|
93
|
+
header1.flag_dim=ND;
|
94
|
+
|
95
|
+
if(header1.flag_density==1)
|
96
|
+
{
|
97
|
+
/* densities of particles */
|
98
|
+
blklen=NumPart*sizeof(float); /* added density */
|
99
|
+
BLKLEN;
|
100
|
+
for(i=1;i<=NumPart;i++)
|
101
|
+
{
|
102
|
+
dummy[0]=P[i].Density;
|
103
|
+
my_fwrite1(&dummy[0],patterns,1,All.flag_swap,fd);
|
104
|
+
}
|
105
|
+
BLKLEN;
|
106
|
+
}
|
107
|
+
|
108
|
+
if(header1.flag_density>1)
|
109
|
+
{
|
110
|
+
for(j=0;j<header1.flag_density;j++)
|
111
|
+
{
|
112
|
+
blklen=NumPart*sizeof(float); /* added density */
|
113
|
+
BLKLEN;
|
114
|
+
for(i=1;i<=NumPart;i++)
|
115
|
+
{
|
116
|
+
// dummy[0]=Pa[i].QntSm[j];
|
117
|
+
my_fwrite1(&dummy[0],patterns,1,All.flag_swap,fd);
|
118
|
+
}
|
119
|
+
BLKLEN;
|
120
|
+
}
|
121
|
+
}
|
122
|
+
|
123
|
+
fclose(fd);
|
124
|
+
}
|
125
|
+
else
|
126
|
+
{
|
127
|
+
fprintf(stdout,"Error. Can't write in file '%s'\n", buf);
|
128
|
+
endrun(10);
|
129
|
+
}
|
130
|
+
}
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
// This function can be used to write a new output file
|
135
|
+
void savepositions_ioformat2( )
|
136
|
+
{
|
137
|
+
int i;
|
138
|
+
char buf[100];
|
139
|
+
char file_suf[5]=".est";
|
140
|
+
sprintf(buf,"%s%s%s",All.InitCondFile,All.SnapshotFileBase,file_suf);
|
141
|
+
fprintf(stdout,"%s\n",buf); fflush(stdout);
|
142
|
+
|
143
|
+
//write your own output routine here
|
144
|
+
// below is output in ascii format
|
145
|
+
|
146
|
+
ofstream fd (buf);
|
147
|
+
if (fd.is_open())
|
148
|
+
{
|
149
|
+
for(i=1;i<=NumPart;i++)
|
150
|
+
{
|
151
|
+
fd<<P[i].Density<<endl;
|
152
|
+
}
|
153
|
+
fd.close();
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
size_t my_fwrite1(void *ptr,int* pattern,size_t nmemb,int flag_swap,FILE *stream)
|
164
|
+
{
|
165
|
+
size_t nwritten,size,i;
|
166
|
+
// int i;
|
167
|
+
void* addr;
|
168
|
+
|
169
|
+
for(i=0,size=0;pattern[i]>0;i+=2)
|
170
|
+
size+=pattern[i]*pattern[i+1];
|
171
|
+
|
172
|
+
if (flag_swap==1)
|
173
|
+
{
|
174
|
+
for(i=0;i<nmemb;i++)
|
175
|
+
{
|
176
|
+
addr=(char *)ptr+i*size;
|
177
|
+
SwapEndian(addr,pattern);
|
178
|
+
}
|
179
|
+
}
|
180
|
+
|
181
|
+
|
182
|
+
if((nwritten=fwrite(ptr, size, nmemb, stream))!=nmemb)
|
183
|
+
{
|
184
|
+
printf("I/O error (fwrite) on has occured.\n");
|
185
|
+
fflush(stdout);
|
186
|
+
endrun(777);
|
187
|
+
}
|
188
|
+
|
189
|
+
if (flag_swap==1)
|
190
|
+
{
|
191
|
+
for(i=0;i<nmemb;i++)
|
192
|
+
{
|
193
|
+
addr=(char *)ptr+i*size;
|
194
|
+
SwapEndian(addr,pattern);
|
195
|
+
}
|
196
|
+
}
|
197
|
+
|
198
|
+
return nwritten;
|
199
|
+
}
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
size_t my_fread1(void *ptr, int *pattern, size_t nmemb,int flag_swap,FILE *stream)
|
204
|
+
{
|
205
|
+
size_t nread,i;
|
206
|
+
void *addr;
|
207
|
+
int size;
|
208
|
+
|
209
|
+
for(i=0,size=0;pattern[i]>0;i+=2)
|
210
|
+
size+=pattern[i]*pattern[i+1];
|
211
|
+
|
212
|
+
|
213
|
+
if((nread=fread(ptr, size, nmemb, stream))!=nmemb)
|
214
|
+
{
|
215
|
+
printf("I/O error (fread) has occured.\n");
|
216
|
+
fflush(stdout);
|
217
|
+
endrun(778);
|
218
|
+
}
|
219
|
+
|
220
|
+
|
221
|
+
if (flag_swap==1)
|
222
|
+
{
|
223
|
+
for(i=0;i<nmemb;i++)
|
224
|
+
{
|
225
|
+
addr=(char *)ptr+i*size;
|
226
|
+
SwapEndian(addr,pattern);
|
227
|
+
}
|
228
|
+
}
|
229
|
+
|
230
|
+
return nread;
|
231
|
+
}
|
232
|
+
|
233
|
+
void SwapEndian(void* addr, int* pattern)
|
234
|
+
{
|
235
|
+
int i,j=0,k;
|
236
|
+
char c;
|
237
|
+
while (pattern[j]>0)
|
238
|
+
{
|
239
|
+
for(k=0;k<pattern[j+1];k++)
|
240
|
+
{
|
241
|
+
for(i=0;i<pattern[j]/2;i++)
|
242
|
+
{
|
243
|
+
c=*((char*)addr+i);
|
244
|
+
*((char*)addr+i)=*((char*)addr+(pattern[j]-i-1));
|
245
|
+
*((char*)addr+(pattern[j]-i-1))=c;
|
246
|
+
}
|
247
|
+
addr=((char *)addr)+pattern[j];
|
248
|
+
}
|
249
|
+
j+=2;
|
250
|
+
}
|
251
|
+
}
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
Binary file
|
@@ -0,0 +1,108 @@
|
|
1
|
+
/***************************************************************************
|
2
|
+
main.cpp - description
|
3
|
+
-------------------
|
4
|
+
begin : Mon Jan 16 2006
|
5
|
+
copyright : (C) 2006 by Sanjib Sharma
|
6
|
+
email : ssharma@aip.de
|
7
|
+
***************************************************************************/
|
8
|
+
|
9
|
+
/***************************************************************************
|
10
|
+
* *
|
11
|
+
* This program is free software; you can redistribute it and/or modify *
|
12
|
+
* it under the terms of the GNU General Public License as published by *
|
13
|
+
* the Free Software Foundation; either version 2 of the License, or *
|
14
|
+
* (at your option) any later version. *
|
15
|
+
* *
|
16
|
+
***************************************************************************/
|
17
|
+
#include <stdio.h>
|
18
|
+
#include <stdlib.h>
|
19
|
+
#include <string.h>
|
20
|
+
#include <math.h>
|
21
|
+
#include "allvars.h"
|
22
|
+
#include "proto.h"
|
23
|
+
#include "tree.h"
|
24
|
+
#include "functions.h"
|
25
|
+
|
26
|
+
/* Calls begrun() */
|
27
|
+
int main(int argc, char **argv)
|
28
|
+
{
|
29
|
+
if(argc!=2)
|
30
|
+
{
|
31
|
+
fprintf(stdout,"Parameter file is missing. Usage:\n");
|
32
|
+
cout<<"./enbid <ParameterFile> [<begin_no> <end_no>] "<<endl;
|
33
|
+
exit(1);
|
34
|
+
}
|
35
|
+
strcpy(ParameterFile,argv[1]);
|
36
|
+
|
37
|
+
t00=0.0;
|
38
|
+
begrun(); /* set-up run */
|
39
|
+
cout<<"\nTotal Time = "<<t00<<" s \n"<<endl;
|
40
|
+
treefree();
|
41
|
+
free_memory();
|
42
|
+
|
43
|
+
|
44
|
+
return 0;
|
45
|
+
}
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
// int main(int argc, char **argv)
|
56
|
+
// {
|
57
|
+
// if(argc!=2)
|
58
|
+
// {
|
59
|
+
// fprintf(stdout,"Parameter file is missing. Usage:\n");
|
60
|
+
// cout<<"./enbid <ParameterFile> [<begin_no> <end_no>] "<<endl;
|
61
|
+
// exit(1);
|
62
|
+
// }
|
63
|
+
// strcpy(ParameterFile,argv[1]);
|
64
|
+
|
65
|
+
// Var.BeginFileNum=0;
|
66
|
+
// Var.EndFileNum=0;
|
67
|
+
// BatchFlag=0;
|
68
|
+
|
69
|
+
// if(argc>2)
|
70
|
+
// {
|
71
|
+
// BatchFlag=1;
|
72
|
+
// if(argc==4)
|
73
|
+
// {
|
74
|
+
// Var.BeginFileNum=atoi(argv[2]);
|
75
|
+
// Var.EndFileNum=atoi(argv[3]);
|
76
|
+
// if(Var.BeginFileNum>Var.EndFileNum)
|
77
|
+
// {
|
78
|
+
// cout<<"Final file no should be greater than inital"<<endl;
|
79
|
+
// endrun(10);
|
80
|
+
// }
|
81
|
+
// }
|
82
|
+
// else
|
83
|
+
// {
|
84
|
+
// cout<<"File numbers missing. Usage:"<<endl;
|
85
|
+
// cout<<endl;
|
86
|
+
// cout<<"./enbid <ParameterFile> [<begin_no> <end_no>] "<<endl;
|
87
|
+
// cout<<endl;
|
88
|
+
// endrun(10);
|
89
|
+
// }
|
90
|
+
// }
|
91
|
+
|
92
|
+
// for(Var.FileNum=Var.EndFileNum; Var.FileNum >= Var.BeginFileNum;Var.FileNum--)
|
93
|
+
// {
|
94
|
+
// t00=0.0;
|
95
|
+
// begrun(); /* set-up run */
|
96
|
+
// cout<<"\nTotal Time = "<<t00<<" s \n"<<endl;
|
97
|
+
// treefree();
|
98
|
+
// free_memory();
|
99
|
+
// }
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
// return 0;
|
104
|
+
// }
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
Binary file
|