Commit 947fad94 authored by jclamber's avatar jclamber

ramses metalicity in progress

git-svn-id: http://svn.oamp.fr/repos/unsio/trunk@148 ce2cc22f-6084-46ce-a062-084b172ee5dc
parent dbd01f45
......@@ -127,7 +127,7 @@ int CPart::loadData(uns::CParticles * particles,
metaltmp = new double[npart];
int status=part.readDataBlock((char *) metaltmp, false);
if (status) found_metal=true;
std::cerr << "Metalicity status =" << status << "\n";
//std::cerr << "Metalicity status =" << status << "\n";
}
for (int k=0; k<npart; k++) {
......@@ -160,11 +160,14 @@ int CPart::loadData(uns::CParticles * particles,
particles->load_bits |= AGE_BIT;
}
if (agetmp[k]!=0 && req_bits&METAL_BIT && found_metal) { // stars only (metallicity)
//std::cerr << "Stars => "<<metaltmp[k]<<"\n";
particles->metal.push_back(metaltmp[k]);
particles->load_bits |= METAL_BIT;
}
if (agetmp[k]==0 && req_bits&METAL_BIT && found_metal) { // stars only (metallicity)
particles->metal.push_back(0.0); // put 0 for dark matter
//if ( tmp[6][k] == 0.0 )
//std::cerr << "DM => "<<metaltmp[k]<<" mass=" << tmp[6][k] << "\n";
particles->metal.push_back(tmp[6][k]); // put 0 for dark matter
particles->load_bits |= METAL_BIT;
}
if (take && agetmp[k]!=0) {
......
......@@ -252,9 +252,8 @@ int CSnapshotRamsesIn::reorderParticles(uns::UserSelection &user_select)
found=true;
mass[istart] = particles->mass[i];
}
#if 1
// 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<(int)particles->metal.size())) {
std::cerr << " istart ="<<istart<< " metal.size ="<< particles->metal.size() << "\n";
}
......@@ -262,7 +261,7 @@ int CSnapshotRamsesIn::reorderParticles(uns::UserSelection &user_select)
found=true;
metal[istart] = particles->metal[i];
}
#endif
if (found) { // found particles
offset_comp[icomp]++; // update offset
}
......@@ -271,9 +270,8 @@ int CSnapshotRamsesIn::reorderParticles(uns::UserSelection &user_select)
particles->pos=pos;
particles->vel=vel;
particles->mass=mass;
#if 1
particles->metal=metal;
#endif
//std::cerr << "metal.size() ="<<particles->metal.size() <<"\n";
}
return 1;
}
......@@ -368,6 +366,14 @@ bool CSnapshotRamsesIn::getData(const std::string comp, std::string name, int *n
ok=false;
}
break;
case uns::Metal :
if (status && particles->metal.size()>0) {
*data = &particles->metal[first];
*n = nbody;
} else {
ok=false;
}
break;
default: ok=false;
}
......
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