Commit ee002f04 authored by LAMBERT Jean-charles's avatar LAMBERT Jean-charles

fix some int to long for ramses

parent 76c7a7f7
...@@ -26,7 +26,7 @@ if ( NOT SETUP_FLAGS_INCLUDED ) ...@@ -26,7 +26,7 @@ if ( NOT SETUP_FLAGS_INCLUDED )
# set optimizer flag # set optimizer flag
if ( ${CMAKE_BUILD_TYPE} STREQUAL "Debug" ) if ( ${CMAKE_BUILD_TYPE} STREQUAL "Debug" )
typed_cache_set (STRING "Optimizer" OPT "-g -ggdb") typed_cache_set (STRING "Optimizer" OPT "-g -ggdb -O2")
else () else ()
typed_cache_set (STRING "Optimizer" OPT "-O3") typed_cache_set (STRING "Optimizer" OPT "-O3")
endif () endif ()
......
...@@ -234,21 +234,21 @@ template <class T> int CSnapshotRamsesIn<T>::reorderParticles(uns::UserSelection ...@@ -234,21 +234,21 @@ template <class T> int CSnapshotRamsesIn<T>::reorderParticles(uns::UserSelection
if (particles->id.size()>0) if (particles->id.size()>0)
id.resize(particles->id.size()); // resize new id vector id.resize(particles->id.size()); // resize new id vector
for (int i=0; i<particles->ntot; i++) { for (long int i=0; i<particles->ntot; i++) {
bool found=false; bool found=false;
int icomp=particles->indexes[i]; // integer component long int icomp=particles->indexes[i]; // integer component
if (! (icomp==0 ||icomp==1 || icomp==4)) { if (! (icomp==0 ||icomp==1 || icomp==4)) {
std::cerr << "ASSERT fails i="<<i<<" icomp="<<icomp<<"\n"; std::cerr << "ASSERT fails i="<<i<<" icomp="<<icomp<<"\n";
} }
assert(icomp==0 ||icomp==1 || icomp==4); // gas || halo || stars only assert(icomp==0 ||icomp==1 || icomp==4); // gas || halo || stars only
assert(offset_comp[icomp]>=0); assert(offset_comp[icomp]>=0);
unsigned int istart=offset_comp[icomp]; // index start in the new pos array unsigned long int istart=offset_comp[icomp]; // index start in the new pos array
// positions // positions
if (particles->pos.size()>0) { if (particles->pos.size()>0) {
assert((istart*3)+2<(unsigned int)particles->pos.size()); assert((istart*3)+2< particles->pos.size());
found=true; found=true;
pos[istart*3+0] = particles->pos[i*3+0]; // x pos[istart*3+0] = particles->pos[i*3+0]; // x
pos[istart*3+1] = particles->pos[i*3+1]; // y pos[istart*3+1] = particles->pos[i*3+1]; // y
...@@ -257,7 +257,7 @@ template <class T> int CSnapshotRamsesIn<T>::reorderParticles(uns::UserSelection ...@@ -257,7 +257,7 @@ template <class T> int CSnapshotRamsesIn<T>::reorderParticles(uns::UserSelection
// velocities // velocities
if (particles->vel.size()>0) { if (particles->vel.size()>0) {
assert((istart*3)+2<(unsigned int)particles->vel.size()); assert((istart*3)+2<particles->vel.size());
found=true; found=true;
vel[istart*3+0] = particles->vel[i*3+0]; // x vel[istart*3+0] = particles->vel[i*3+0]; // x
vel[istart*3+1] = particles->vel[i*3+1]; // y vel[istart*3+1] = particles->vel[i*3+1]; // y
...@@ -266,23 +266,23 @@ template <class T> int CSnapshotRamsesIn<T>::reorderParticles(uns::UserSelection ...@@ -266,23 +266,23 @@ template <class T> int CSnapshotRamsesIn<T>::reorderParticles(uns::UserSelection
// masses // masses
if (particles->mass.size()>0) { if (particles->mass.size()>0) {
assert(istart<(unsigned int)particles->mass.size()); assert(istart<particles->mass.size());
found=true; found=true;
mass[istart] = particles->mass[i]; mass[istart] = particles->mass[i];
} }
// id // id
if (particles->id.size()>0) { if (particles->id.size()>0) {
assert(istart<(unsigned int)particles->id.size()); assert(istart<particles->id.size());
found=true; found=true;
id[istart] = particles->id[i]; id[istart] = particles->id[i];
} }
// metal // metal
if (particles->metal.size()>0) { // && (icomp==0 || icomp==4)) { // metal for gas or stars if (particles->metal.size()>0) { // && (icomp==0 || icomp==4)) { // metal for gas or stars
if (!(istart<(unsigned int)particles->metal.size())) { if (!(istart<particles->metal.size())) {
std::cerr << " istart ="<<istart<< " metal.size ="<< particles->metal.size() << "\n"; std::cerr << " istart ="<<istart<< " metal.size ="<< particles->metal.size() << "\n";
} }
assert(istart<(unsigned int)particles->metal.size()); assert(istart<particles->metal.size());
found=true; found=true;
metal[istart] = particles->metal[i]; metal[istart] = particles->metal[i];
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment