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