Commit fab6aee7 authored by jclamber's avatar jclamber

new tag SSL for gadget2 format

git-svn-id: http://svn.oamp.fr/repos/unsio/trunk@142 ce2cc22f-6084-46ce-a062-084b172ee5dc
parent 1218cc6a
......@@ -41,6 +41,7 @@ namespace tools {
#define ZSMT_BIT (1 << 19)
#define IM_BIT (1 << 20)
#define CM_BIT (1 << 21)
#define SSL_BIT (1 << 22)
// Component BITS
#define ALL_BIT (1 << 1)
......
......@@ -62,6 +62,7 @@ namespace uns {
zs = NULL;
zsmt = NULL;
im = NULL;
ssl = NULL;
cm = NULL;
bits = 0;
load_bits = 0;
......@@ -106,6 +107,7 @@ CSnapshotGadgetIn::~CSnapshotGadgetIn()
if (zs) delete [] zs;
if (zsmt) delete [] zsmt;
if (im) delete [] im;
if (ssl) delete [] ssl;
if (cm) delete [] cm;
}
crv.clear();
......@@ -496,6 +498,13 @@ int CSnapshotGadgetIn::read(uns::UserSelection &user_select)
ok=true;
readOneArray(&im,4,compOffset);
}
// --> SSL block
if (block_name=="SSL" && req_bits&SSL_BIT && comp_bits&STARS_BIT) {
load_bits |= SSL_BIT;
assert((header.npart[4])>0); // stars
ok=true;
readOneArray(&ssl,4,compOffset);
}
// --> CM block
if (block_name=="cM" && req_bits&CM_BIT && (comp_bits&GAS_BIT || comp_bits&STARS_BIT)) {
assert((load_bits&CM_BIT)==0); // if failed means that multiple file not supported for this block
......@@ -586,6 +595,7 @@ int CSnapshotGadgetIn::read(uns::UserSelection &user_select)
freeNotLoadedData(&zs ,ZS_BIT);
freeNotLoadedData(&zsmt ,ZSMT_BIT);
freeNotLoadedData(&im ,IM_BIT);
freeNotLoadedData(&ssl ,SSL_BIT);
freeNotLoadedData(&cm ,CM_BIT);
}
return 1;
......@@ -991,6 +1001,13 @@ bool CSnapshotGadgetIn::getData(const std::string comp, std::string name, int *n
ok=false;
}
break;
case uns::Ssl :
if (status && comp=="stars" && getSsl(*n)) {
*data = getSsl(*n);
} else {
ok=false;
}
break;
default: ok=false;
}
if (ok && !*data &&
......@@ -1093,6 +1110,9 @@ bool CSnapshotGadgetIn::getData(const std::string name,int *n,float **data)
case uns::Im :
*data = getIm(*n);
break;
case uns::Ssl :
*data = getSsl(*n);
break;
default: ok=false;
}
......
......@@ -143,7 +143,7 @@ typedef struct particle_data_lite
float * mass, * pos, * vel, * acc, *pot, * rho, * hsml, * age, * metal, * intenerg, * temp;
int * id;
// new data for Sergey
float * zs, * zsmt, * im, * cm;
float * zs, * zsmt, * im, * cm, * ssl;
int czs, czsmt; // constant for zs and zsmt
int bits; // to store the bits components
float tframe,redshift;
......@@ -196,6 +196,7 @@ typedef struct particle_data_lite
float * getZsmtGas(int & n) { n=czsmt*(header.npartTotal[0]); return zsmt;}
float * getZsmtStars(int & n) { n=czsmt*(header.npartTotal[4]); return zsmt+header.npartTotal[0]*czsmt;}
float * getIm(int & n) { n=header.npartTotal[4]; return im;}
float * getSsl(int & n) { n=header.npartTotal[4]; return ssl;}
float * getCm(int & n) { n=1*(header.npartTotal[0]+header.npartTotal[4]); return cm;}
float * getCmGas(int & n) { n=1*(header.npartTotal[0]); return cm;}
float * getCmStars(int & n) { n=1*(header.npartTotal[4]); return ((cm==NULL)?cm:cm+header.npartTotal[0]*1);}
......
......@@ -236,6 +236,7 @@ namespace uns {
CunsOut::s_mapStringValues["zs" ] = uns::Zs;
CunsOut::s_mapStringValues["zsmt" ] = uns::ZSMT;
CunsOut::s_mapStringValues["im" ] = uns::Im;
CunsOut::s_mapStringValues["ssl" ] = uns::Ssl;
CunsOut::s_mapStringValues["cm" ] = uns::Cm;
CunsOut::s_mapStringValues["czs" ] = uns::Czs;
CunsOut::s_mapStringValues["czsmt" ] = uns::Czsmt;
......
......@@ -46,6 +46,7 @@ namespace uns {
Cm ,
Czs ,
Czsmt ,
Ssl ,
// Nbodies per component
Nsel ,
......
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