Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
bb460b71
Commit
bb460b71
authored
12 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
sneaky bug.
Former-commit-id: 4b14caa70215eede9b30d1e82b842e5fa5790e26
parent
cec63bda
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/io.c
+7
-3
7 additions, 3 deletions
src/io.c
src/space.c
+2
-1
2 additions, 1 deletion
src/space.c
with
9 additions
and
4 deletions
src/io.c
+
7
−
3
View file @
bb460b71
...
@@ -271,7 +271,7 @@ void readArrayBackEnd(hid_t grp, char* name, enum DATA_TYPE type, int N, int dim
...
@@ -271,7 +271,7 @@ void readArrayBackEnd(hid_t grp, char* name, enum DATA_TYPE type, int N, int dim
void
read_ic
(
char
*
fileName
,
double
dim
[
3
],
struct
part
**
parts
,
int
*
N
,
int
*
periodic
)
void
read_ic
(
char
*
fileName
,
double
dim
[
3
],
struct
part
**
parts
,
int
*
N
,
int
*
periodic
)
{
{
hid_t
h_file
=
0
,
h_grp
=
0
;
hid_t
h_file
=
0
,
h_grp
=
0
;
double
boxSize
=
0
.
;
/* GADGET has only cubic boxes (in cosmological mode) */
double
boxSize
[
3
]
=
{
0
.,
-
1
,
-
1
}
;
/* GADGET has only cubic boxes (in cosmological mode) */
int
numParticles
[
6
]
=
{
0
};
/* GADGET has 6 particle types. We only keep the type 0*/
int
numParticles
[
6
]
=
{
0
};
/* GADGET has 6 particle types. We only keep the type 0*/
/* Open file */
/* Open file */
...
@@ -303,11 +303,15 @@ void read_ic ( char* fileName, double dim[3], struct part **parts, int* N, int*
...
@@ -303,11 +303,15 @@ void read_ic ( char* fileName, double dim[3], struct part **parts, int* N, int*
error
(
"Error while opening file header
\n
"
);
error
(
"Error while opening file header
\n
"
);
/* Read the relevant information and print status */
/* Read the relevant information and print status */
readAttribute
(
h_grp
,
"BoxSize"
,
DOUBLE
,
&
boxSize
);
readAttribute
(
h_grp
,
"BoxSize"
,
DOUBLE
,
boxSize
);
readAttribute
(
h_grp
,
"NumPart_Total"
,
UINT
,
numParticles
);
readAttribute
(
h_grp
,
"NumPart_Total"
,
UINT
,
numParticles
);
*
N
=
numParticles
[
0
];
*
N
=
numParticles
[
0
];
dim
[
0
]
=
dim
[
1
]
=
dim
[
2
]
=
boxSize
;
dim
[
0
]
=
boxSize
[
0
];
if
(
boxSize
[
1
]
<
0
)
dim
[
1
]
=
boxSize
[
0
];
if
(
boxSize
[
2
]
<
0
)
dim
[
2
]
=
boxSize
[
0
];
/* printf("read_ic: Found %d particles in a %speriodic box of size [%f %f %f]\n", */
/* printf("read_ic: Found %d particles in a %speriodic box of size [%f %f %f]\n", */
/* *N, (periodic ? "": "non-"), dim[0], dim[1], dim[2]); */
/* *N, (periodic ? "": "non-"), dim[0], dim[1], dim[2]); */
...
...
This diff is collapsed.
Click to expand it.
src/space.c
+
2
−
1
View file @
bb460b71
...
@@ -377,7 +377,7 @@ void space_rebuild ( struct space *s , double cell_max ) {
...
@@ -377,7 +377,7 @@ void space_rebuild ( struct space *s , double cell_max ) {
/* Do we need to re-build the upper-level cells? */
/* Do we need to re-build the upper-level cells? */
// tic = getticks();
// tic = getticks();
if
(
s
->
cells
==
NULL
||
if
(
1
||
s
->
cells
==
NULL
||
cdim
[
0
]
<
s
->
cdim
[
0
]
||
cdim
[
1
]
<
s
->
cdim
[
1
]
||
cdim
[
2
]
<
s
->
cdim
[
2
]
)
{
cdim
[
0
]
<
s
->
cdim
[
0
]
||
cdim
[
1
]
<
s
->
cdim
[
1
]
||
cdim
[
2
]
<
s
->
cdim
[
2
]
)
{
/* Free the old cells, if they were allocated. */
/* Free the old cells, if they were allocated. */
...
@@ -451,6 +451,7 @@ void space_rebuild ( struct space *s , double cell_max ) {
...
@@ -451,6 +451,7 @@ void space_rebuild ( struct space *s , double cell_max ) {
error
(
"Failed to allocate temporary particle indices."
);
error
(
"Failed to allocate temporary particle indices."
);
ih
[
0
]
=
s
->
ih
[
0
];
ih
[
1
]
=
s
->
ih
[
1
];
ih
[
2
]
=
s
->
ih
[
2
];
ih
[
0
]
=
s
->
ih
[
0
];
ih
[
1
]
=
s
->
ih
[
1
];
ih
[
2
]
=
s
->
ih
[
2
];
dim
[
0
]
=
s
->
dim
[
0
];
dim
[
1
]
=
s
->
dim
[
1
];
dim
[
2
]
=
s
->
dim
[
2
];
dim
[
0
]
=
s
->
dim
[
0
];
dim
[
1
]
=
s
->
dim
[
1
];
dim
[
2
]
=
s
->
dim
[
2
];
cdim
[
0
]
=
s
->
cdim
[
0
];
cdim
[
1
]
=
s
->
cdim
[
1
];
cdim
[
2
]
=
s
->
cdim
[
2
];
#pragma omp parallel for private(p,j)
#pragma omp parallel for private(p,j)
for
(
k
=
0
;
k
<
nr_parts
;
k
++
)
{
for
(
k
=
0
;
k
<
nr_parts
;
k
++
)
{
p
=
&
parts
[
k
];
p
=
&
parts
[
k
];
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment