...
 
Commits (3)
3rdparty/nemolight/build-Debug
#cmake
*build/
*build*/
#qmake
*.user
......
......@@ -132,14 +132,12 @@ def saveSnap(insnap,comp,unstype,single):
## READ FILE BACK
mysnap = snap()
ok,mysnap = readSnap(myfile,comp,single)
#embed()
os.remove(myfile) # rmove temporary file
return True,copy.deepcopy(mysnap)
# -----------------------------------------------------
def compareArray(CA,CB,attr):
#embed()
A=getattr(CA,attr)
B=getattr(CB,attr)
ok=False
......@@ -183,7 +181,7 @@ def notCompare(CA,CB,attr):
def compare(CA,CB):
print("-----------------------------------------------------")
print("Comparing : [",CA.interface,"] vs [",CB.interface,"]\n")
for attr in ("pos","vel","mass","age","hsml","rho","metal", "id","time"):
for attr in ("pos","vel","mass","age","hsml","rho","metal","id","time"):
compareArray(CA,CB,attr)
# -----------------------------------------------------
......
//-*- C -*-
// ============================================================================
// Copyright Jean-Charles LAMBERT - 2008-2015
// Copyright Jean-Charles LAMBERT - 2008-2016
// Centre de donneeS Astrophysiques de Marseille (CeSAM)
// e-mail: Jean-Charles.Lambert@lam.fr
// address: Aix Marseille Universite, CNRS, LAM
......@@ -28,36 +28,36 @@
import_array();
%}
// below we change the type of dimension of numpy array.
// below we change the returning type of numpy array size
// By default it's an "int", but we have std::vector object returning size()
// method as dimension, and which are of type "unsigned int"
// method as dimension, and which are of type "unsigned long int"
// This may cause a problem with BIG simulations. Indeed a simulation with 1.1 billions particles
// store in a xyz positions array a size of 3.3 billions which overtake size of SIGNED int, which go
// only to 2^31 bits = 2.14 billons !!!!! (damn nasty bug....)
%numpy_typemaps(double, NPY_DOUBLE, unsigned int)
%numpy_typemaps(float , NPY_FLOAT , unsigned int)
%numpy_typemaps(int , NPY_INT , unsigned int)
// only to 2^31-1 bits = 2.14 billons !!!!! (damn nasty bug....)
%numpy_typemaps(double, NPY_DOUBLE, long int)
%numpy_typemaps(float , NPY_FLOAT , long int)
%numpy_typemaps(long , NPY_LONG , long int)
// getArrayX return 1D numpy float array
%apply (unsigned int* DIM1, float ** ARGOUTVIEW_ARRAY1 )
{( unsigned int* size, float ** farray )};
%apply (long int* DIM1, float ** ARGOUTVIEW_ARRAY1 )
{( long int* size, float ** farray )};
//%apply ( int* DIM1, int ** ARGOUTVIEW_ARRAY1 )
// {( int* size, int ** iarray )};
// getArrayX return 1D numpy double array
%apply (unsigned int* DIM1, double ** ARGOUTVIEW_ARRAY1 )
{( unsigned int* size, double ** farray )};
%apply (long int* DIM1, double ** ARGOUTVIEW_ARRAY1 )
{( long int* size, double ** farray )};
// getArrayX return 1D numpy int array
%apply (unsigned int* DIM1, int ** ARGOUTVIEW_ARRAY1 )
{( unsigned int* size, int ** iarray )};
%apply (long int* DIM1, long int ** ARGOUTVIEW_ARRAY1 )
{( long int* size, long int ** iarray )};
// getValueX return float/double/int value
%apply float *OUTPUT { float * fvalue };
%apply double *OUTPUT { double * fvalue };
%apply int *OUTPUT { int * ivalue };
%apply long int *OUTPUT { long int * ivalue };
// rename methods because of overloading limitations with swig c++
// IMPORTANT :
......@@ -66,35 +66,35 @@
//float
%rename(getValueF) getData(const std::string,float *);
%rename(getArrayF) getData(const std::string,const std::string,unsigned int *,float **);
%rename(getArrayF) getData(const std::string,unsigned int *,float **);
%rename(getArrayF) getData(const std::string,const std::string,long int *,float **);
%rename(getArrayF) getData(const std::string,long int *,float **);
//double
%rename(getValueF) getData(const std::string,double *);
%rename(getArrayF) getData(const std::string,const std::string,unsigned int *,double **);
%rename(getArrayF) getData(const std::string,unsigned int *, double **);
%rename(getArrayF) getData(const std::string,const std::string,long int *,double **);
%rename(getArrayF) getData(const std::string,long int *, double **);
//int
%rename(getValueI) getData(const std::string,int *);
%rename(getArrayI) getData(const std::string,const std::string,unsigned int *,int **);
%rename(getArrayI) getData(const std::string,unsigned int *,int **);
%rename(getValueI) getData(const std::string,long int *);
%rename(getArrayI) getData(const std::string,const std::string,long int *,long int **);
%rename(getArrayI) getData(const std::string,long int *,long int **);
%apply (unsigned int DIM1 , float * INPLACE_ARRAY1) {(unsigned int size, float * farray)};
%apply (unsigned int DIM1 , double* INPLACE_ARRAY1) {(unsigned int size, double* farray)};
%apply (unsigned int DIM1 , int * INPLACE_ARRAY1) {(unsigned int size, int * iarray)};
%apply (long int DIM1 , float * INPLACE_ARRAY1) {(long int size, float * farray)};
%apply (long int DIM1 , double* INPLACE_ARRAY1) {(long int size, double * farray)};
%apply (long int DIM1 , long int * INPLACE_ARRAY1) {(long int size, long int * iarray)};
// rename methods because of overloading limitations with swig c++
// float
%rename(setValueF) setData(const std::string,float);
%rename(setArrayF_do_not_used) setData(const std::string,const std::string,unsigned int ,float *,const bool _addr=false);
%rename(setArrayF_do_not_used) setData(const std::string,unsigned int ,float *,const bool _addr=false);
%rename(setArrayF_do_not_used) setData(const std::string,const std::string,long int ,float *,const bool _addr=false);
%rename(setArrayF_do_not_used) setData(const std::string,long int ,float *,const bool _addr=false);
// double
%rename(setValueF) setData(const std::string,double);
%rename(setArrayF_do_not_used) setData(const std::string,const std::string, unsigned int ,double *,const bool _addr=false);
%rename(setArrayF_do_not_used) setData(const std::string,unsigned int ,double *,const bool _addr=false);
%rename(setArrayF_do_not_used) setData(const std::string,const std::string, long int ,double *,const bool _addr=false);
%rename(setArrayF_do_not_used) setData(const std::string,long int ,double *,const bool _addr=false);
// int
%rename(setValueI) setData(const std::string,int,const bool _addr=false);
%rename(setArrayI) setData(const std::string,const std::string,unsigned int ,int *,const bool _addr=false);
%rename(setArrayI) setData(const std::string,unsigned int ,int *);
%rename(setValueI) setData(const std::string,long int,const bool _addr=false);
%rename(setArrayI) setData(const std::string,const std::string,long int ,long int *,const bool _addr=false);
%rename(setArrayI) setData(const std::string,long int , long int *);
// Parse the original header file
%include "uns.h"
......@@ -102,14 +102,14 @@
%extend uns::CunsOut2 {
// we rewrite setArrayF because numpy array size is different from nbody for 3D arrays
int setArrayF(const std::string comp,const std::string prop,
unsigned int size,T * farray, const bool _addr=false) {
long int size,T * farray, const bool _addr=false) {
if (prop=="pos" || prop=="vel" || prop=="acc") size /= 3;
int status = $self->snapshot->setData(comp,prop,size,farray,_addr);
return status;
}
// we rewrite setArrayF because numpy array size is different from nbody for 3D arrays
int setArrayF(const std::string prop,
unsigned int size,T * farray, const bool _addr=false) {
long int size,T * farray, const bool _addr=false) {
if (prop=="pos" || prop=="vel" || prop=="acc") size /= 3;
int status = $self->snapshot->setData(prop,size,farray,_addr);
return status;
......
......@@ -67,7 +67,7 @@ void ComponentRange::buildRange()
// return the index vector matching the type of object in the component range
// vector. Return also the object offset in the index tab
int ComponentRange::getIndexMatchType(const ComponentRangeVector * crv, const std::string type,
int &offset, bool crvuser)
long int &offset, bool crvuser)
{
int status=-1;
offset=0;
......
......@@ -33,7 +33,7 @@ public:
void setType(std::string _type) { type = _type; }
void setPosition(const int _pos) { position = _pos;}
static int getIndexMatchType(const ComponentRangeVector * crv, const std::string type,
int & offset,bool crvuser=false);
long int & offset,bool crvuser=false);
static void list(const ComponentRangeVector * crv);
static int print(const ComponentRangeVector * crv, std::string select);
static bool compareFirst(const ComponentRange &a ,const ComponentRange &b) {
......
This diff is collapsed.
This diff is collapsed.
......@@ -90,7 +90,7 @@ void CSnapshotGadgetH5In<T>::storeComponents()
this->crv.push_back(cr);
// components
const char * comp [] = { "gas", "halo", "disk", "bulge", "stars", "bndry"};
for(int k=0,start=0; k<6; k++) {
for(long int k=0,start=0; k<6; k++) {
if (myH5->getHeader().NumPart_Total[k]) {
cr.setData(start,start+myH5->getHeader().NumPart_Total[k]-1,comp[k]);
this->crv.push_back(cr);
......@@ -170,7 +170,7 @@ template <class U> void CSnapshotGadgetH5In<T>::getData(const std::string comp,c
// ============================================================================
//
template <class T>
bool CSnapshotGadgetH5In<T>::getData(const std::string name,int *n,T ** data)
bool CSnapshotGadgetH5In<T>::getData(const std::string name,long int *n,T ** data)
{
bool ok=getData("all",name,n,data);
return ok;
......@@ -203,7 +203,7 @@ bool CSnapshotGadgetH5In<T>::getData(const std::string name , T * data )
// ============================================================================
//
template <class T>
bool CSnapshotGadgetH5In<T>::getData(const std::string name,int *n,int ** data)
bool CSnapshotGadgetH5In<T>::getData(const std::string name,long int *n,long int ** data)
{
bool ok=getData("all",name,n,data);
return ok;
......@@ -211,7 +211,7 @@ bool CSnapshotGadgetH5In<T>::getData(const std::string name,int *n,int ** data
// ============================================================================
//
template <class T>
bool CSnapshotGadgetH5In<T>::getData(const std::string name, int * data )
bool CSnapshotGadgetH5In<T>::getData(const std::string name, long int * data )
{
bool ok=true;
*data=0;
......@@ -252,14 +252,14 @@ bool CSnapshotGadgetH5In<T>::getData(const std::string name, int * data )
// ============================================================================
//
template <class T>
bool CSnapshotGadgetH5In<T>::getData(const std::string comp, const std::string name,int * n,T ** data)
bool CSnapshotGadgetH5In<T>::getData(const std::string comp, const std::string name,long int * n,T ** data)
{
bool ok=true;
*data=NULL;
*n = 0;
int nbody,first,last;
long int nbody,first,last;
bool status=false;
if (comp!="STREAM") {
......@@ -394,13 +394,13 @@ bool CSnapshotGadgetH5In<T>::getData(const std::string comp, const std::string n
//
template <class T>
bool CSnapshotGadgetH5In<T>::getData(const std::string comp, const std::string name,
int *n ,int ** data)
long int *n ,long int ** data)
{
bool ok=true;
*data=NULL;
*n = 0;
int nbody,first,last;
long int nbody,first,last;
bool status=false;
if (comp!="STREAM") {
......@@ -469,7 +469,7 @@ bool CSnapshotGadgetH5In<T>::loadDataset(std::string dataset, std::vector<U> &da
// this method load TAG dataset for all components selected by user
template <class T>
template <class U>
bool CSnapshotGadgetH5In<T>::loadCommonDataset(std::string tag, std::vector<U> &data, const int dim)
bool CSnapshotGadgetH5In<T>::loadCommonDataset(std::string tag, std::vector<U> &data, const long int dim)
{
std::map<std::string,int> compo_indx;
compo_indx["gas" ]=0;
......@@ -517,7 +517,7 @@ bool CSnapshotGadgetH5In<T>::loadCommonDataset(std::string tag, std::vector<U> &
if (this->verbose) std::cerr << " size="<<vec.size()<< " size/dim="<< vec.size()/dim << "\n";
if (vec.size()>0) ok=true;
int nbody,first,last;
long int nbody,first,last;
assert((*crv)[i].type!="all");
bool status=this->getRangeSelect((*crv)[i].type.c_str(),&nbody,&first,&last,false);
assert(status==true);
......@@ -603,7 +603,7 @@ int CSnapshotGadgetH5Out<T>::setHeader(void * _header)
// ============================================================================
// setNbody:
template <class T>
int CSnapshotGadgetH5Out<T>::setNbody(const int _nbody)
int CSnapshotGadgetH5Out<T>::setNbody(const long int _nbody)
{
return 1;
}
......@@ -636,7 +636,7 @@ int CSnapshotGadgetH5Out<T>::setData(std::string name,T data)
// setData
// setData("gas","pos",n,gas_array,true)
template <class T>
int CSnapshotGadgetH5Out<T>::setData(std::string name,std::string array, const int n ,T * data,const bool _addr)
int CSnapshotGadgetH5Out<T>::setData(std::string name,std::string array, const long int n ,T * data,const bool _addr)
{
int status=0;
try {
......@@ -706,7 +706,7 @@ int CSnapshotGadgetH5Out<T>::setData(std::string name,std::string array, const
// ----------------------------------------------------------------------------
// setData
template <class T>
int CSnapshotGadgetH5Out<T>::setData(std::string name, const int n ,T * data,const bool _addr)
int CSnapshotGadgetH5Out<T>::setData(std::string name, const long int n ,T * data,const bool _addr)
{
int status=0;
switch(CunsOut2<T>::s_mapStringValues[name]) {
......@@ -745,7 +745,7 @@ int CSnapshotGadgetH5Out<T>::setData(std::string name, const int n ,T * data,con
// setData
// setData("all","id",n,gas_array,true)
template <class T>
int CSnapshotGadgetH5Out<T>::setData(std::string name,std::string array, const int n ,int * data,const bool _addr)
int CSnapshotGadgetH5Out<T>::setData(std::string name,std::string array, const long int n ,long int * data,const bool _addr)
{
int status=0;
switch(CunsOut2<T>::s_mapStringValues[array]) {
......@@ -767,7 +767,7 @@ int CSnapshotGadgetH5Out<T>::setData(std::string name,std::string array, const
// ----------------------------------------------------------------------------
// setData
template <class T>
int CSnapshotGadgetH5Out<T>::setData(std::string name, const int n ,int * data,const bool _addr)
int CSnapshotGadgetH5Out<T>::setData(std::string name, const long int n ,long int * data,const bool _addr)
{
int status=0;
return status;
......@@ -776,7 +776,7 @@ int CSnapshotGadgetH5Out<T>::setData(std::string name, const int n ,int * data,c
// setData
// setData("gas",n,pos,vel,mass,true)
template <class T>
int CSnapshotGadgetH5Out<T>::setData(std::string name, const int n ,T * data, T * data1, T * data2, const bool _addr)
int CSnapshotGadgetH5Out<T>::setData(std::string name, const long int n ,T * data, T * data1, T * data2, const bool _addr)
{
int status=0;
return status;
......@@ -814,12 +814,12 @@ int CSnapshotGadgetH5Out<T>::save()
// return ok if NOT same masses
template <class T>
template <class U>
bool CSnapshotGadgetH5Out<T>::checkMasses(const int n, U *data, const int comp_id)
bool CSnapshotGadgetH5Out<T>::checkMasses(const long int n, U *data, const long int comp_id)
{
bool same_mass=true;
U massref=data[0];
// check if same masses
for ( int i=1; i<n;i++) {
for ( long int i=1; i<n;i++) {
if (massref != data[i]) { // not same mass
same_mass=false;
break;
......@@ -840,7 +840,7 @@ bool CSnapshotGadgetH5Out<T>::checkMasses(const int n, U *data, const int comp_i
template <class T>
template <class U>
bool CSnapshotGadgetH5Out<T>::saveCommonDataset(std::string comp,std::string tag,
const int n ,U * data, const unsigned int second_dim)
const long int n ,U * data, const unsigned long int second_dim)
{
bool ok=false;
......@@ -1020,8 +1020,8 @@ template <class U> std::vector<U> GH5<T>::getAttribute(std::string attr_name)
if (verbose) {
std::cerr << "rank " << arank << ", dimensions " ;
}
int nbelements=0;
for (int i=0; i<arank; i++) {
long int nbelements=0;
for (long int i=0; i<arank; i++) {
if (verbose) {
std::cerr << (unsigned long)(adims_out[i]);
if (i<arank-1) std::cerr << " x " ;
......@@ -1057,14 +1057,14 @@ template <class U> std::vector<U> GH5<T>::getDataset(std::string dset_name, U du
// Get dataspace of the dataset
DataSpace dataspace = dataset.getSpace();
// Get the number of dimensions in the dataspace
int rank = dataspace.getSimpleExtentNdims();
long int rank = dataspace.getSimpleExtentNdims();
hsize_t dims_out[rank];
dataspace.getSimpleExtentDims( dims_out, NULL);
if (verbose) {
std::cerr << "rank " << rank << ", dimensions " ;
}
int nbelements=0;
for (int i=0; i<rank; i++) {
long int nbelements=0;
for (long int i=0; i<rank; i++) {
if (verbose) {
std::cerr << (unsigned long)(dims_out[i]);
if (i<rank-1) std::cerr << " x " ;
......@@ -1087,7 +1087,11 @@ template <class U> std::vector<U> GH5<T>::getDataset(std::string dset_name, U du
DataType mem_type;
switch (data_type.getClass()) {
case H5T_INTEGER :
mem_type = PredType::NATIVE_INT;//H5T_NATIVE_INT;
if (sizeof(U)==sizeof(long)) {
mem_type = PredType::NATIVE_LONG;//H5T_NATIVE_LONG;
} else {
mem_type = PredType::NATIVE_INT; //H5T_NATIVE_INT;
}
break;
case H5T_FLOAT :
if (sizeof(U)==sizeof(double)) {
......@@ -1116,8 +1120,8 @@ template <class U> std::vector<U> GH5<T>::getDataset(std::string dset_name, U du
//
template <class T>
template <class U>
bool GH5<T>::setDataset(std::string dset_name, U * data, const unsigned int n,
const unsigned int second_dim)
bool GH5<T>::setDataset(std::string dset_name, U * data, const unsigned long int n,
const unsigned long int second_dim)
{
bool ok=true;
assert(second_dim==1 || second_dim==3);
......@@ -1140,7 +1144,7 @@ bool GH5<T>::setDataset(std::string dset_name, U * data, const unsigned int n,
histo_group[groupname]=true;
}
// set the number of dimensions in the dataspace
int rank=1;
long int rank=1;
hsize_t dims_out[2];
dims_out[0] = n;
......@@ -1171,7 +1175,7 @@ bool GH5<T>::setDataset(std::string dset_name, U * data, const unsigned int n,
//
template <class T>
template <class U>
bool GH5<T>::setAttribute(std::string attr_name, U * attr_value, const int n)
bool GH5<T>::setAttribute(std::string attr_name, U * attr_value, const long int n)
{
if (verbose) {
std::cerr << "= = = = = = = = = = = = = = = = = =\n";
......
......@@ -62,17 +62,17 @@ public:
// reading
template <class U> std::vector<U> getDataset(std::string dset_name, U );
template <class U> std::vector<U> getAttribute(std::string attr_name);
int getNpartTotal() { return npart_total; }
long int getNpartTotal() { return npart_total; }
// writing
template <class U>
bool setDataset(std::string dset_name, U * data, const unsigned int n, const unsigned int second_dim);
template <class U> bool setAttribute(std::string attr_name, U *, const int );
bool setDataset(std::string dset_name, U * data, const unsigned long int n, const unsigned long int second_dim);
template <class U> bool setAttribute(std::string attr_name, U *, const long int );
private:
std::map<std::string, bool> histo_group;
bool verbose;
void readHeaderAttributes();
int npart_total;
long int npart_total;
template <class U>
DataType guessType(U);
std::string f_name;
......@@ -98,12 +98,12 @@ public:
// virtual function implemented
//template <class U> std::vector<U> getData(const std::string, const std::string);
template <class U> void getData(const std::string, const std::string);
bool getData(const std::string,int *n,T **);
bool getData(const std::string,long int *n,T **);
bool getData(const std::string, T * );
bool getData(const std::string,int *n,int **);
bool getData(const std::string, int * );
bool getData(const std::string, const std::string ,int *,T **);
bool getData(const std::string, const std::string ,int *,int **);
bool getData(const std::string,long int *n,long int **);
bool getData(const std::string, long int * );
bool getData(const std::string, const std::string ,long int *,T **);
bool getData(const std::string, const std::string ,long int *,long int **);
bool isNewFrame() { return first_loc;}
int close();
......@@ -113,7 +113,7 @@ private:
unsigned int comp_bits;
std::vector <T> pos,vel,mass, acc,pot, hsml,rho,temp,age,s_metal, g_metal,uenerg;
std::vector <int> indexes,id;
std::vector <long int> indexes,id;
// HDF5 gadget object
GH5<T> * myH5;
......@@ -121,7 +121,7 @@ private:
// methods
T getTime() { return myH5->getHeader().Time;}
template <class U>
bool loadCommonDataset(std::string tag, std::vector<U> &data, const int dim);
bool loadCommonDataset(std::string tag, std::vector<U> &data, const long int dim);
template <class U>
bool loadDataset(std::string tag, std::vector<U> &data);
void storeComponents();
......@@ -138,24 +138,24 @@ public:
CSnapshotGadgetH5Out(const std::string, const std::string, const bool);
~CSnapshotGadgetH5Out();
int setHeader(void * );
int setNbody(const int _n);
int setNbody(const long int _n);
int setData(std::string, T);
int setData(std::string, const int , T *,const bool _addr=false);
int setData(std::string, const long int , T *,const bool _addr=false);
// array by double keys
int setData(std::string, std::string, const int , T *,const bool _addr=false);
int setData(std::string, std::string, const int , int *,const bool _addr=false);
int setData(std::string, std::string, const long int , T *,const bool _addr=false);
int setData(std::string, std::string, const long int , long int *,const bool _addr=false);
int setData(std::string, const int , int *,const bool _addr=false);
int setData(std::string, const int ,
int setData(std::string, const long int , long int *,const bool _addr=false);
int setData(std::string, const long int ,
T *, T *, T *, const bool _addr=false);
int save();
private:
// methods
template <class U>
bool saveCommonDataset(std::string name,std::string dataset, const int n ,U * data, const unsigned int);
bool saveCommonDataset(std::string name,std::string dataset, const long int n ,U * data, const unsigned long int);
template <class U>
bool checkMasses(const int n ,U * data, const int comp_id);
bool checkMasses(const long int n ,U * data, const long int comp_id);
// HDF5 gadget object
GH5<T> * myH5;
t_h5_header header;
......
......@@ -54,7 +54,7 @@ namespace uns {
std::string parse;
// following loop parse each lines previously read
//
int cpt=0;
long int cpt=0;
bool equal=false;
while ( str >> parse && // something to read
parse[0] != '#' && // not commented out
......@@ -167,9 +167,9 @@ template <class T> void CSnapshotInterfaceIn<T>::computeBits(std::string bits)
template <class T> void CSnapshotInterfaceIn<T>::getRangeTime(const std::string rtime)
{
std::vector<float> store;
int ppos=0;
long int ppos=0;
bool stop=false;
int cpt=0;
long int cpt=0;
while (! stop) {
size_t found = rtime.find(':',ppos);
if (found!=std::string::npos) {
......@@ -254,11 +254,11 @@ template <class T> bool CSnapshotInterfaceIn<T>::checkRangeTime(const float curr
// getRangeSelect
// return #bodies first and last particles for the selected particles in the
// selected range
template <class T> bool CSnapshotInterfaceIn<T>::getRangeSelect(const char * _comp, int * nbody, int * first,
int * last, bool fortran )
template <class T> bool CSnapshotInterfaceIn<T>::getRangeSelect(const char * _comp, long int * nbody, long int * first,
long int * last, bool fortran )
{
std::string current_s,next_s;
int offset=0;
long int offset=0;
bool stop=false,status=false;
*nbody=*first=*last=0;
if (valid) {
......@@ -274,7 +274,7 @@ template <class T> bool CSnapshotInterfaceIn<T>::getRangeSelect(const char * _c
// loop on all user's selected component
while ((current_s=uns::UserSelection::parseString(next_s)) != "" && !stop ) {
// return the component's index belonging to the users' crv (last param=true)
int index=uns::ComponentRange::getIndexMatchType(crv,current_s,offset,true);
long int index=uns::ComponentRange::getIndexMatchType(crv,current_s,offset,true);
//std::cerr << "index="<<index<<" current_s="<<current_s<<" comp="<<comp<<"\n";
if (index>=0) {
if (current_s != comp) {
......@@ -285,7 +285,7 @@ template <class T> bool CSnapshotInterfaceIn<T>::getRangeSelect(const char * _c
//ComponentRange::list(crvs);
assert(crvs);
// return the component's index belonging to the SNAPSHOT'S crv
int index=uns::ComponentRange::getIndexMatchType(crvs,comp,offset);
long int index=uns::ComponentRange::getIndexMatchType(crvs,comp,offset);
if (index>=0) { // the component exist
*nbody=(*crvs)[index].n;
//offset+=(*crv)[index].n;
......@@ -308,7 +308,7 @@ template <class T> bool CSnapshotInterfaceIn<T>::getRangeSelect(const char * _c
}
if (stop) {
status=true;
int plusone;
long int plusone;
if (fortran) plusone=1;
else plusone=0;
#if 1
......
......@@ -101,12 +101,12 @@ namespace uns {
// particles not selected must have the value '-1'
virtual int nextFrame(uns::UserSelection &)= 0;
virtual int close() = 0;
virtual bool getData(const std::string,int *,T **)=0;
virtual bool getData(const std::string,long int *,T **)=0;
virtual bool getData(const std::string, T * )=0;
virtual bool getData(const std::string,int *,int **)=0;
virtual bool getData(const std::string, int * )=0;
virtual bool getData(const std::string, const std::string ,int *,T **)=0;
virtual bool getData(const std::string, const std::string ,int *,int **)=0;
virtual bool getData(const std::string,long int *,long int **)=0;
virtual bool getData(const std::string,long int * )=0;
virtual bool getData(const std::string, const std::string ,long int *,T **)=0;
virtual bool getData(const std::string, const std::string ,long int *,long int **)=0;
// futur implementation
// template <class U> std::vector<U> getData(const std::string, const std::string) {
......@@ -120,8 +120,8 @@ namespace uns {
virtual bool isEndOfData() const { return end_of_data;}
virtual std::string getFileName() { return filename;}
virtual std::string getSimDir() { return simdir;}
virtual int getNSel() { return nsel;}
virtual void setNsel(const int _nsel) { nsel = _nsel;}
virtual long int getNSel() { return nsel;}
virtual void setNsel(const long int _nsel) { nsel = _nsel;}
virtual bool isNewFrame() { return true;}
virtual int nextFrame(std::string bits="");//mxvpaekXRMAHIU");
virtual ComponentRangeVector * getCrvFromSelection() { return user_select.getCrvFromSelection();}
......@@ -141,20 +141,20 @@ namespace uns {
// normal functions
bool isValidData() { return valid; }
void setFileName(std::string _f) { filename = _f;}
bool getRangeSelect(const char *, int *, int *, int * , bool fortran=false);
bool getRangeSelect(const char *, long int *, long int *, long int * , bool fortran=false);
std::string parseConfig(std::string);
//std::string getFileName() const { return filename;};
int getInterfaceIndex() { return interface_index; }
bool isFileExist() { return true; }
std::string getSelectPart() { return select_part; }
std::string getSelectTime() { return select_time; }
int nbody_first;
long int nbody_first;
T time_first, time;
ComponentRangeVector crv_first;
UserSelection user_select; // object to store user component selection
protected:
// READING
int nsel;
long int nsel;
CSnapshotInterfaceIn * obj;
std::string filename;
......@@ -173,7 +173,7 @@ namespace uns {
unsigned int load_bits, comp_bits;
inline bool ckloadBit(unsigned int lb) { return load_bits & lb; }
/*template <class T>*/ inline void freeNotLoadedData(T ** data,unsigned int lb) {
/*template <class T>*/ inline void freeNotLoadedData(T ** data,unsigned long int lb) {
if (!ckloadBit(lb) && *data) {
delete [] *data;
*data=NULL;
......@@ -209,16 +209,16 @@ namespace uns {
// Pure Virtual functions, *** MUST be implemented ***
// ---------------------------------------------------
virtual int setHeader(void * ) = 0;
virtual int setNbody(const int) = 0;
virtual int setNbody(const long int) = 0;
virtual int setData(std::string, T) = 0;
virtual int setData(std::string, const int, T *,const bool _addr=false)=0;
virtual int setData(std::string, const long int, T *,const bool _addr=false)=0;
// array by T keys
// like "halo" "pos" => position of the halo requested
virtual int setData(std::string, std::string, const int , T *,const bool _addr=false)=0;
virtual int setData(std::string, std::string, const int , int *,const bool _addr=false)=0;
virtual int setData(std::string, const int ,
virtual int setData(std::string, std::string, const long int , T *,const bool _addr=false)=0;
virtual int setData(std::string, std::string, const long int , long int *,const bool _addr=false)=0;
virtual int setData(std::string, const long int ,
T *, T *, T *,const bool _addr=false)=0;
virtual int setData(std::string, const int, int *,const bool _addr=false)=0;
virtual int setData(std::string, const long int, long int *,const bool _addr=false)=0;
virtual int save()=0;
//virtual std::vector<double> moveToCom()=0;
std::string getInterfaceType() { return interface_type;}
......
......@@ -143,7 +143,7 @@ template <class T> bool CSnapshotList<T>::getLine(const bool force)
std::string parse;
// following loop parse each lines previously read
//
int cpt=0;
long int cpt=0;
while ( str >> parse && // something to read
parse[0] != '#' && // not commented out
parse[0] != '!' && // not commented out
......@@ -153,7 +153,7 @@ template <class T> bool CSnapshotList<T>::getLine(const bool force)
if (cpt==1) snapname=parse;
}
if (cpt > 0 ) {
unsigned int i=0;
unsigned long int i=0;
while(i<snapname.length() && snapname[i]==' ') i++; // search first non blank
if (i<snapname.length() && snapname[i]!='/') // first char not a '/'
{;}//snapname = dirpath.toStdString() + snapname; // append to dirpath
......
......@@ -35,14 +35,14 @@ namespace uns {
int nextFrame(uns::UserSelection &);
int close() { return 1;}
ComponentRangeVector * getSnapshotRange();
bool getData(const std::string name,int *n,T **f) { return snapshot->getData(name,n,f); }
bool getData(const std::string name,long int *n,T **f) { return snapshot->getData(name,n,f); }
bool getData(const std::string name, T * f) { return snapshot->getData(name, f); }
bool getData(const std::string name,int *n,int **i) { return snapshot->getData(name,n,i); }
bool getData(const std::string name, int * i) { return snapshot->getData(name, i); }
bool getData(const std::string comp, const std::string name,int *n,T **f) {
bool getData(const std::string name,long int *n,long int **i) { return snapshot->getData(name,n,i); }
bool getData(const std::string name, long int * i) { return snapshot->getData(name, i); }
bool getData(const std::string comp, const std::string name,long int *n,T **f) {
return snapshot->getData(comp,name,n,f);
}
bool getData(const std::string comp, const std::string name,int *n,int **i) {
bool getData(const std::string comp, const std::string name,long int *n,long int **i) {
return snapshot->getData(comp,name,n,i);
}
//float getEps(const std::string);
......
This diff is collapsed.
......@@ -38,22 +38,22 @@ namespace uns {
int close();
ComponentRangeVector * getSnapshotRange();
// virtual function implemented
bool getData(const std::string,int *n,T **);
bool getData(const std::string,long int *n,T **);
bool getData(const std::string, T * );
bool getData(const std::string,int *n,int **);
bool getData(const std::string, int * );
bool getData(const std::string, const std::string ,int *,T **);
bool getData(const std::string, const std::string ,int *,int **);
bool getData(const std::string,long int *n,long int **);
bool getData(const std::string, long int * );
bool getData(const std::string, const std::string ,long int *,T **);
bool getData(const std::string, const std::string ,long int *,long int **);
private:
int full_nbody;
int * nemobits , * ionbody, *iokeys;
int * keys;
long int full_nbody;
long int * nemobits , * ionbody, *iokeys;
long int * keys;
T * iotime, *iopos, *iovel, *iomass, *iorho, *ioaux, *ioacc, *iopot, *ioeps;
T * pos, *vel, *mass, * rho, *acc, *aux, *pot, *eps;
bool first_stream;
int status_ionemo;
int last_nbody,last_nemobits;
long int last_nbody,last_nemobits;
void checkBits(std::string,const int);
bool isValidNemo();
T * getPos() { //checkBits("pos",PosBit);
......@@ -67,9 +67,9 @@ private:
T * getAux() { return aux ;}
T * getAcc() { return acc ;}
T * getPot() { return pot ;}
int * getKeys() { return keys;}
long int * getKeys() { return keys;}
T getTime() { return *iotime; }
int getNbody(){ return *ionbody;}
long int getNbody(){ return *ionbody;}
std::string realString() { // return a string with the real format
std::string io_nemo_select;
......@@ -93,15 +93,15 @@ private:
CSnapshotNemoOut(const std::string, const std::string, const bool);
~CSnapshotNemoOut();
int setHeader(void * );
int setNbody(const int _n);
int setNbody(const long int _n);
int setData(std::string, T);
int setData(std::string, const int , T *,const bool _addr=false);
int setData(std::string, const long int , T *,const bool _addr=false);
// array by double keys
int setData(std::string, std::string, const int , T *,const bool _addr=false);
int setData(std::string, std::string, const int , int *,const bool _addr=false);
int setData(std::string, std::string, const long int , T *,const bool _addr=false);
int setData(std::string, std::string, const long int , long int *,const bool _addr=false);
int setData(std::string, const int , int *,const bool _addr=false);
int setData(std::string, const int ,
int setData(std::string, const long int , long int *,const bool _addr=false);
int setData(std::string, const long int ,
T *, T *, T *, const bool _addr=false);
int save();
std::vector<double> moveToCom();
......@@ -111,9 +111,10 @@ private:
std::map<std::string, bool> ptrIsAlloc;
T * mass, * pos, * vel, * aux, * acc, * pot, * rho, * eps;
T time;
int * keys;
int nbody;
int bits;
long int * keys;
int * int_keys;
long int nbody;
long int bits;
bool is_saved, is_closed;
std::string realString() { // return a string with the real format
......@@ -130,8 +131,8 @@ private:
return io_nemo_select;
}
// array
int setArray(const int _n, const int _d, T * src, T ** dest, const char * name, const int tbits, const bool addr);
int setArray(const int _n, const int _d, int * src, int ** dest, const char * name, const int tbits, const bool addr);
int setArray(const long int _n, const long int _d, T * src, T ** dest, const char * name, const long int tbits, const bool addr);
int setArray(const long int _n, const long int _d, long int * src, long int ** dest, const char * name, const long int tbits, const bool addr);
};
}
#endif
......@@ -145,8 +145,8 @@ template <class T> int CSnapshotRamsesIn<T>::reorderParticles(uns::UserSelection
{
if (this->verbose) std::cerr <<"Nbody particles loaded="<<particles->ntot<<"\n";
std::vector <int> offset_comp(6,-1); // init 6 offsets with value =-1
std::vector <int> npart_comp(6,0); // initialise #part per component to ZERO
std::vector <long int> offset_comp(6,-1); // init 6 offsets with value =-1
std::vector <long int> npart_comp(6,0); // initialise #part per component to ZERO
char * comp[] = { (char*) "gas",(char*) "halo",(char*) "disk",(char*) "bulge",(char*) "stars",(char*) "bndry",(char*) "all" };
// get ordering
std::vector <int> select_order = user_select.selectOrder();
......@@ -221,7 +221,7 @@ template <class T> int CSnapshotRamsesIn<T>::reorderParticles(uns::UserSelection
// particles reordering
if (particles->ntot && this->req_bits) { // exist particles to reorder
std::vector <int> id;
std::vector <long int> id;
std::vector <T> pos,vel,mass,metal;
if (particles->pos.size()>0)
pos.resize(particles->pos.size()); // resize new pos vector
......@@ -304,13 +304,13 @@ template <class T> int CSnapshotRamsesIn<T>::reorderParticles(uns::UserSelection
// ============================================================================
// getData
// return requested array according 'name' selection
template <class T> bool CSnapshotRamsesIn<T>::getData(const std::string comp, std::string name, int *n,T **data)
template <class T> bool CSnapshotRamsesIn<T>::getData(const std::string comp, std::string name, long int *n,T **data)
{
bool ok=true;
*data=NULL;
*n = 0;
int nbody,first,last;
long int nbody,first,last;
bool status=this->getRangeSelect(comp.c_str(),&nbody,&first,&last,false); // find components ranges
if (!status && comp=="all") { // retreive all particles selected by the user
status=1;
......@@ -434,12 +434,12 @@ template <class T> bool CSnapshotRamsesIn<T>::getData(const std::string comp, st
// ============================================================================
// getData
// return requested array according 'name' selection
template <class T> bool CSnapshotRamsesIn<T>::getData(const std::string name,int *n,T **data)
template <class T> bool CSnapshotRamsesIn<T>::getData(const std::string name,long int *n,T **data)
{
bool ok=true;
*data = NULL;
*n = 0;
int first=0;
long int first=0;
bool status=true;
switch(CunsOut2<T>::s_mapStringValues[name]) {
......@@ -566,13 +566,13 @@ template <class T> bool CSnapshotRamsesIn<T>::getData(const std::string name,T *
// ============================================================================
// getData
// return requested array according 'name' selection
template <class T> bool CSnapshotRamsesIn<T>::getData(const std::string comp,const std::string name,int *n, int **data)
template <class T> bool CSnapshotRamsesIn<T>::getData(const std::string comp,const std::string name,long int *n, long int **data)
{
bool ok=true;
*data=NULL;
*n = 0;
int nbody,first,last;
long int nbody,first,last;
bool status=this->getRangeSelect(comp.c_str(),&nbody,&first,&last,false); // find components ranges
if (!status && comp=="all") { // retreive all particles selected by the user
status=1;
......@@ -610,7 +610,7 @@ template <class T> bool CSnapshotRamsesIn<T>::getData(const std::string comp,con
// ============================================================================
// getData
// return requested array according 'name' selection
template <class T> bool CSnapshotRamsesIn<T>::getData(const std::string name,int *n, int **data)
template <class T> bool CSnapshotRamsesIn<T>::getData(const std::string name,long int *n, long int **data)
{
bool ok=false;
return ok;
......@@ -618,7 +618,7 @@ template <class T> bool CSnapshotRamsesIn<T>::getData(const std::string name,int
// ============================================================================
// getData
// return requested int according 'name' selection
template <class T> bool CSnapshotRamsesIn<T>::getData(const std::string name,int *data)
template <class T> bool CSnapshotRamsesIn<T>::getData(const std::string name,long int *data)
{
bool ok=true;
*data=0;
......
......@@ -38,8 +38,8 @@ public:
load_bits=0;
}
std::vector <T> pos,vel,mass,hsml,rho,acc,phi,temp,age,metal;
std::vector <int> indexes,id;
int ntot, ngas, ndm, nstars;
std::vector <long int> indexes,id;
long int ntot, ngas, ndm, nstars;
unsigned int load_bits;
};
......@@ -54,12 +54,12 @@ public:
// pure virtual function implemented
ComponentRangeVector * getSnapshotRange();
int nextFrame(uns::UserSelection &);
bool getData(const std::string,int *n,T **);
bool getData(const std::string,long int *n,T **);
bool getData(const std::string, T * );
bool getData(const std::string,int *n,int **);
bool getData(const std::string, int * );
bool getData(const std::string, const std::string ,int *,T **);
bool getData(const std::string, const std::string ,int *,int **);
bool getData(const std::string,long int *n,long int **);
bool getData(const std::string, long int * );
bool getData(const std::string, const std::string ,long int *,T **);
bool getData(const std::string, const std::string ,long int *,long int **);
int close();
private:
......
......@@ -191,7 +191,7 @@ template <class T> bool CSnapshotSimIn<T>::readSqlEps()
if (this->verbose) sql->display();
assert(sql->vdata[0]==sim_filename);
std::stringstream str;
for (unsigned int i=1; i< sql->vdata.size(); i++) {
for (unsigned long int i=1; i< sql->vdata.size(); i++) {
str << sql->vdata[i]; // convert string to stream string
str >> this->eps[i-1]; // convert to float
}
......@@ -468,7 +468,7 @@ template <class T> int CSnapshotSimIn<T>::addNemoComponent(int& offset, std::str
std::string comp )
{
#if 0
int nbody;
long int nbody;
std::istringstream ss(parse);
ss >> nbody;
if (nbody) {
......@@ -487,11 +487,11 @@ template <class T> int CSnapshotSimIn<T>::addNemoComponent(int& offset, std::str
std::istringstream ss;
//std::cerr << "substr=[" << parse.substr(0,found-1) << "]\n";
ss.str(parse.substr(0,found));
int start;
long int start;
ss >> start;
ss.clear();
ss.str(parse.substr(found+1));
int end;
long int end;
ss >> end;
uns::ComponentRange cr;
//std::cerr << "parse="<< parse << " start="<< start << " end="<< end << " comp="<<comp << "\n";
......@@ -572,7 +572,7 @@ template <class T> bool CSnapshotSimIn<T>::buildNemoFile()
template <class T> bool CSnapshotSimIn<T>::buildGadgetH5File()
{
bool stop=false,status=false;
int cpt=1;
long int cpt=1;
// loop on all the possibility of file
// dirname+basename+nframe
// ex : gas001_0 gas001_00 gas001_000
......@@ -622,7 +622,7 @@ template <class T> bool CSnapshotSimIn<T>::buildGadgetH5File()
template <class T> bool CSnapshotSimIn<T>::buildGadgetFile()
{
bool stop=false,status=false;
int cpt=1;
long int cpt=1;
// loop on all the possibility of file
// dirname+basename+nframe
// ex : gas001_0 gas001_00 gas001_000
......@@ -723,7 +723,7 @@ template <class T> int CSnapshotSimIn<T>::getCod(const std::string select,
if ( ! fi.eof()) {
std::istringstream str(line); // stream line
std::string parse;
int cpt=0;
long int cpt=0;
// get time
str >> parse; // read time
std::stringstream str2; // convert to stream
......
......@@ -33,14 +33,14 @@ namespace uns {
int nextFrame(uns::UserSelection &);
int close() { return 1;}
ComponentRangeVector * getSnapshotRange();
bool getData(const std::string name,int *n,T **f) { return snapshot->getData(name,n,f); }
bool getData(const std::string name,long int *n,T **f) { return snapshot->getData(name,n,f); }
bool getData(const std::string name, T * f) { return snapshot->getData(name, f); }
bool getData(const std::string name,int *n,int **i) { return snapshot->getData(name,n,i); }
bool getData(const std::string name, int * i) { return snapshot->getData(name, i); }
bool getData(const std::string comp, const std::string name,int *n,T **f) {
bool getData(const std::string name,long int *n,long int **i) { return snapshot->getData(name,n,i); }
bool getData(const std::string name, long int * i) { return snapshot->getData(name, i); }
bool getData(const std::string comp, const std::string name,long int *n,T **f) {
return snapshot->getData(comp,name,n,f);
}
bool getData(const std::string comp, const std::string name,int *n,int **i) {
bool getData(const std::string comp, const std::string name,long int *n,long int **i) {
return snapshot->getData(comp,name,n,i);
}
T getEps(const std::string);
......
......@@ -185,9 +185,9 @@ template <class T> int CunsIn2<T>::nextFrame(const char * _bits) {
// ----------------------------------------------------------------------------
// getData
template <class T> bool CunsIn2<T>::getData(const std::string comp,const std::string prop,
unsigned int * size,T ** farray) {
long int * size,T ** farray) {
T * data=NULL;
int nbody=0;
long int nbody=0;
*size=0;
bool ok=snapshot->getData(comp,prop,&nbody,&data);
if (ok) {
......@@ -201,9 +201,9 @@ template <class T> bool CunsIn2<T>::getData(const std::string comp,const std::s
// ----------------------------------------------------------------------------
// getData
template <class T> bool CunsIn2<T>::getData(const std::string prop,
unsigned int * size,T ** farray) {
long int * size,T ** farray) {
T * data=NULL;
int nbody=0;
long int nbody=0;
*size=0;
bool ok=snapshot->getData(prop,&nbody,&data);
if (ok) {
......@@ -224,9 +224,9 @@ template <class T> bool CunsIn2<T>::getData(const std::string prop,T * fvalue)
// getData
// int
template <class T> bool CunsIn2<T>::getData(const std::string comp,const std::string prop,
unsigned int * size,int ** iarray) {
int * data=NULL;
int nbody=0;
long int * size,long int ** iarray) {
long int * data=NULL;
long int nbody=0;
*size=0;
bool ok=snapshot->getData(comp,prop,&nbody,&data);
if (ok) {
......@@ -240,9 +240,9 @@ template <class T> bool CunsIn2<T>::getData(const std::string comp,const std::s
// getData
// int
template <class T> bool CunsIn2<T>::getData(const std::string prop,
unsigned int * size,int ** iarray) {
int * data=NULL;
int nbody=0;
long int * size,long int ** iarray) {
long int * data=NULL;
long int nbody=0;
*size=0;
bool ok=snapshot->getData(prop,&nbody,&data);
if (ok) {
......@@ -255,7 +255,7 @@ template <class T> bool CunsIn2<T>::getData(const std::string prop,
// ----------------------------------------------------------------------------
// getData
// int
template <class T> bool CunsIn2<T>::getData(const std::string prop,int * ivalue) {
template <class T> bool CunsIn2<T>::getData(const std::string prop,long int * ivalue) {
bool ok=snapshot->getData(prop,ivalue);
return ok;
}
......@@ -306,14 +306,14 @@ template <class T> CunsOut2<T>::~CunsOut2()
// ----------------------------------------------------------------------------
// setData comp prop farray
template <class T> int CunsOut2<T>::setData(const std::string comp,const std::string prop,
unsigned int size,T * farray, const bool _addr) {
long int size,T * farray, const bool _addr) {
int status = snapshot->setData(comp,prop,size,farray,_addr);
return status;
}
// ----------------------------------------------------------------------------
// setData prop farray
template <class T> int CunsOut2<T>::setData(const std::string prop,
unsigned int size,T * farray, const bool _addr) {
long int size,T * farray, const bool _addr) {
int status = snapshot->setData(prop,size,farray,_addr);
return status;
}
......@@ -326,20 +326,20 @@ template <class T> int CunsOut2<T>::setData(const std::string prop,T fvalue) {
// ----------------------------------------------------------------------------
// setData comp prop iarray
template <class T> int CunsOut2<T>::setData(const std::string comp,const std::string prop,
unsigned int size,int * iarray, const bool _addr) {
long int size,long int * iarray, const bool _addr) {
int status = snapshot->setData(comp,prop,size,iarray,_addr);
return status;
}
// ----------------------------------------------------------------------------
// setData prop iarray
template <class T> int CunsOut2<T>::setData(const std::string prop,
unsigned int size,int * iarray, const bool _addr) {
long int size,long int * iarray, const bool _addr) {
int status = snapshot->setData(prop,size,iarray,_addr);
return status;
}
// ----------------------------------------------------------------------------
// setData prop ivalue
template <class T> int CunsOut2<T>::setData(const std::string prop,int ivalue) {
template <class T> int CunsOut2<T>::setData(const std::string prop,long int ivalue) {
int status = snapshot->setData(prop,ivalue);
return status;
}
......
......@@ -58,7 +58,7 @@
namespace uns {
const std::string VERSION="1.2.0.pre-November-24th-2016"; // UNSIO version
const std::string VERSION="1.2.0.pre-longint-November-26th-2016"; // UNSIO version
inline std::string getVersion() { return uns::VERSION; }
......@@ -150,17 +150,17 @@ enum StringData {
int nextFrame(const char * _bits);
// T
bool getData(const std::string comp,const std::string prop,
unsigned int * size,T ** farray);
long int * size,T ** farray);
bool getData(const std::string prop,
unsigned int * size,T ** farray);
long int * size,T ** farray);
bool getData(const std::string prop,T * fvalue);
// int
bool getData(const std::string comp,const std::string prop,
unsigned int * size,int ** iarray);
long int * size,long int ** iarray);
bool getData(const std::string prop,
unsigned int * size,int ** iarray);
bool getData(const std::string prop,int * ivalue);
long int * size,long int ** iarray);
bool getData(const std::string prop,long int * ivalue);
// close
......@@ -230,18 +230,18 @@ typedef CunsIn2<double> CunsInD;
// py wrapper
// setData FLOAT/DOUBLE
int setData(const std::string comp,const std::string prop,
unsigned int size,T * farray, const bool _addr=false);
long int size,T * farray, const bool _addr=false);
int setData(const std::string prop,
unsigned int size,T * farray, const bool _addr=false);
long int size,T * farray, const bool _addr=false);
int setData(const std::string prop,
T fvalue);
// setData INT
int setData(const std::string comp,const std::string prop,
unsigned int size,int * iarray, const bool _addr=false);
long int size,long int * iarray, const bool _addr=false);
int setData(const std::string prop,
unsigned int size,int * iarray, const bool _addr=false);
long int size,long int * iarray, const bool _addr=false);
int setData(const std::string prop,
int ivalue);
long int ivalue);
//
int save();
......
......@@ -214,7 +214,7 @@ int uns_get_array_f_( const int * id, const char * _comp, const char * _tag, flo
std::string tag = tools::Ctools::fixFortran(_tag,l2);
std::string comp = tools::Ctools::fixFortran(_comp,l1);
float *data;
int nbody;
long int nbody;
bool ok=snap->getData(comp,tag,&nbody,&data);
int status=0;
if (ok) {
......@@ -237,13 +237,16 @@ int uns_get_array_i_( const int * id, const char * _comp, const char * _tag, int
// and the object
std::string tag = tools::Ctools::fixFortran(_tag,l2);
std::string comp = tools::Ctools::fixFortran(_comp,l1);
int *data;
int nbody;
long int *data;
long int nbody;
bool ok=snap->getData(comp,tag,&nbody,&data);
int status=0;
if (ok) {
checkFArray(*size,nbody);
memcpy(array,data,sizeof(float)*nbody);
//memcpy(array,data,sizeof(float)*nbody);
for (long int i=0; i<nbody; i++) {
array[i]=data[i];
}
status=nbody;
}
return status;
......@@ -268,7 +271,7 @@ int uns_get_value_f_( const int * id, const char * _tag, float * data, const
// ----------------------------------------------------------------------------
// uns_get_value_i_:
// return tag's value belonging to the simulation with the identifier ident
int uns_get_value_i_( const int * id, const char * _tag, int * data, const int l1)
int uns_get_value_i_( const int * id, const char * _tag, int * _data, const int l1)
{
int index=getUnsvIndex(*id);
uns::CSnapshotInterfaceIn<float> * snap = ((CunsIn2<float>*)unsv[index].obj)->snapshot;
......@@ -276,7 +279,9 @@ int uns_get_value_i_( const int * id, const char * _tag, int * data, const in
// and the object
std::string tag = tools::Ctools::fixFortran(_tag,l1);
int status=0;
bool ok=snap->getData(tag,data);
long int data;
bool ok=snap->getData(tag,&data);
*_data = (int) data;
if (ok) {
status=1;
}
......@@ -291,7 +296,7 @@ int uns_get_nbody_( const int * id, int * nbody)
uns::CSnapshotInterfaceIn<float> * snap = ((CunsIn2<float>*)unsv[index].obj)->snapshot;
// populate user_select object according to the selection
// and the object
*nbody = snap->getNSel();//user_select.getNSel();
*nbody = (int) snap->getNSel();//user_select.getNSel();
return *nbody;
}
// ----------------------------------------------------------------------------
......@@ -326,7 +331,7 @@ int uns_get_pos_( const int * id, float * pos, int * size)
// populate user_select object according to the selection
// and the object
float *data;
int nbody;
long int nbody;
bool ok=snap->getData("pos",&nbody,&data);
if (!ok) assert(0);
checkFArray(*size,nbody);
......@@ -343,7 +348,7 @@ int uns_get_vel_( const int * id, float * vel, int * size)
// populate user_select object according to the selection
// and the object
float *data;
int nbody;
long int nbody;
bool ok=snap->getData("vel",&nbody,&data);
if (!ok) assert(0);
checkFArray(*size,nbody);
......@@ -360,7 +365,7 @@ int uns_get_mass_( const int * id, float * mass, int * size)
// populate user_select object according to the selection
// and the object
float *data;
int nbody;
long int nbody;
bool ok=snap->getData("mass",&nbody,&data);
if (!ok) assert(0);
checkFArray(*size,nbody);
......@@ -378,7 +383,7 @@ int uns_get_age_( const int * id, float * age, int * size)
uns::CSnapshotInterfaceIn<float> * snap = ((CunsIn2<float>*)unsv[index].obj)->snapshot;
// populate user_select object according to the selection
// and the object
int nbody;
long int nbody;
float * data;
bool ok=snap->getData("age",&nbody,&data);
if (ok) {
......@@ -400,7 +405,7 @@ int uns_get_metal_( const int * id, float * metal, int * size)
uns::CSnapshotInterfaceIn<float> * snap = ((CunsIn2<float>*)unsv[index].obj)->snapshot;
// populate user_select object according to the selection
// and the object
int nbody;
long int nbody;
float * data;
bool ok=snap->getData("metal",&nbody,&data);
if (ok) {
......@@ -423,7 +428,7 @@ int uns_get_metal_gas_( const int * id, float * metal, int * size)
uns::CSnapshotInterfaceIn<float> * snap = ((CunsIn2<float>*)unsv[index].obj)->snapshot;
// populate user_select object according to the selection
// and the object
int nbody;
long int nbody;
float * data;
bool ok=snap->getData("gas_metal",&nbody,&data);
if (ok) {
......@@ -445,7 +450,7 @@ int uns_get_metal_stars_( const int * id, float * metal, int * size)
uns::CSnapshotInterfaceIn<float> * snap = ((CunsIn2<float>*)unsv[index].obj)->snapshot;
// populate user_select object according to the selection
// and the object
int nbody;
long int nbody;
float * data;
bool ok=snap->getData("stars_metal",&nbody,&data);
if (ok) {
......@@ -467,7 +472,7 @@ int uns_get_u_( const int * id, float * u, int * size)
uns::CSnapshotInterfaceIn<float> * snap = ((CunsIn2<float>*)unsv[index].obj)->snapshot;
// populate user_select object according to the selection
// and the object
int nbody;
long int nbody;
float * data;
bool ok=snap->getData("u",&nbody,&data);
if (ok) {
......@@ -489,7 +494,7 @@ int uns_get_temp_( const int * id, float * temp, int * size)
uns::CSnapshotInterfaceIn<float> * snap = ((CunsIn2<float>*)unsv[index].obj)->snapshot;
// populate user_select object according to the selection
// and the object
int nbody;
long int nbody;
float * data;
bool ok=snap->getData("temp",&nbody,&data);
if (ok) {
......@@ -511,7 +516,7 @@ int uns_get_rho_( const int * id, float * rho, int * size)
uns::CSnapshotInterfaceIn<float> * snap = ((CunsIn2<float>*)unsv[index].obj)->snapshot;
// populate user_select object according to the selection
// and the object
int nbody;
long int nbody;
float * data;
bool ok=snap->getData("rho",&nbody,&data);
if (ok) {
......@@ -533,7 +538,7 @@ int uns_get_hsml_( const int * id, float * hsml, int * size)
uns::CSnapshotInterfaceIn<float> * snap = ((CunsIn2<float>*)unsv[index].obj)->snapshot;
// populate user_select object according to the selection