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
039540fd
Commit
039540fd
authored
Feb 21, 2017
by
Matthieu Schaller
Browse files
Re-factored the UnitSytem to use the same naming convention as the rest of the code.
parent
237a73ba
Changes
33
Hide whitespace changes
Inline
Side-by-side
examples/main.c
View file @
039540fd
...
...
@@ -351,7 +351,7 @@ int main(int argc, char *argv[]) {
#endif
/* Initialize unit system and constants */
struct
U
nit
S
ystem
us
;
struct
u
nit
_s
ystem
us
;
struct
phys_const
prog_const
;
units_init
(
&
us
,
params
,
"InternalUnitSystem"
);
phys_const_init
(
&
us
,
&
prog_const
);
...
...
src/common_io.c
View file @
039540fd
...
...
@@ -294,11 +294,11 @@ void io_write_attribute_s(hid_t grp, const char* name, const char* str) {
/**
* @brief Reads the Unit System from an IC file.
* @param h_file The (opened) HDF5 file from which to read.
* @param us The
U
nit
S
ystem to fill.
* @param us The
u
nit
_s
ystem to fill.
*
* If the 'Units' group does not exist in the ICs, cgs units will be assumed
*/
void
io_read_
U
nit
S
ystem
(
hid_t
h_file
,
struct
U
nit
S
ystem
*
us
)
{
void
io_read_
u
nit
_s
ystem
(
hid_t
h_file
,
struct
u
nit
_s
ystem
*
us
)
{
hid_t
h_grp
=
H5Gopen
(
h_file
,
"/Units"
,
H5P_DEFAULT
);
...
...
@@ -334,11 +334,11 @@ void io_read_UnitSystem(hid_t h_file, struct UnitSystem* us) {
/**
* @brief Writes the current Unit System
* @param h_file The (opened) HDF5 file in which to write
* @param us The
U
nit
S
ystem to dump
* @param us The
u
nit
_s
ystem to dump
* @param groupName The name of the HDF5 group to write to
*/
void
io_write_
U
nit
S
ystem
(
hid_t
h_file
,
const
struct
U
nit
S
ystem
*
us
,
const
char
*
groupName
)
{
void
io_write_
u
nit
_s
ystem
(
hid_t
h_file
,
const
struct
u
nit
_s
ystem
*
us
,
const
char
*
groupName
)
{
hid_t
h_grpunit
=
0
;
h_grpunit
=
H5Gcreate1
(
h_file
,
groupName
,
0
);
...
...
src/common_io.h
View file @
039540fd
...
...
@@ -68,9 +68,9 @@ void io_write_attribute_s(hid_t grp, const char* name, const char* str);
void
io_write_code_description
(
hid_t
h_file
);
void
io_read_
U
nit
S
ystem
(
hid_t
h_file
,
struct
U
nit
S
ystem
*
us
);
void
io_write_
U
nit
S
ystem
(
hid_t
h_grp
,
const
struct
U
nit
S
ystem
*
us
,
const
char
*
groupName
);
void
io_read_
u
nit
_s
ystem
(
hid_t
h_file
,
struct
u
nit
_s
ystem
*
us
);
void
io_write_
u
nit
_s
ystem
(
hid_t
h_grp
,
const
struct
u
nit
_s
ystem
*
us
,
const
char
*
groupName
);
#endif
/* defined HDF5 */
...
...
src/cooling.c
View file @
039540fd
...
...
@@ -34,7 +34,7 @@
* @param cooling The cooling properties to initialize
*/
void
cooling_init
(
const
struct
swift_params
*
parameter_file
,
const
struct
U
nit
S
ystem
*
us
,
const
struct
u
nit
_s
ystem
*
us
,
const
struct
phys_const
*
phys_const
,
struct
cooling_function_data
*
cooling
)
{
...
...
src/cooling.h
View file @
039540fd
...
...
@@ -42,7 +42,7 @@
/* Common functions */
void
cooling_init
(
const
struct
swift_params
*
parameter_file
,
const
struct
U
nit
S
ystem
*
us
,
const
struct
u
nit
_s
ystem
*
us
,
const
struct
phys_const
*
phys_const
,
struct
cooling_function_data
*
cooling
);
...
...
src/cooling/const_du/cooling.h
View file @
039540fd
...
...
@@ -58,7 +58,7 @@
*/
__attribute__
((
always_inline
))
INLINE
static
void
cooling_cool_part
(
const
struct
phys_const
*
restrict
phys_const
,
const
struct
U
nit
S
ystem
*
restrict
us
,
const
struct
u
nit
_s
ystem
*
restrict
us
,
const
struct
cooling_function_data
*
restrict
cooling
,
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
float
dt
)
{
...
...
@@ -103,7 +103,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part(
__attribute__
((
always_inline
))
INLINE
static
float
cooling_timestep
(
const
struct
cooling_function_data
*
restrict
cooling
,
const
struct
phys_const
*
restrict
phys_const
,
const
struct
U
nit
S
ystem
*
restrict
us
,
const
struct
part
*
restrict
p
)
{
const
struct
u
nit
_s
ystem
*
restrict
us
,
const
struct
part
*
restrict
p
)
{
const
float
cooling_rate
=
cooling
->
cooling_rate
;
const
float
internal_energy
=
hydro_get_internal_energy
(
p
);
...
...
@@ -153,7 +153,7 @@ __attribute__((always_inline)) INLINE static float cooling_get_radiated_energy(
* @param cooling The cooling properties to initialize
*/
static
INLINE
void
cooling_init_backend
(
const
struct
swift_params
*
parameter_file
,
const
struct
U
nit
S
ystem
*
us
,
const
struct
swift_params
*
parameter_file
,
const
struct
u
nit
_s
ystem
*
us
,
const
struct
phys_const
*
phys_const
,
struct
cooling_function_data
*
cooling
)
{
...
...
src/cooling/const_lambda/cooling.h
View file @
039540fd
...
...
@@ -45,7 +45,7 @@
* @param p Pointer to the particle data..
*/
__attribute__
((
always_inline
))
INLINE
static
float
cooling_rate
(
const
struct
phys_const
*
const
phys_const
,
const
struct
U
nit
S
ystem
*
us
,
const
struct
phys_const
*
const
phys_const
,
const
struct
u
nit
_s
ystem
*
us
,
const
struct
cooling_function_data
*
cooling
,
const
struct
part
*
p
)
{
/* Get particle density */
...
...
@@ -72,7 +72,7 @@ __attribute__((always_inline)) INLINE static float cooling_rate(
*/
__attribute__
((
always_inline
))
INLINE
static
void
cooling_cool_part
(
const
struct
phys_const
*
restrict
phys_const
,
const
struct
U
nit
S
ystem
*
restrict
us
,
const
struct
u
nit
_s
ystem
*
restrict
us
,
const
struct
cooling_function_data
*
restrict
cooling
,
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
float
dt
)
{
...
...
@@ -112,7 +112,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part(
__attribute__
((
always_inline
))
INLINE
static
float
cooling_timestep
(
const
struct
cooling_function_data
*
restrict
cooling
,
const
struct
phys_const
*
restrict
phys_const
,
const
struct
U
nit
S
ystem
*
restrict
us
,
const
struct
part
*
restrict
p
)
{
const
struct
u
nit
_s
ystem
*
restrict
us
,
const
struct
part
*
restrict
p
)
{
/* Get current internal energy */
const
float
u
=
hydro_get_internal_energy
(
p
);
...
...
@@ -158,7 +158,7 @@ __attribute__((always_inline)) INLINE static float cooling_get_radiated_energy(
* @param cooling The cooling properties to initialize
*/
static
INLINE
void
cooling_init_backend
(
const
struct
swift_params
*
parameter_file
,
const
struct
U
nit
S
ystem
*
us
,
const
struct
swift_params
*
parameter_file
,
const
struct
u
nit
_s
ystem
*
us
,
const
struct
phys_const
*
phys_const
,
struct
cooling_function_data
*
cooling
)
{
...
...
src/cooling/none/cooling.h
View file @
039540fd
...
...
@@ -49,7 +49,7 @@
*/
__attribute__
((
always_inline
))
INLINE
static
void
cooling_cool_part
(
const
struct
phys_const
*
restrict
phys_const
,
const
struct
U
nit
S
ystem
*
restrict
us
,
const
struct
u
nit
_s
ystem
*
restrict
us
,
const
struct
cooling_function_data
*
restrict
cooling
,
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
float
dt
)
{}
...
...
@@ -66,7 +66,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part(
__attribute__
((
always_inline
))
INLINE
static
float
cooling_timestep
(
const
struct
cooling_function_data
*
restrict
cooling
,
const
struct
phys_const
*
restrict
phys_const
,
const
struct
U
nit
S
ystem
*
restrict
us
,
const
struct
part
*
restrict
p
)
{
const
struct
u
nit
_s
ystem
*
restrict
us
,
const
struct
part
*
restrict
p
)
{
return
FLT_MAX
;
}
...
...
@@ -107,7 +107,7 @@ __attribute__((always_inline)) INLINE static float cooling_get_radiated_energy(
* @param cooling The cooling properties to initialize
*/
static
INLINE
void
cooling_init_backend
(
const
struct
swift_params
*
parameter_file
,
const
struct
U
nit
S
ystem
*
us
,
const
struct
swift_params
*
parameter_file
,
const
struct
u
nit
_s
ystem
*
us
,
const
struct
phys_const
*
phys_const
,
struct
cooling_function_data
*
cooling
)
{}
...
...
src/engine.c
View file @
039540fd
...
...
@@ -3351,16 +3351,16 @@ void engine_dump_snapshot(struct engine *e) {
/* Dump... */
#if defined(WITH_MPI)
#if defined(HAVE_PARALLEL_HDF5)
write_output_parallel
(
e
,
e
->
snapshotBaseName
,
e
->
internal
U
nits
,
write_output_parallel
(
e
,
e
->
snapshotBaseName
,
e
->
internal
_u
nits
,
e
->
snapshotUnits
,
e
->
nodeID
,
e
->
nr_nodes
,
MPI_COMM_WORLD
,
MPI_INFO_NULL
);
#else
write_output_serial
(
e
,
e
->
snapshotBaseName
,
e
->
internal
U
nits
,
write_output_serial
(
e
,
e
->
snapshotBaseName
,
e
->
internal
_u
nits
,
e
->
snapshotUnits
,
e
->
nodeID
,
e
->
nr_nodes
,
MPI_COMM_WORLD
,
MPI_INFO_NULL
);
#endif
#else
write_output_single
(
e
,
e
->
snapshotBaseName
,
e
->
internal
U
nits
,
write_output_single
(
e
,
e
->
snapshotBaseName
,
e
->
internal
_u
nits
,
e
->
snapshotUnits
);
#endif
...
...
@@ -3448,7 +3448,7 @@ void engine_unpin() {
void
engine_init
(
struct
engine
*
e
,
struct
space
*
s
,
const
struct
swift_params
*
params
,
int
nr_nodes
,
int
nodeID
,
int
nr_threads
,
int
with_aff
,
int
policy
,
int
verbose
,
const
struct
U
nit
S
ystem
*
internal_units
,
const
struct
u
nit
_s
ystem
*
internal_units
,
const
struct
phys_const
*
physical_constants
,
const
struct
hydro_props
*
hydro
,
const
struct
external_potential
*
potential
,
...
...
@@ -3480,7 +3480,7 @@ void engine_init(struct engine *e, struct space *s,
e
->
timeStep
=
0
.;
e
->
timeBase
=
0
.;
e
->
timeBase_inv
=
0
.;
e
->
internal
U
nits
=
internal_units
;
e
->
internal
_u
nits
=
internal_units
;
e
->
timeFirstSnapshot
=
parser_get_param_double
(
params
,
"Snapshots:time_first"
);
e
->
deltaTimeSnapshot
=
...
...
@@ -3489,7 +3489,7 @@ void engine_init(struct engine *e, struct space *s,
parser_get_param_string
(
params
,
"Snapshots:basename"
,
e
->
snapshotBaseName
);
e
->
snapshotCompression
=
parser_get_opt_param_int
(
params
,
"Snapshots:compression"
,
0
);
e
->
snapshotUnits
=
malloc
(
sizeof
(
struct
U
nit
S
ystem
));
e
->
snapshotUnits
=
malloc
(
sizeof
(
struct
u
nit
_s
ystem
));
units_init_default
(
e
->
snapshotUnits
,
params
,
"Snapshots"
,
internal_units
);
e
->
dt_min
=
parser_get_param_double
(
params
,
"TimeIntegration:dt_min"
);
e
->
dt_max
=
parser_get_param_double
(
params
,
"TimeIntegration:dt_max"
);
...
...
src/engine.h
View file @
039540fd
...
...
@@ -135,7 +135,7 @@ struct engine {
size_t
updates
,
g_updates
,
s_updates
;
/* The internal system of units */
const
struct
U
nit
S
ystem
*
internal
U
nits
;
const
struct
u
nit
_s
ystem
*
internal
_u
nits
;
/* Snapshot information */
double
timeFirstSnapshot
;
...
...
@@ -143,7 +143,7 @@ struct engine {
integertime_t
ti_nextSnapshot
;
char
snapshotBaseName
[
200
];
int
snapshotCompression
;
struct
U
nit
S
ystem
*
snapshotUnits
;
struct
u
nit
_s
ystem
*
snapshotUnits
;
/* Statistics information */
FILE
*
file_stats
;
...
...
@@ -219,7 +219,7 @@ void engine_dump_snapshot(struct engine *e);
void
engine_init
(
struct
engine
*
e
,
struct
space
*
s
,
const
struct
swift_params
*
params
,
int
nr_nodes
,
int
nodeID
,
int
nr_threads
,
int
with_aff
,
int
policy
,
int
verbose
,
const
struct
U
nit
S
ystem
*
internal_units
,
const
struct
u
nit
_s
ystem
*
internal_units
,
const
struct
phys_const
*
physical_constants
,
const
struct
hydro_props
*
hydro
,
const
struct
external_potential
*
potential
,
...
...
src/io_properties.h
View file @
039540fd
...
...
@@ -47,7 +47,7 @@ struct io_props {
enum
DATA_IMPORTANCE
importance
;
/* Units of the quantity */
enum
U
nit
C
onversion
F
actor
units
;
enum
u
nit
_c
onversion
_f
actor
units
;
/* Pointer to the field of the first particle in the array */
char
*
field
;
...
...
@@ -89,7 +89,7 @@ struct io_props {
struct
io_props
io_make_input_field_
(
char
name
[
FIELD_BUFFER_SIZE
],
enum
IO_DATA_TYPE
type
,
int
dimension
,
enum
DATA_IMPORTANCE
importance
,
enum
U
nit
C
onversion
F
actor
units
,
enum
u
nit
_c
onversion
_f
actor
units
,
char
*
field
,
size_t
partSize
)
{
struct
io_props
r
;
strcpy
(
r
.
name
,
name
);
...
...
@@ -128,7 +128,7 @@ struct io_props io_make_input_field_(char name[FIELD_BUFFER_SIZE],
*/
struct
io_props
io_make_output_field_
(
char
name
[
FIELD_BUFFER_SIZE
],
enum
IO_DATA_TYPE
type
,
int
dimension
,
enum
U
nit
C
onversion
F
actor
units
,
enum
u
nit
_c
onversion
_f
actor
units
,
char
*
field
,
size_t
partSize
)
{
struct
io_props
r
;
strcpy
(
r
.
name
,
name
);
...
...
@@ -171,7 +171,7 @@ struct io_props io_make_output_field_(char name[FIELD_BUFFER_SIZE],
*/
struct
io_props
io_make_output_field_convert_part_
(
char
name
[
FIELD_BUFFER_SIZE
],
enum
IO_DATA_TYPE
type
,
int
dimension
,
enum
U
nit
C
onversion
F
actor
units
,
char
*
field
,
size_t
partSize
,
enum
u
nit
_c
onversion
_f
actor
units
,
char
*
field
,
size_t
partSize
,
struct
part
*
parts
,
float
(
*
functionPtr
)(
struct
engine
*
,
struct
part
*
))
{
struct
io_props
r
;
...
...
@@ -215,7 +215,7 @@ struct io_props io_make_output_field_convert_part_(
*/
struct
io_props
io_make_output_field_convert_gpart_
(
char
name
[
FIELD_BUFFER_SIZE
],
enum
IO_DATA_TYPE
type
,
int
dimension
,
enum
U
nit
C
onversion
F
actor
units
,
char
*
field
,
size_t
partSize
,
enum
u
nit
_c
onversion
_f
actor
units
,
char
*
field
,
size_t
partSize
,
struct
gpart
*
gparts
,
float
(
*
functionPtr
)(
struct
engine
*
,
struct
gpart
*
))
{
struct
io_props
r
;
...
...
src/parallel_io.c
View file @
039540fd
...
...
@@ -71,8 +71,8 @@
*/
void
readArray
(
hid_t
grp
,
const
struct
io_props
prop
,
size_t
N
,
long
long
N_total
,
long
long
offset
,
const
struct
U
nit
S
ystem
*
internal_units
,
const
struct
U
nit
S
ystem
*
ic_units
)
{
const
struct
u
nit
_s
ystem
*
internal_units
,
const
struct
u
nit
_s
ystem
*
ic_units
)
{
const
size_t
typeSize
=
io_sizeof_type
(
prop
.
type
);
const
size_t
copySize
=
typeSize
*
prop
.
dimension
;
...
...
@@ -191,8 +191,8 @@ void readArray(hid_t grp, const struct io_props prop, size_t N,
* @param N The number of particles to write.
* @param N_total Total number of particles across all cores
* @param offset Offset in the array where this mpi task starts writing
* @param internal_units The #
U
nit
S
ystem used internally
* @param snapshot_units The #
U
nit
S
ystem used in the snapshots
* @param internal_units The #
u
nit
_s
ystem used internally
* @param snapshot_units The #
u
nit
_s
ystem used in the snapshots
*
* @todo A better version using HDF5 hyper-slabs to write the file directly from
* the part array will be written once the structures have been stabilized.
...
...
@@ -201,8 +201,8 @@ void readArray(hid_t grp, const struct io_props prop, size_t N,
void
writeArray
(
struct
engine
*
e
,
hid_t
grp
,
char
*
fileName
,
FILE
*
xmfFile
,
char
*
partTypeGroupName
,
const
struct
io_props
props
,
size_t
N
,
long
long
N_total
,
int
mpi_rank
,
long
long
offset
,
const
struct
U
nit
S
ystem
*
internal_units
,
const
struct
U
nit
S
ystem
*
snapshot_units
)
{
const
struct
u
nit
_s
ystem
*
internal_units
,
const
struct
u
nit
_s
ystem
*
snapshot_units
)
{
const
size_t
typeSize
=
io_sizeof_type
(
props
.
type
);
const
size_t
copySize
=
typeSize
*
props
.
dimension
;
...
...
@@ -374,7 +374,7 @@ void writeArray(struct engine* e, hid_t grp, char* fileName, FILE* xmfFile,
* Calls #error() if an error occurs.
*
*/
void
read_ic_parallel
(
char
*
fileName
,
const
struct
U
nit
S
ystem
*
internal_units
,
void
read_ic_parallel
(
char
*
fileName
,
const
struct
u
nit
_s
ystem
*
internal_units
,
double
dim
[
3
],
struct
part
**
parts
,
struct
gpart
**
gparts
,
struct
spart
**
sparts
,
size_t
*
Ngas
,
size_t
*
Ngparts
,
size_t
*
Nstars
,
int
*
periodic
,
int
*
flag_entropy
,
...
...
@@ -458,9 +458,9 @@ void read_ic_parallel(char* fileName, const struct UnitSystem* internal_units,
H5Gclose
(
h_grp
);
/* Read the unit system used in the ICs */
struct
U
nit
S
ystem
*
ic_units
=
malloc
(
sizeof
(
struct
U
nit
S
ystem
));
struct
u
nit
_s
ystem
*
ic_units
=
malloc
(
sizeof
(
struct
u
nit
_s
ystem
));
if
(
ic_units
==
NULL
)
error
(
"Unable to allocate memory for IC unit system"
);
io_read_
U
nit
S
ystem
(
h_file
,
ic_units
);
io_read_
u
nit
_s
ystem
(
h_file
,
ic_units
);
/* Tell the user if a conversion will be needed */
if
(
mpi_rank
==
0
)
{
...
...
@@ -620,8 +620,8 @@ void read_ic_parallel(char* fileName, const struct UnitSystem* internal_units,
*
* @param e The engine containing all the system.
* @param baseName The common part of the snapshot file name.
* @param internal_units The #
U
nit
S
ystem used internally
* @param snapshot_units The #
U
nit
S
ystem used in the snapshots
* @param internal_units The #
u
nit
_s
ystem used internally
* @param snapshot_units The #
u
nit
_s
ystem used in the snapshots
* @param mpi_rank The MPI rank of this node.
* @param mpi_size The number of MPI ranks.
* @param comm The MPI communicator.
...
...
@@ -636,8 +636,8 @@ void read_ic_parallel(char* fileName, const struct UnitSystem* internal_units,
*
*/
void
write_output_parallel
(
struct
engine
*
e
,
const
char
*
baseName
,
const
struct
U
nit
S
ystem
*
internal_units
,
const
struct
U
nit
S
ystem
*
snapshot_units
,
const
struct
u
nit
_s
ystem
*
internal_units
,
const
struct
u
nit
_s
ystem
*
snapshot_units
,
int
mpi_rank
,
int
mpi_size
,
MPI_Comm
comm
,
MPI_Info
info
)
{
...
...
@@ -765,10 +765,10 @@ void write_output_parallel(struct engine* e, const char* baseName,
H5Gclose
(
h_grp
);
/* Print the system of Units used in the spashot */
io_write_
U
nit
S
ystem
(
h_file
,
snapshot_units
,
"Units"
);
io_write_
u
nit
_s
ystem
(
h_file
,
snapshot_units
,
"Units"
);
/* Print the system of Units used internally */
io_write_
U
nit
S
ystem
(
h_file
,
internal_units
,
"InternalCodeUnits"
);
io_write_
u
nit
_s
ystem
(
h_file
,
internal_units
,
"InternalCodeUnits"
);
/* Tell the user if a conversion will be needed */
if
(
e
->
verbose
&&
mpi_rank
==
0
)
{
...
...
src/parallel_io.h
View file @
039540fd
...
...
@@ -34,7 +34,7 @@
#if defined(HAVE_HDF5) && defined(WITH_MPI) && defined(HAVE_PARALLEL_HDF5)
void
read_ic_parallel
(
char
*
fileName
,
const
struct
U
nit
S
ystem
*
internal_units
,
void
read_ic_parallel
(
char
*
fileName
,
const
struct
u
nit
_s
ystem
*
internal_units
,
double
dim
[
3
],
struct
part
**
parts
,
struct
gpart
**
gparts
,
struct
spart
**
sparts
,
size_t
*
Ngas
,
size_t
*
Ngparts
,
size_t
*
Nsparts
,
int
*
periodic
,
int
*
flag_entropy
,
...
...
@@ -43,8 +43,8 @@ void read_ic_parallel(char* fileName, const struct UnitSystem* internal_units,
int
dry_run
);
void
write_output_parallel
(
struct
engine
*
e
,
const
char
*
baseName
,
const
struct
U
nit
S
ystem
*
internal_units
,
const
struct
U
nit
S
ystem
*
snapshot_units
,
const
struct
u
nit
_s
ystem
*
internal_units
,
const
struct
u
nit
_s
ystem
*
snapshot_units
,
int
mpi_rank
,
int
mpi_size
,
MPI_Comm
comm
,
MPI_Info
info
);
#endif
...
...
src/physical_constants.c
View file @
039540fd
...
...
@@ -34,7 +34,8 @@
* @param us The current internal system of units.
* @param internal_const The physical constants to initialize.
*/
void
phys_const_init
(
struct
UnitSystem
*
us
,
struct
phys_const
*
internal_const
)
{
void
phys_const_init
(
struct
unit_system
*
us
,
struct
phys_const
*
internal_const
)
{
/* Units are declared as {U_M, U_L, U_t, U_I, U_T} */
...
...
src/physical_constants.h
View file @
039540fd
...
...
@@ -78,7 +78,7 @@ struct phys_const {
double
const_earth_mass
;
};
void
phys_const_init
(
struct
U
nit
S
ystem
*
us
,
struct
phys_const
*
internal_const
);
void
phys_const_init
(
struct
u
nit
_s
ystem
*
us
,
struct
phys_const
*
internal_const
);
void
phys_const_print
(
struct
phys_const
*
internal_const
);
...
...
src/potential.c
View file @
039540fd
...
...
@@ -36,7 +36,7 @@
*/
void
potential_init
(
const
struct
swift_params
*
parameter_file
,
const
struct
phys_const
*
phys_const
,
const
struct
U
nit
S
ystem
*
us
,
const
struct
space
*
s
,
const
struct
u
nit
_s
ystem
*
us
,
const
struct
space
*
s
,
struct
external_potential
*
potential
)
{
potential_init_backend
(
parameter_file
,
phys_const
,
us
,
s
,
potential
);
...
...
src/potential.h
View file @
039540fd
...
...
@@ -43,7 +43,7 @@
/* Now, some generic functions, defined in the source file */
void
potential_init
(
const
struct
swift_params
*
parameter_file
,
const
struct
phys_const
*
phys_const
,
const
struct
U
nit
S
ystem
*
us
,
const
struct
space
*
s
,
const
struct
u
nit
_s
ystem
*
us
,
const
struct
space
*
s
,
struct
external_potential
*
potential
);
void
potential_print
(
const
struct
external_potential
*
potential
);
...
...
src/potential/disc_patch/potential.h
View file @
039540fd
...
...
@@ -195,7 +195,7 @@ external_gravity_get_potential_energy(
*/
static
INLINE
void
potential_init_backend
(
const
struct
swift_params
*
parameter_file
,
const
struct
phys_const
*
phys_const
,
const
struct
U
nit
S
ystem
*
us
,
const
struct
phys_const
*
phys_const
,
const
struct
u
nit
_s
ystem
*
us
,
const
struct
space
*
s
,
struct
external_potential
*
potential
)
{
potential
->
surface_density
=
parser_get_param_double
(
...
...
src/potential/isothermal/potential.h
View file @
039540fd
...
...
@@ -163,7 +163,7 @@ external_gravity_get_potential_energy(
*/
static
INLINE
void
potential_init_backend
(
const
struct
swift_params
*
parameter_file
,
const
struct
phys_const
*
phys_const
,
const
struct
U
nit
S
ystem
*
us
,
const
struct
phys_const
*
phys_const
,
const
struct
u
nit
_s
ystem
*
us
,
const
struct
space
*
s
,
struct
external_potential
*
potential
)
{
potential
->
x
=
...
...
src/potential/none/potential.h
View file @
039540fd
...
...
@@ -99,7 +99,7 @@ external_gravity_get_potential_energy(
*/
static
INLINE
void
potential_init_backend
(
const
struct
swift_params
*
parameter_file
,
const
struct
phys_const
*
phys_const
,
const
struct
U
nit
S
ystem
*
us
,
const
struct
phys_const
*
phys_const
,
const
struct
u
nit
_s
ystem
*
us
,
const
struct
space
*
s
,
struct
external_potential
*
potential
)
{}
/**
...
...
Prev
1
2
Next
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