Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
a8734760
Commit
a8734760
authored
Apr 01, 2017
by
Matthieu Schaller
Browse files
sort.h renamed to sort_part.h. Moved the direction information functions to sort_part.h
parent
cb0c811f
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/Makefile.am
View file @
a8734760
...
...
@@ -45,7 +45,7 @@ include_HEADERS = space.h runner.h queue.h task.h lock.h cell.h part.h const.h \
physical_constants.h physical_constants_cgs.h potential.h version.h
\
hydro_properties.h riemann.h threadpool.h cooling.h cooling_struct.h sourceterms.h
\
sourceterms_struct.h statistics.h memswap.h cache.h runner_doiact_vec.h profiler.h
\
dump.h logger.h active.h timeline.h sort.h xmf.h gravity_properties.h gravity_derivatives.h
dump.h logger.h active.h timeline.h sort
_part
.h xmf.h gravity_properties.h gravity_derivatives.h
# Common source files
AM_SOURCES
=
space.c runner.c queue.c task.c cell.c engine.c
\
...
...
src/cache.h
View file @
a8734760
...
...
@@ -26,7 +26,7 @@
#include
"cell.h"
#include
"error.h"
#include
"part.h"
#include
"sort.h"
#include
"sort
_part
.h"
#include
"vector.h"
#define NUM_VEC_PROC 2
...
...
src/runner.c
View file @
a8734760
...
...
@@ -55,6 +55,7 @@
#include
"minmax.h"
#include
"runner_doiact_vec.h"
#include
"scheduler.h"
#include
"sort_part.h"
#include
"sourceterms.h"
#include
"space.h"
#include
"stars.h"
...
...
src/runner.h
View file @
a8734760
...
...
@@ -24,7 +24,6 @@
#define SWIFT_RUNNER_H
#include
"cache.h"
#include
"sort.h"
extern
const
double
runner_shift
[
13
][
3
];
extern
const
char
runner_flip
[
27
];
...
...
src/sort.h
→
src/sort
_part
.h
View file @
a8734760
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 201
2 Pedro Gonnet (pedro.gonnet
@durham.ac.uk)
* Copyright (c) 201
7 James S. Wills (james.s.willis
@durham.ac.uk)
* Matthieu Schaller (matthieu.schaller@durham.ac.uk)
* 2015 Peter W. Draper (p.w.draper@durham.ac.uk)
* 2016 John A. Regan (john.a.regan@durham.ac.uk)
* Tom Theuns (tom.theuns@durham.ac.uk)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
...
...
@@ -20,11 +17,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_SORT_H
#define SWIFT_SORT_H
#ifndef SWIFT_SORT_
PART_
H
#define SWIFT_SORT_
PART_
H
/**
* @brief
Entry in a list of sorted indices.
* @brief Entry in a list of sorted indices.
*/
struct
entry
{
...
...
@@ -35,4 +32,38 @@ struct entry {
int
i
;
};
#endif
/**
* @brief Determines whether a pair of cells are corner to corner.
*
* @param sid sort ID
*
* @return 1 if corner to corner, 0 otherwise.
*/
__attribute__
((
always_inline
))
INLINE
static
int
sort_is_corner
(
int
sid
)
{
return
(
sid
==
0
||
sid
==
2
||
sid
==
6
||
sid
==
8
);
}
/**
* @brief Determines whether a pair of cells are edge to edge.
*
* @param sid sort ID
*
* @return 1 if edge to edge, 0 otherwise.
*/
__attribute__
((
always_inline
))
INLINE
static
int
sort_is_edge
(
int
sid
)
{
return
(
sid
==
1
||
sid
==
3
||
sid
==
5
||
sid
==
7
||
sid
==
9
||
sid
==
11
);
}
/**
* @brief Determines whether a pair of cells are face to face.
*
* @param sid sort ID
*
* @return 1 if face to face, 0 otherwise.
*/
__attribute__
((
always_inline
))
INLINE
static
int
sort_is_face
(
int
sid
)
{
return
(
sid
==
4
||
sid
==
10
||
sid
==
12
);
}
#endif
/* SWIFT_SORT_PART_H */
src/space.c
View file @
a8734760
...
...
@@ -171,17 +171,6 @@ int space_getsid(struct space *s, struct cell **ci, struct cell **cj,
return
sid
;
}
/**
* @brief Determines whether a pair of cells are corner to corner.
*
* @param sort ID
*
* @return True if corner to corner
*/
int
space_iscorner
(
int
sid
)
{
return
(
sid
==
0
||
sid
==
2
||
sid
==
6
||
sid
==
8
);
}
/**
* @brief Recursively dismantle a cell tree.
*
...
...
@@ -2111,10 +2100,10 @@ void space_split_recursive(struct space *s, struct cell *c,
for
(
int
k
=
0
;
k
<
8
;
++
k
)
{
if
(
c
->
progeny
[
k
]
!=
NULL
)
{
const
struct
gravity_tensors
*
m
=
c
->
progeny
[
k
]
->
multipole
;
CoM
[
0
]
+=
m
->
CoM
[
0
]
*
m
->
m_pole
.
mass
;
CoM
[
1
]
+=
m
->
CoM
[
1
]
*
m
->
m_pole
.
mass
;
CoM
[
2
]
+=
m
->
CoM
[
2
]
*
m
->
m_pole
.
mass
;
mass
+=
m
->
m_pole
.
mass
;
CoM
[
0
]
+=
m
->
CoM
[
0
]
*
m
->
m_pole
.
M_000
;
CoM
[
1
]
+=
m
->
CoM
[
1
]
*
m
->
m_pole
.
M_000
;
CoM
[
2
]
+=
m
->
CoM
[
2
]
*
m
->
m_pole
.
M_000
;
mass
+=
m
->
m_pole
.
M_000
;
}
}
c
->
multipole
->
CoM
[
0
]
=
CoM
[
0
]
/
mass
;
...
...
@@ -2703,6 +2692,8 @@ void space_init(struct space *s, const struct swift_params *params,
bzero
(
s
->
xparts
,
Npart
*
sizeof
(
struct
xpart
));
}
hydro_space_init
(
&
s
->
hs
,
s
);
/* Set the particles in a state where they are ready for a run */
space_init_parts
(
s
);
space_init_xparts
(
s
);
...
...
src/space.h
View file @
a8734760
...
...
@@ -31,6 +31,7 @@
/* Includes. */
#include
"cell.h"
#include
"hydro_space.h"
#include
"lock.h"
#include
"parser.h"
#include
"part.h"
...
...
@@ -69,12 +70,12 @@ struct space {
/*! Is the space periodic? */
int
periodic
;
/*! Extra space information needed for some hydro schemes. */
struct
hydro_space
hs
;
/*! Are we doing gravity? */
int
gravity
;
/*! Total mass in the system */
double
total_mass
;
/*! Width of the top-level cells. */
double
width
[
3
];
...
...
@@ -169,7 +170,6 @@ void space_gparts_sort(struct space *s, int *ind, size_t N, int min, int max,
void
space_sparts_sort
(
struct
space
*
s
,
int
*
ind
,
size_t
N
,
int
min
,
int
max
,
int
verbose
);
void
space_getcells
(
struct
space
*
s
,
int
nr_cells
,
struct
cell
**
cells
);
int
space_iscorner
(
int
sid
);
int
space_getsid
(
struct
space
*
s
,
struct
cell
**
ci
,
struct
cell
**
cj
,
double
*
shift
);
void
space_init
(
struct
space
*
s
,
const
struct
swift_params
*
params
,
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment