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
43d2c7e0
Commit
43d2c7e0
authored
Aug 18, 2016
by
Matthieu Schaller
Browse files
Check that the code and ICs have the same dimensitonality
parent
8f88c063
Changes
21
Hide whitespace changes
Inline
Side-by-side
examples/BigCosmoVolume/makeIC.py
View file @
43d2c7e0
...
...
@@ -133,6 +133,7 @@ grp.attrs["Time"] = 0.0
grp
.
attrs
[
"NumFilesPerSnapshot"
]
=
1
grp
.
attrs
[
"MassTable"
]
=
[
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
]
grp
.
attrs
[
"Flag_Entropy_ICs"
]
=
0
grp
.
attrs
[
"Dimension"
]
=
3
#Runtime parameters
grp
=
file
.
create_group
(
"/RuntimePars"
)
...
...
examples/ExternalPointMass/makeIC.py
View file @
43d2c7e0
...
...
@@ -83,7 +83,7 @@ grp.attrs["Time"] = 0.0
grp
.
attrs
[
"NumFilesPerSnapshot"
]
=
1
grp
.
attrs
[
"MassTable"
]
=
[
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
]
grp
.
attrs
[
"Flag_Entropy_ICs"
]
=
[
0
,
0
,
0
,
0
,
0
,
0
]
grp
.
attrs
[
"Dimension"
]
=
3
#Runtime parameters
grp
=
file
.
create_group
(
"/RuntimePars"
)
...
...
examples/GreshoVortex_2D/makeIC.py
View file @
43d2c7e0
...
...
@@ -87,6 +87,7 @@ grp.attrs["Time"] = 0.0
grp
.
attrs
[
"NumFileOutputsPerSnapshot"
]
=
1
grp
.
attrs
[
"MassTable"
]
=
[
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
]
grp
.
attrs
[
"Flag_Entropy_ICs"
]
=
[
0
,
0
,
0
,
0
,
0
,
0
]
grp
.
attrs
[
"Dimension"
]
=
2
#Runtime parameters
grp
=
fileOutput
.
create_group
(
"/RuntimePars"
)
...
...
examples/IsothermalPotential/GravityOnly/makeIC.py
View file @
43d2c7e0
...
...
@@ -101,7 +101,7 @@ grp.attrs["Time"] = 0.0
grp
.
attrs
[
"NumFilesPerSnapshot"
]
=
1
grp
.
attrs
[
"MassTable"
]
=
[
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
]
grp
.
attrs
[
"Flag_Entropy_ICs"
]
=
[
0
,
0
,
0
,
0
,
0
,
0
]
grp
.
attrs
[
"Dimension"
]
=
3
#Runtime parameters
grp
=
file
.
create_group
(
"/RuntimePars"
)
...
...
examples/KelvinHelmholtz_2D/makeIC.py
View file @
43d2c7e0
...
...
@@ -120,6 +120,7 @@ grp.attrs["Time"] = 0.0
grp
.
attrs
[
"NumFileOutputsPerSnapshot"
]
=
1
grp
.
attrs
[
"MassTable"
]
=
[
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
]
grp
.
attrs
[
"Flag_Entropy_ICs"
]
=
[
0
,
0
,
0
,
0
,
0
,
0
]
grp
.
attrs
[
"Dimension"
]
=
2
#Runtime parameters
grp
=
fileOutput
.
create_group
(
"/RuntimePars"
)
...
...
examples/MultiTypes/makeIC.py
View file @
43d2c7e0
...
...
@@ -61,6 +61,7 @@ grp.attrs["Time"] = 0.0
grp
.
attrs
[
"NumFilesPerSnapshot"
]
=
1
grp
.
attrs
[
"MassTable"
]
=
[
0.0
,
massDM
,
0.0
,
0.0
,
0.0
,
0.0
]
grp
.
attrs
[
"Flag_Entropy_ICs"
]
=
0
grp
.
attrs
[
"Dimension"
]
=
3
#Runtime parameters
grp
=
file
.
create_group
(
"/RuntimePars"
)
...
...
examples/PerturbedBox_2D/makeIC.py
View file @
43d2c7e0
...
...
@@ -84,6 +84,7 @@ grp.attrs["NumFilesPerSnapshot"] = 1
grp
.
attrs
[
"MassTable"
]
=
[
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
]
grp
.
attrs
[
"Flag_Entropy_ICs"
]
=
[
0
,
0
,
0
,
0
,
0
,
0
]
grp
.
attrs
[
"NumPart_Total"
]
=
numPart
grp
.
attrs
[
"Dimension"
]
=
2
#Runtime parameters
grp
=
file
.
create_group
(
"/RuntimePars"
)
...
...
examples/PerturbedBox_3D/makeIC.py
View file @
43d2c7e0
...
...
@@ -86,6 +86,7 @@ grp.attrs["NumFilesPerSnapshot"] = 1
grp
.
attrs
[
"MassTable"
]
=
[
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
]
grp
.
attrs
[
"Flag_Entropy_ICs"
]
=
[
0
,
0
,
0
,
0
,
0
,
0
]
grp
.
attrs
[
"NumPart_Total"
]
=
numPart
grp
.
attrs
[
"Dimension"
]
=
3
#Runtime parameters
grp
=
file
.
create_group
(
"/RuntimePars"
)
...
...
examples/SedovBlast_1D/makeIC.py
View file @
43d2c7e0
...
...
@@ -70,6 +70,7 @@ grp.attrs["Time"] = 0.0
grp
.
attrs
[
"NumFilesPerSnapshot"
]
=
1
grp
.
attrs
[
"MassTable"
]
=
[
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
]
grp
.
attrs
[
"Flag_Entropy_ICs"
]
=
0
grp
.
attrs
[
"Dimension"
]
=
1
#Runtime parameters
grp
=
file
.
create_group
(
"/RuntimePars"
)
...
...
examples/SedovBlast_2D/makeIC.py
View file @
43d2c7e0
...
...
@@ -70,6 +70,7 @@ grp.attrs["Time"] = 0.0
grp
.
attrs
[
"NumFilesPerSnapshot"
]
=
1
grp
.
attrs
[
"MassTable"
]
=
[
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
]
grp
.
attrs
[
"Flag_Entropy_ICs"
]
=
0
grp
.
attrs
[
"Dimension"
]
=
2
#Runtime parameters
grp
=
file
.
create_group
(
"/RuntimePars"
)
...
...
examples/SedovBlast_3D/makeIC.py
View file @
43d2c7e0
...
...
@@ -70,6 +70,7 @@ grp.attrs["Time"] = 0.0
grp
.
attrs
[
"NumFilesPerSnapshot"
]
=
1
grp
.
attrs
[
"MassTable"
]
=
[
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
]
grp
.
attrs
[
"Flag_Entropy_ICs"
]
=
0
grp
.
attrs
[
"Dimension"
]
=
3
#Runtime parameters
grp
=
file
.
create_group
(
"/RuntimePars"
)
...
...
examples/SodShock_1D/makeIC.py
View file @
43d2c7e0
...
...
@@ -90,6 +90,7 @@ grp.attrs["Time"] = 0.0
grp
.
attrs
[
"NumFilesPerSnapshot"
]
=
1
grp
.
attrs
[
"MassTable"
]
=
[
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
]
grp
.
attrs
[
"Flag_Entropy_ICs"
]
=
0
grp
.
attrs
[
"Dimension"
]
=
1
#Runtime parameters
grp
=
file
.
create_group
(
"/RuntimePars"
)
...
...
examples/SodShock_2D/makeIC.py
View file @
43d2c7e0
...
...
@@ -96,6 +96,7 @@ grp.attrs["Time"] = 0.0
grp
.
attrs
[
"NumFilesPerSnapshot"
]
=
1
grp
.
attrs
[
"MassTable"
]
=
[
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
]
grp
.
attrs
[
"Flag_Entropy_ICs"
]
=
0
grp
.
attrs
[
"Dimension"
]
=
2
#Runtime parameters
grp
=
file
.
create_group
(
"/RuntimePars"
)
...
...
examples/SodShock_3D/makeIC.py
View file @
43d2c7e0
...
...
@@ -96,6 +96,7 @@ grp.attrs["Time"] = 0.0
grp
.
attrs
[
"NumFilesPerSnapshot"
]
=
1
grp
.
attrs
[
"MassTable"
]
=
[
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
]
grp
.
attrs
[
"Flag_Entropy_ICs"
]
=
0
grp
.
attrs
[
"Dimension"
]
=
3
#Runtime parameters
grp
=
file
.
create_group
(
"/RuntimePars"
)
...
...
examples/SquareTest_2D/makeIC.py
View file @
43d2c7e0
...
...
@@ -94,6 +94,7 @@ grp.attrs["Time"] = 0.0
grp
.
attrs
[
"NumFilesPerSnapshot"
]
=
1
grp
.
attrs
[
"MassTable"
]
=
[
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
]
grp
.
attrs
[
"Flag_Entropy_ICs"
]
=
[
0
,
0
,
0
,
0
,
0
,
0
]
grp
.
attrs
[
"Dimension"
]
=
2
#Runtime parameters
grp
=
fileOutput
.
create_group
(
"/RuntimePars"
)
...
...
examples/UniformBox_2D/makeIC.py
View file @
43d2c7e0
...
...
@@ -83,6 +83,7 @@ grp.attrs["NumFilesPerSnapshot"] = 1
grp
.
attrs
[
"MassTable"
]
=
[
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
]
grp
.
attrs
[
"Flag_Entropy_ICs"
]
=
[
0
,
0
,
0
,
0
,
0
,
0
]
grp
.
attrs
[
"NumPart_Total"
]
=
numPart
grp
.
attrs
[
"Dimension"
]
=
2
#Runtime parameters
grp
=
file
.
create_group
(
"/RuntimePars"
)
...
...
examples/UniformBox_3D/makeIC.py
View file @
43d2c7e0
...
...
@@ -55,6 +55,7 @@ grp.attrs["Time"] = 0.0
grp
.
attrs
[
"NumFilesPerSnapshot"
]
=
1
grp
.
attrs
[
"MassTable"
]
=
[
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
]
grp
.
attrs
[
"Flag_Entropy_ICs"
]
=
0
grp
.
attrs
[
"Dimension"
]
=
3
#Runtime parameters
grp
=
file
.
create_group
(
"/RuntimePars"
)
...
...
examples/UniformDMBox/makeIC.py
View file @
43d2c7e0
...
...
@@ -51,6 +51,7 @@ grp.attrs["Time"] = 0.0
grp
.
attrs
[
"NumFilesPerSnapshot"
]
=
1
grp
.
attrs
[
"MassTable"
]
=
[
0.0
,
mass
,
0.0
,
0.0
,
0.0
,
0.0
]
grp
.
attrs
[
"Flag_Entropy_ICs"
]
=
0
grp
.
attrs
[
"Dimension"
]
=
3
#Runtime parameters
grp
=
file
.
create_group
(
"/RuntimePars"
)
...
...
src/parallel_io.c
View file @
43d2c7e0
...
...
@@ -37,6 +37,7 @@
/* Local includes. */
#include
"common_io.h"
#include
"dimension.h"
#include
"engine.h"
#include
"error.h"
#include
"gravity_io.h"
...
...
@@ -383,6 +384,7 @@ void read_ic_parallel(char* fileName, const struct UnitSystem* internal_units,
size_t
N
[
NUM_PARTICLE_TYPES
]
=
{
0
};
long
long
N_total
[
NUM_PARTICLE_TYPES
]
=
{
0
};
long
long
offset
[
NUM_PARTICLE_TYPES
]
=
{
0
};
int
dimension
=
3
;
/* Assume 3D if nothing is specified */
/* Open file */
/* message("Opening file '%s' as IC.", fileName); */
...
...
@@ -409,6 +411,15 @@ void read_ic_parallel(char* fileName, const struct UnitSystem* internal_units,
h_grp
=
H5Gopen
(
h_file
,
"/Header"
,
H5P_DEFAULT
);
if
(
h_grp
<
0
)
error
(
"Error while opening file header
\n
"
);
/* Check the dimensionality of the ICs (if the info exists) */
const
hid_t
hid_dim
=
H5Aexists
(
h_grp
,
"Dimension"
);
if
(
hid_dim
<
0
)
error
(
"Error while testing existance of 'Dimension' attribute"
);
if
(
hid_dim
>
0
)
readAttribute
(
h_grp
,
"Dimension"
,
INT
,
&
dimension
);
if
(
dimension
!=
hydro_dimension
)
error
(
"ICs dimensionality (%dD) does not match code dimensionality (%dD)"
,
dimension
,
(
int
)
hydro_dimension
);
/* Read the relevant information and print status */
int
flag_entropy_temp
[
6
];
readAttribute
(
h_grp
,
"Flag_Entropy_ICs"
,
INT
,
flag_entropy_temp
);
...
...
src/serial_io.c
View file @
43d2c7e0
...
...
@@ -37,6 +37,7 @@
/* Local includes. */
#include
"common_io.h"
#include
"dimension.h"
#include
"engine.h"
#include
"error.h"
#include
"gravity_io.h"
...
...
@@ -426,6 +427,7 @@ void read_ic_serial(char* fileName, const struct UnitSystem* internal_units,
size_t
N
[
NUM_PARTICLE_TYPES
]
=
{
0
};
long
long
N_total
[
NUM_PARTICLE_TYPES
]
=
{
0
};
long
long
offset
[
NUM_PARTICLE_TYPES
]
=
{
0
};
int
dimension
=
3
;
/* Assume 3D if nothing is specified */
struct
UnitSystem
*
ic_units
=
malloc
(
sizeof
(
struct
UnitSystem
));
/* First read some information about the content */
...
...
@@ -453,6 +455,15 @@ void read_ic_serial(char* fileName, const struct UnitSystem* internal_units,
h_grp
=
H5Gopen
(
h_file
,
"/Header"
,
H5P_DEFAULT
);
if
(
h_grp
<
0
)
error
(
"Error while opening file header
\n
"
);
/* Check the dimensionality of the ICs (if the info exists) */
const
hid_t
hid_dim
=
H5Aexists
(
h_grp
,
"Dimension"
);
if
(
hid_dim
<
0
)
error
(
"Error while testing existance of 'Dimension' attribute"
);
if
(
hid_dim
>
0
)
readAttribute
(
h_grp
,
"Dimension"
,
INT
,
&
dimension
);
if
(
dimension
!=
hydro_dimension
)
error
(
"ICs dimensionality (%dD) does not match code dimensionality (%dD)"
,
dimension
,
(
int
)
hydro_dimension
);
/* Read the relevant information and print status */
int
flag_entropy_temp
[
6
];
readAttribute
(
h_grp
,
"Flag_Entropy_ICs"
,
INT
,
flag_entropy_temp
);
...
...
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