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
08693c54
Commit
08693c54
authored
Aug 31, 2012
by
Pedro Gonnet
Browse files
add new test case.
Former-commit-id: 4e97e70ac2052c83b6c7d1d22b56f6eab896dee1
parent
c7048992
Changes
1
Hide whitespace changes
Inline
Side-by-side
snap_245/extract.m
0 → 100644
View file @
08693c54
% Remove any old data
!
rm
-f
*
.txt
% Loop over the input files
range
=
[
Inf
,
-
Inf
];
avg
=
[
0
,
0
,
0
];
count
=
0
;
shift
=
[
5e3
5e3
5e3
];
% Get the file name
fname
=
'snap_245.hdf5'
;
% Get the coordinates
coord
=
double
(
h5read
(
fname
,
'/PartType0/Coordinates'
)
'
);
coord
=
coord
-
repmat
(
shift
,
size
(
coord
,
1
)
,
1
);
% Get the smoothing lengths
h
=
double
(
h5read
(
fname
,
'/PartType0/SmoothingLength'
)
);
% Remove entries with too large smoothing lengths
ind
=
(
h
<
150
);
coord
=
coord
(
ind
,:);
h
=
h
(
ind
);
% Save the data
save
Coordinates
.
txt
-
ascii
-
double
-
append
coord
save
SmoothingLength
.
txt
-
ascii
-
double
-
append
h
% Get some statistics
count
=
size
(
coord
,
1
);
avg
=
sum
(
coord
,
1
)
/
count
;
range
(
1
)
=
min
(
range
(
1
)
,
min
(
min
(
coord
))
);
range
(
2
)
=
max
(
range
(
2
)
,
max
(
max
(
coord
))
);
% Display some statistics
disp
(
sprintf
(
'read %i particles'
,
count
)
);
disp
(
sprintf
(
'range of coords is [ %e , %e ]'
,
range
(
1
)
,
range
(
2
)
)
);
disp
(
sprintf
(
'range of h is [ %e , %e ]'
,
min
(
h
)
,
max
(
h
)
)
);
disp
(
sprintf
(
'avg position is [ %e , %e , %e ]'
,
avg
(
1
)
,
avg
(
2
)
,
avg
(
3
)
)
);
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