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
35b4de8b
Commit
35b4de8b
authored
Nov 28, 2018
by
Loic Hausammann
Browse files
Update data names
parent
871123b8
Changes
2
Hide whitespace changes
Inline
Side-by-side
logger/logger_particle.c
View file @
35b4de8b
...
...
@@ -18,9 +18,9 @@ void particle_print(const struct particle *p) {
printf
(
"Mass: %g
\n
"
,
p
->
mass
);
printf
(
"Time: %g
\n
"
,
p
->
time
);
printf
(
"Cutoff Radius: %g
\n
"
,
p
->
h
);
printf
(
"Position:
(%g, %g, %g)
\n
"
,
p
->
pos
[
0
],
p
->
pos
[
1
],
p
->
pos
[
2
]);
printf
(
"Velocit
y:
(%g, %g, %g)
\n
"
,
p
->
vel
[
0
],
p
->
vel
[
1
],
p
->
vel
[
2
]);
printf
(
"Acceleration:
(%g, %g, %g)
\n
"
,
p
->
acc
[
0
],
p
->
acc
[
1
],
p
->
acc
[
2
]);
printf
(
"Position
s
: (%g, %g, %g)
\n
"
,
p
->
pos
[
0
],
p
->
pos
[
1
],
p
->
pos
[
2
]);
printf
(
"Velocit
ies:
(%g, %g, %g)
\n
"
,
p
->
vel
[
0
],
p
->
vel
[
1
],
p
->
vel
[
2
]);
printf
(
"Acceleration
s
: (%g, %g, %g)
\n
"
,
p
->
acc
[
0
],
p
->
acc
[
1
],
p
->
acc
[
2
]);
printf
(
"Entropy: %g
\n
"
,
p
->
entropy
);
printf
(
"Density: %g
\n
"
,
p
->
density
);
}
...
...
@@ -72,15 +72,15 @@ int particle_read_field(struct particle *part, void *map, size_t *offset,
const
char
*
field
,
const
size_t
size
)
{
void
*
p
=
NULL
;
if
(
strcmp
(
"position"
,
field
)
==
0
)
{
if
(
strcmp
(
"position
s
"
,
field
)
==
0
)
{
p
=
&
part
->
pos
;
}
else
if
(
strcmp
(
"velocit
y
"
,
field
)
==
0
)
{
}
else
if
(
strcmp
(
"velocit
ies
"
,
field
)
==
0
)
{
p
=
&
part
->
vel
;
}
else
if
(
strcmp
(
"acceleration"
,
field
)
==
0
)
{
}
else
if
(
strcmp
(
"acceleration
s
"
,
field
)
==
0
)
{
p
=
&
part
->
acc
;
}
else
if
(
strcmp
(
"entropy"
,
field
)
==
0
)
{
p
=
&
part
->
entropy
;
}
else
if
(
strcmp
(
"
cutoff radius
"
,
field
)
==
0
)
{
}
else
if
(
strcmp
(
"
smoothing length
"
,
field
)
==
0
)
{
p
=
&
part
->
h
;
}
else
if
(
strcmp
(
"density"
,
field
)
==
0
)
{
p
=
&
part
->
density
;
...
...
logger/logger_python_wrapper.c
View file @
35b4de8b
...
...
@@ -93,15 +93,15 @@ static PyObject *loadFromIndex(__attribute__((unused)) PyObject *self,
dim
[
1
]
=
DIM
;
/* init output */
if
(
header_is_present
(
&
h
,
"position"
))
{
if
(
header_is_present
(
&
h
,
"position
s
"
))
{
pos
=
(
PyArrayObject
*
)
PyArray_SimpleNew
(
2
,
dim
,
NPY_DOUBLE
);
}
if
(
header_is_present
(
&
h
,
"velocit
y
"
))
{
if
(
header_is_present
(
&
h
,
"velocit
ies
"
))
{
vel
=
(
PyArrayObject
*
)
PyArray_SimpleNew
(
2
,
dim
,
NPY_FLOAT
);
}
if
(
header_is_present
(
&
h
,
"acceleration"
))
{
if
(
header_is_present
(
&
h
,
"acceleration
s
"
))
{
acc
=
(
PyArrayObject
*
)
PyArray_SimpleNew
(
2
,
dim
,
NPY_FLOAT
);
}
...
...
@@ -110,7 +110,7 @@ static PyObject *loadFromIndex(__attribute__((unused)) PyObject *self,
(
PyArrayObject
*
)
PyArray_SimpleNew
(
1
,
PyArray_DIMS
(
offset
),
NPY_FLOAT
);
}
if
(
header_is_present
(
&
h
,
"
cutoff radius
"
))
{
if
(
header_is_present
(
&
h
,
"
smoothing length
"
))
{
h_sph
=
(
PyArrayObject
*
)
PyArray_SimpleNew
(
1
,
PyArray_DIMS
(
offset
),
NPY_FLOAT
);
}
...
...
@@ -196,16 +196,16 @@ static PyObject *loadFromIndex(__attribute__((unused)) PyObject *self,
/* construct return */
PyObject
*
dict
=
PyDict_New
();
PyObject
*
key
=
PyUnicode_FromString
(
"position"
);
PyObject
*
key
=
PyUnicode_FromString
(
"position
s
"
);
PyDict_SetItem
(
dict
,
key
,
PyArray_Return
(
pos
));
if
(
vel
)
{
key
=
PyUnicode_FromString
(
"velocit
y
"
);
key
=
PyUnicode_FromString
(
"velocit
ies
"
);
PyDict_SetItem
(
dict
,
key
,
PyArray_Return
(
vel
));
}
if
(
acc
)
{
key
=
PyUnicode_FromString
(
"acceleration"
);
key
=
PyUnicode_FromString
(
"acceleration
s
"
);
PyDict_SetItem
(
dict
,
key
,
PyArray_Return
(
acc
));
}
...
...
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