Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
LAMBERT Jean-charles
unsio
Commits
0602c9bb
Commit
0602c9bb
authored
Nov 23, 2016
by
LAMBERT Jean-charles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug when too big number of particles (int) vs (unsigned int)
parent
cce9606e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
9 deletions
+10
-9
src/snapshotramses.cc
src/snapshotramses.cc
+8
-7
src/unsfwrapper.cc
src/unsfwrapper.cc
+1
-1
src/userselection.cc
src/userselection.cc
+1
-1
No files found.
src/snapshotramses.cc
View file @
0602c9bb
...
...
@@ -243,11 +243,12 @@ template <class T> int CSnapshotRamsesIn<T>::reorderParticles(uns::UserSelection
std
::
cerr
<<
"ASSERT fails i="
<<
i
<<
" icomp="
<<
icomp
<<
"
\n
"
;
}
assert
(
icomp
==
0
||
icomp
==
1
||
icomp
==
4
);
// gas || halo || stars only
int
istart
=
offset_comp
[
icomp
];
// index start in the new pos array
assert
(
offset_comp
[
icomp
]
>=
0
);
unsigned
int
istart
=
offset_comp
[
icomp
];
// index start in the new pos array
// positions
if
(
particles
->
pos
.
size
()
>
0
)
{
assert
((
istart
*
3
)
+
2
<
(
int
)
particles
->
pos
.
size
());
assert
((
istart
*
3
)
+
2
<
(
unsigned
int
)
particles
->
pos
.
size
());
found
=
true
;
pos
[
istart
*
3
+
0
]
=
particles
->
pos
[
i
*
3
+
0
];
// x
pos
[
istart
*
3
+
1
]
=
particles
->
pos
[
i
*
3
+
1
];
// y
...
...
@@ -256,7 +257,7 @@ template <class T> int CSnapshotRamsesIn<T>::reorderParticles(uns::UserSelection
// velocities
if
(
particles
->
vel
.
size
()
>
0
)
{
assert
((
istart
*
3
)
+
2
<
(
int
)
particles
->
vel
.
size
());
assert
((
istart
*
3
)
+
2
<
(
unsigned
int
)
particles
->
vel
.
size
());
found
=
true
;
vel
[
istart
*
3
+
0
]
=
particles
->
vel
[
i
*
3
+
0
];
// x
vel
[
istart
*
3
+
1
]
=
particles
->
vel
[
i
*
3
+
1
];
// y
...
...
@@ -265,23 +266,23 @@ template <class T> int CSnapshotRamsesIn<T>::reorderParticles(uns::UserSelection
// masses
if
(
particles
->
mass
.
size
()
>
0
)
{
assert
(
istart
<
(
int
)
particles
->
mass
.
size
());
assert
(
istart
<
(
unsigned
int
)
particles
->
mass
.
size
());
found
=
true
;
mass
[
istart
]
=
particles
->
mass
[
i
];
}
// id
if
(
particles
->
id
.
size
()
>
0
)
{
assert
(
istart
<
(
int
)
particles
->
id
.
size
());
assert
(
istart
<
(
unsigned
int
)
particles
->
id
.
size
());
found
=
true
;
id
[
istart
]
=
particles
->
id
[
i
];
}
// metal
if
(
particles
->
metal
.
size
()
>
0
)
{
// && (icomp==0 || icomp==4)) { // metal for gas or stars
if
(
!
(
istart
<
(
int
)
particles
->
metal
.
size
()))
{
if
(
!
(
istart
<
(
unsigned
int
)
particles
->
metal
.
size
()))
{
std
::
cerr
<<
" istart ="
<<
istart
<<
" metal.size ="
<<
particles
->
metal
.
size
()
<<
"
\n
"
;
}
assert
(
istart
<
(
int
)
particles
->
metal
.
size
());
assert
(
istart
<
(
unsigned
int
)
particles
->
metal
.
size
());
found
=
true
;
metal
[
istart
]
=
particles
->
metal
[
i
];
}
...
...
src/unsfwrapper.cc
View file @
0602c9bb
...
...
@@ -651,7 +651,7 @@ void uns_get_interface_type_(const int * id, char * dest, int lenstring)
// return the Component Range Vector belonging to the UNS's object "index"
void
getCrv
(
int
index
)
{
assert
(
index
<
(
int
)
unsv
.
size
());
assert
(
index
<
(
unsigned
int
)
unsv
.
size
());
crv
=
((
CunsIn2
<
float
>*
)
unsv
[
index
].
obj
)
->
snapshot
->
getSnapshotRange
();
//ComponentRange::list(crv);
}
...
...
src/userselection.cc
View file @
0602c9bb
...
...
@@ -232,7 +232,7 @@ int UserSelection::isComponent(const std::string comp)
int
offset
;
int
icrv
=
ComponentRange
::
getIndexMatchType
(
crv
,
type
,
offset
);
if
(
icrv
!=
-
1
&&
!
nodata
)
{
assert
(
icrv
<
(
int
)
crv
->
size
());
assert
(
(
unsigned
int
)
icrv
<
crv
->
size
());
comp_bits
|=
tools
::
Ctools
::
compBits
(
type
);
first
=
(
*
crv
)[
icrv
].
first
;
last
=
(
*
crv
)[
icrv
].
last
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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