Imported FLASH I/O functionality

This commit is contained in:
Guilhem Lavaux 2011-06-06 09:56:54 -04:00
parent 46a8ca36ae
commit 2fd8d06e36
7 changed files with 780 additions and 1 deletions

View File

@ -17,6 +17,7 @@ find_library(NETCDFCPP_LIBRARY netcdf_c++)
find_library(GSL_LIBRARY gsl) find_library(GSL_LIBRARY gsl)
find_library(GSLCBLAS_LIBRARY gslcblas) find_library(GSLCBLAS_LIBRARY gslcblas)
include(FindHDF5)
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)

View File

@ -11,6 +11,13 @@ SET(CosmoTool_SRCS
growthFactor.cpp growthFactor.cpp
) )
if (HDF5_FOUND)
set(CosmoTool_SRCS ${CosmoTool_SRCS}
h5_readFlash.cpp
loadFlash.cpp
)
endif (HDF5_FOUND)
SET(CosmoTool_SRCS ${CosmoTool_SRCS} SET(CosmoTool_SRCS ${CosmoTool_SRCS}
bqueue.hpp bqueue.hpp
config.hpp config.hpp
@ -37,7 +44,15 @@ SET(CosmoTool_SRCS ${CosmoTool_SRCS}
include_directories(${GSL_INCLUDE_PATH} ${NETCDF_INCLUDE_PATH}) include_directories(${GSL_INCLUDE_PATH} ${NETCDF_INCLUDE_PATH})
add_library(CosmoTool ${CosmoTool_SRCS}) add_library(CosmoTool ${CosmoTool_SRCS})
target_link_libraries(CosmoTool ${NETCDF_LIBRARY} ${NETCDFCPP_LIBRARY} ${GSL_LIBRARY} ${GSLCBLAS_LIBRARY})
set(CosmoTool_LIBS ${NETCDF_LIBRARY} ${NETCDFCPP_LIBRARY} ${GSL_LIBRARY} ${GSLCBLAS_LIBRARY})
if (HDF5_FOUND)
set(CosmoTool_LIBS ${CosmoTool_LIBS} ${HDF5_CXX_LIBRARIES} ${HDF5_LIBRARIES})
include_directories(${HDF5_INCLUDE_DIRS})
endif (HDF5_FOUND)
target_link_libraries(CosmoTool ${CosmoTool_LIBS})
install(TARGETS CosmoTool install(TARGETS CosmoTool
LIBRARY DESTINATION lib LIBRARY DESTINATION lib

440
src/h5_readFlash.cpp Normal file
View File

@ -0,0 +1,440 @@
/* This file contains the functions that read the data from the HDF5 file
* The functions accept the PARAMESH data through arguments.
*/
#include "h5_readFlash.hpp"
using namespace H5;
/* indices of attributes in fof_particle_type */
int iptag_out = 0;
int ipx_out = 0;
int ipy_out = 1;
int ipz_out = 2;
int ipvx_out = 3;
int ipvy_out = 4;
int ipvz_out = 5;
/* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx */
/* n*_runtime_parameters should be set by the caller to
the maximum number of runtime parameters to read.
*/
void h5_read_runtime_parameters
(H5File* file, /* file handle */
double* LBox, // box size
int* numPart) // number of particles
{
int MAX_PARM = 200;
int nreal_runtime_parameters, nint_runtime_parameters, nstr_runtime_parameters;
char real_runtime_parameter_names[MAX_PARM][RUNTIME_PARAMETER_STRING_SIZE];
char int_runtime_parameter_names[MAX_PARM][RUNTIME_PARAMETER_STRING_SIZE];
char str_runtime_parameter_names[MAX_PARM][RUNTIME_PARAMETER_STRING_SIZE];
double real_runtime_parameter_values[MAX_PARM];
int int_runtime_parameter_values[MAX_PARM];
char str_runtime_parameter_values[MAX_PARM][RUNTIME_PARAMETER_STRING_SIZE];
int rank;
hsize_t dimens_1d, maxdimens_1d;
real_runtime_params_t *real_rt_parms;
int_runtime_params_t *int_rt_parms;
str_runtime_params_t *str_rt_parms;
log_runtime_params_t *log_rt_parms;
int i;
nint_runtime_parameters = MAX_PARM;
nreal_runtime_parameters = MAX_PARM;
/* integer runtime parameters */
int_rt_parms = (int_runtime_params_t *) malloc(nint_runtime_parameters * sizeof(int_runtime_params_t));
rank = 1;
DataSet dataset = file->openDataSet("integer runtime parameters");
IntType int_rt_type = dataset.getIntType();
//int_rt_type = H5Dget_type(dataset);
DataSpace dataspace = dataset.getSpace();
//dataspace = H5Dget_space(dataset);
int ndims = dataspace.getSimpleExtentDims(&dimens_1d, NULL);
//H5Sget_simple_extent_dims(dataspace, &dimens_1d, &maxdimens_1d);
/* don't read in more than we can handle */
if (nint_runtime_parameters < dimens_1d) {
dimens_1d = nint_runtime_parameters;
} else {
nint_runtime_parameters = dimens_1d;
}
DataSpace memspace(rank, &dimens_1d);
//memspace = H5Screate_simple(rank, &dimens_1d, NULL);
dataset.read(int_rt_parms, int_rt_type, memspace, dataspace,
H5P_DEFAULT);
//status = H5Dread(dataset, int_rt_type, memspace, dataspace,
// H5P_DEFAULT, int_rt_parms);
for (i = 0; i < nint_runtime_parameters; i++) {
strncpy(int_runtime_parameter_names[i], int_rt_parms[i].name, RUNTIME_PARAMETER_STRING_SIZE);
int_runtime_parameter_values[i] = int_rt_parms[i].value;
}
free(int_rt_parms);
memspace.close();
dataspace.close();
dataset.close();
//H5Sclose(dataspace);
//H5Dclose(dataset);
/* done with int runtime parameters */
/* reals */
real_rt_parms = (real_runtime_params_t *) malloc(nreal_runtime_parameters * sizeof(real_runtime_params_t));
rank = 1;
dataset = file->openDataSet("real runtime parameters");
//dataset = H5Dopen(*file_identifier, "real runtime parameters");
dataspace = dataset.getSpace();
FloatType real_rt_type = dataset.getFloatType();
ndims = dataspace.getSimpleExtentDims(&dimens_1d, NULL);
//dataspace = H5Dget_space(dataset);
//real_rt_type = H5Dget_type(dataset);
//H5Sget_simple_extent_dims(dataspace, &dimens_1d, &maxdimens_1d);
/* don't read in more than we can handle */
if (nreal_runtime_parameters < dimens_1d) {
dimens_1d = nreal_runtime_parameters;
} else {
nreal_runtime_parameters = dimens_1d;
}
memspace = DataSpace(rank, &dimens_1d);
//memspace = H5Screate_simple(rank, &dimens_1d, NULL);
dataset.read(real_rt_parms, real_rt_type, memspace, dataspace,
H5P_DEFAULT);
//status = H5Dread(dataset, real_rt_type, memspace, dataspace,
// H5P_DEFAULT, real_rt_parms);
for (i = 0; i < nreal_runtime_parameters; i++) {
strncpy(real_runtime_parameter_names[i], real_rt_parms[i].name, RUNTIME_PARAMETER_STRING_SIZE);
real_runtime_parameter_values[i] = real_rt_parms[i].value;
}
free(real_rt_parms);
memspace.close();
dataspace.close();
dataset.close();
//H5Sclose(dataspace);
//H5Dclose(dataset);
/* done with reals */
// grab the data we want
for (i = 0; i < nreal_runtime_parameters; i++) {
if (strncmp(real_runtime_parameter_names[i],"xmax",4) == 0 ) {
*LBox = real_runtime_parameter_values[i];
}
}
for (i = 0; i < nint_runtime_parameters; i++) {
if (strncmp(int_runtime_parameter_names[i],"pt_numx",7) == 0 ) {
*numPart = int_runtime_parameter_values[i];
*numPart = *numPart * *numPart * *numPart;
}
}
}
/* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
void h5_read_flash3_particles (H5File* file,
int* totalparticles,
int* localnp,
int* particle_offset,
float pos1[],
float pos2[],
float pos3[],
float vel1[],
float vel2[],
float vel3[],
int id[])
{
herr_t status;
hsize_t dimens_1d, maxdims_1d;
hsize_t start_1d, stride_1d, count_1d;
int rank;
int numProps, i, p;
int numPartBuffer = 5000, sizePartBuffer, sizePart;
int pstack, poffset, pcount;
int iptag, ipx, ipy, ipz, ipvx, ipvy, ipvz;
char *propName;
double *partBuffer;
char part_names[50][OUTPUT_PROP_LENGTH];
int string_size;
// char part_names[NPART_PROPS][OUTPUT_PROP_LENGTH];
hsize_t dimens_2d[2], maxdimens_2d[2];
hsize_t start_2d[2], count_2d[2], stride_2d[2];
/* skip this routine if no particles to read */
if ((*localnp) == 0) {
return;
}
/* first determine how many particle properties are
present in the input data file, and determine which of these
are the properties we are interested in */
DataSet dataset = file->openDataSet("particle names");
DataSpace dataspace = dataset.getSpace();
//dataset = H5Dopen(*file_identifier, "particle names");
//dataspace = H5Dget_space(dataset);
int ndims = dataspace.getSimpleExtentDims(dimens_2d, NULL);
//H5Sget_simple_extent_dims(dataspace, dimens_2d, maxdimens_2d);
//total number of particle properties
numProps = dimens_2d[0];
string_size = OUTPUT_PROP_LENGTH;
StrType string_type = H5Tcopy(H5T_C_S1);
string_type.setSize(string_size);
//status = H5Tset_size(string_type, string_size);
rank = 2;
start_2d[0] = 0;
start_2d[1] = 0;
stride_2d[0] = 1;
stride_2d[1] = 1;
count_2d[0] = dimens_2d[0];
count_2d[1] = dimens_2d[1];
dataspace.selectHyperslab(H5S_SELECT_SET, count_2d, start_2d);
//status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start_2d,
// stride_2d, count_2d, NULL);
DataSpace memspace(rank, dimens_2d);
//memspace = H5Screate_simple(rank, dimens_2d, NULL);
dataset.read(part_names, string_type, H5S_ALL, H5S_ALL, H5P_DEFAULT);
//status = H5Dread(dataset, string_type, H5S_ALL, H5S_ALL,
// H5P_DEFAULT, part_names);
string_type.close();
memspace.close();
dataspace.close();
dataset.close();
//H5Tclose(string_type);
//H5Sclose(memspace);
//H5Sclose(dataspace);
//H5Dclose(dataset);
for (i=0;i<numProps;i++) {
if (strncmp(part_names[i], "tag", 3) == 0) { iptag = i+1; }
if (strncmp(part_names[i], "posx", 4) == 0) { ipx = i+1; }
if (strncmp(part_names[i], "posy", 4) == 0) { ipy = i+1; }
if (strncmp(part_names[i], "posz", 4) == 0) { ipz = i+1; }
if (strncmp(part_names[i], "velx", 4) == 0) { ipvx = i+1; }
if (strncmp(part_names[i], "vely", 4) == 0) { ipvy = i+1; }
if (strncmp(part_names[i], "velz", 4) == 0) { ipvz = i+1; }
}
if ((iptag < 0) || (ipx < 0) || (ipy < 0) || (ipz < 0) || (ipvx < 0) ||
(ipvy < 0) || (ipvz < 0) ) {
printf("One or more required particle attributes not found in file!\n");
return;
}
//printf("iptag = %d, ipx = %d, ipy = %d, ipz = %d\n", iptag, ipx, ipy, ipz);
//printf("ipvx = %d, ipvy = %d, ipvz = %d\n", ipvx, ipvy, ipvz);
//read particles
dataset = file->openDataSet("tracer particles");
//dataset = H5Dopen(*file_identifier, "tracer particles");
FloatType datatype = dataset.getFloatType();
//datatype = H5Dget_type(dataset);
/* establish read-in particle buffer */
sizePart = numProps*(sizeof(double));
sizePartBuffer = numPartBuffer * sizePart;
partBuffer = (double *)malloc(sizePartBuffer);
dataspace = dataset.getSpace();
ndims = dataspace.getSimpleExtentDims(dimens_2d, NULL);
//dataspace = H5Dget_space(dataset);
//H5Sget_simple_extent_dims(dataspace, dimens_2d, maxdimens_2d);
/*insert particle properties (numPartBuffer) particles at a time*/
pstack = (*localnp);
poffset = 0;
if (pstack > numPartBuffer) {
pcount = numPartBuffer;
}
else {
pcount = pstack;
}
while ( pstack > 0) {
rank = 2;
maxdimens_2d[0] = (hsize_t) (*totalparticles);
maxdimens_2d[1] = (hsize_t) (numProps);
start_2d[0] = (hsize_t) (*particle_offset + poffset);
start_2d[1] = (hsize_t) 0;
stride_2d[0] = 1;
stride_2d[1] = 1;
count_2d[0] = (hsize_t) (pcount);
count_2d[1] = (hsize_t) (numProps);
dimens_2d[0] = (pcount);
dimens_2d[1] = (numProps);
dataspace.selectHyperslab(H5S_SELECT_SET, count_2d, start_2d);
//status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start_2d,
// stride_2d, count_2d, NULL);
memspace = DataSpace(rank, dimens_2d);
//memspace = H5Screate_simple(rank, dimens_2d, maxdimens_2d);
/* read data from the dataset */
dataset.read(partBuffer, datatype, memspace, dataspace, H5P_DEFAULT);
//status = H5Dread(dataset, datatype, memspace, dataspace, H5P_DEFAULT, partBuffer);
/* convert buffer into particle struct */
for(p=0; p < (pcount); p++) {
id[p+poffset] = (int) *(partBuffer+iptag-1+p*numProps);
pos1[p+poffset] = (float) *(partBuffer+ipx-1+p*numProps);
pos2[p+poffset] = (float) *(partBuffer+ipy-1+p*numProps);
pos3[p+poffset] = (float) *(partBuffer+ipz-1+p*numProps);
vel1[p+poffset] = (float) *(partBuffer+ipvx-1+p*numProps);
vel2[p+poffset] = (float) *(partBuffer+ipvy-1+p*numProps);
vel3[p+poffset] = (float) *(partBuffer+ipvz-1+p*numProps);
}
memspace.close();
//status = H5Sclose(memspace);
/* advance buffer */
pstack = pstack - pcount;
poffset = poffset + pcount;
if (pstack > numPartBuffer) {
pcount = numPartBuffer;
}
else {
pcount = pstack;
}
} /* end while */
datatype.close();
dataspace.close();
dataset.close();
//status = H5Tclose(datatype);
//status = H5Sclose(dataspace);
//status = H5Dclose(dataset);
}
/*xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
void h5_read_flash3_header_info(H5File* file,
double* time) /* simulation time */
{
herr_t status;
int file_version;
hid_t sp_type, si_type;
hsize_t dimens_1d, maxdimens_1d;
hid_t string_type;
real_list_t *real_list;
int* num_real, num_int;
int MAX_SCALARS = 100;
char real_names[MAX_SCALARS][MAX_STRING_LENGTH];
double real_values[MAX_SCALARS];
char int_names[MAX_SCALARS][MAX_STRING_LENGTH];
int int_values[MAX_SCALARS];
int i;
H5std_string DATASET_NAME;
string_type = H5Tcopy(H5T_C_S1);
H5Tset_size(string_type, MAX_STRING_LENGTH);
DataSet dataset = file->openDataSet("real scalars");
DataSpace dataspace = dataset.getSpace();
/* read extent of 'dataspace' (i.e. # of name/value pairs) into 'dimens_1d' */
int ndims = dataspace.getSimpleExtentDims(&dimens_1d, NULL);
if (dimens_1d > MAX_SCALARS) {
printf("Error: reading more than MAX_SCALARS runtime parameters in checkpoint file!\n");
}
/* malloc a pointer to a list of real_list_t's */
real_list = (real_list_t *) malloc(dimens_1d * sizeof(real_list_t));
// create a new simple dataspace of 1 dimension and size of 'dimens_1d'
DataSpace memspace(1, &dimens_1d);
// create an empty vessel sized to hold one real_list_t's worth of data
CompType real_list_type( sizeof(real_list_t) );
// subdivide the empty vessel into its component sections (name and value)
real_list_type.insertMember(
"name",
HOFFSET(real_list_t, name),
string_type);
real_list_type.insertMember(
"value",
HOFFSET(real_list_t, value),
PredType::NATIVE_DOUBLE);
// read the data into 'real_list'
dataset.read( real_list, real_list_type, memspace, dataspace,
H5P_DEFAULT);
if (status < 0) {
printf("Error readingruntime parameterss from data file\n");
}
for (i = 0; i < dimens_1d; i++) {
strncpy(real_names[i], real_list[i].name, MAX_STRING_LENGTH);
real_values[i] = real_list[i].value;
if (strncmp(real_names[i],"time",4) == 0 ) {
*time = real_values[i];
}
}
free(real_list);
real_list_type.close();
memspace.close();
dataspace.close();
dataset.close();
}

32
src/h5_readFlash.hpp Normal file
View File

@ -0,0 +1,32 @@
/* This file contains the functions that read the data from the HDF5 file
* The functions accept the PARAMESH data through arguments.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include "hdf5_flash.h"
#include "H5Cpp.h"
using namespace H5;
void h5_read_runtime_parameters
(H5File* file, /* file handle */
double* LBox,
int* numPart);
void h5_read_flash3_particles (H5File* file,
int* totalparticles,
int* localnp,
int* particle_offset,
float pos1[],
float pos2[],
float pos3[],
float vel1[],
float vel2[],
float vel3[],
int id[]);
void h5_read_flash3_header_info(H5File* file,
double* time); /* simulation time */

192
src/hdf5_flash.h Normal file
View File

@ -0,0 +1,192 @@
/* general header file for the HDF 5 IO in FLASH */
#ifndef _HDF5_FLASH_H
#define _HDF5_FLASH_H
/* pull in some basic FLASH information */
//#include "flash_defines.fh"
/* define an integer file format version number, that is stored
in the output files. This way, people can check this number
before reading, and compare against a published format to know
what is stored in the file. In theory, this number should be
incremented anytime a change is made to the file format */
/* File format history:
1 -- original version
2 -- added build records:
"FLASH build date"
"FLASH build directory"
"FLASH build machine"
"FLASH setup call"
added the "file format version" record
3 -- added the "run comment record" (why was this
not done long ago?)
4 -- added extrema attributes to the variable records
5 -- redshift included
6 -- added the Module data to the attributes of "/"
7 -- make build info attributes on "/"
*/
#define FILE_FORMAT_VERSION 7
#define RUNTIME_PARAMETER_STRING_SIZE 80
#define TIMER_NAME_STRING_SIZE 30
#define MAX_STRING_LENGTH 80
#define LIST_STRING_SIZE 80
#define OUTPUT_PROP_LENGTH 24
typedef struct real_list_t {
char name[LIST_STRING_SIZE];
double value;
} real_list_t;
typedef struct int_runtime_params_t {
char name[RUNTIME_PARAMETER_STRING_SIZE];
int value;
} int_runtime_params_t;
typedef struct real_runtime_params_t {
char name[RUNTIME_PARAMETER_STRING_SIZE];
double value;
} real_runtime_params_t;
typedef struct str_runtime_params_t {
char value[RUNTIME_PARAMETER_STRING_SIZE];
char name[RUNTIME_PARAMETER_STRING_SIZE];
} str_runtime_params_t;
typedef struct log_runtime_params_t {
int value;
char name[RUNTIME_PARAMETER_STRING_SIZE];
} log_runtime_params_t;
#define MAX_TIMER_PARENTS 20
#define MAX_TIMER_CALL_STACK_DEPTH 20
typedef struct timer_data_t {
char name[TIMER_NAME_STRING_SIZE];
double t_value[MAX_TIMER_PARENTS];
int t_counts[MAX_TIMER_PARENTS];
int t_on[MAX_TIMER_PARENTS];
int t_stacks[MAX_TIMER_PARENTS][MAX_TIMER_CALL_STACK_DEPTH];
int t_num_parents;
int t_stack_sizes[MAX_TIMER_PARENTS];
} full_timer_data_t;
typedef struct sim_params_t {
int total_blocks;
int nsteps;
int nxb;
int nyb;
int nzb;
double time;
double timestep;
double redshift;
} sim_params_t;
typedef struct sim_params_sp_t {
int total_blocks;
int nsteps;
int nxb;
int nyb;
int nzb;
float time;
float timestep;
float redshift;
} sim_params_sp_t;
typedef struct sim_info_t {
int file_format_version;
char setup_call[400];
char file_creation_time[MAX_STRING_LENGTH];
char flash_version[MAX_STRING_LENGTH];
char build_date[MAX_STRING_LENGTH];
char build_dir[MAX_STRING_LENGTH];
char build_machine[MAX_STRING_LENGTH];
char cflags[400];
char fflags[400];
char setup_time_stamp[MAX_STRING_LENGTH];
char build_time_stamp[MAX_STRING_LENGTH];
} sim_info_t;
/* define some particle property constants */
#if FLASH_NUMBER_OF_INT_PARTICLE_PROPS > 0
#define NUMINTPROPS 2*((FLASH_NUMBER_OF_INT_PARTICLE_PROPS+1)/2)
#else
#define NUMINTPROPS 2
#endif
#if FLASH_NUMBER_OF_REAL_PARTICLE_PROPS > 0
#define NUMREALPROPS FLASH_NUMBER_OF_REAL_PARTICLE_PROPS
#else
#define NUMREALPROPS 1
#endif
#define NUMACTUALINTPROPS FLASH_NUMBER_OF_INT_PARTICLE_PROPS
#define NUMACTUALREALPROPS FLASH_NUMBER_OF_REAL_PARTICLE_PROPS
/* set the dimension and grid variables -- the variable N_DIM is set
in the compile line */
/* mdim is the maximum dimension -- this is set in tree.fh */
#define MDIM 3
#define MGID 15
/* 3-d problem */
#if N_DIM == 3
#define NDIM 3
#define NGID 15
#define k2d 1
#define k3d 1
/* 2-d problem */
#elif N_DIM == 2
#define NDIM 2
#define NGID 9
#define k2d 1
#define k3d 0
/* 1-d problem */
#else
#define NDIM 1
#define NGID 5
#define k2d 0
#define k3d 0
#endif
#endif

86
src/loadFlash.cpp Normal file
View File

@ -0,0 +1,86 @@
/* Reads in FLASH v3 files in HDF5 format */
#include <iostream>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include "load_data.hpp"
#include "loadFlash.hpp"
#include "h5_readFlash.hpp"
#include "H5Cpp.h"
using namespace CosmoTool;
using namespace std;
using namespace H5;
SimuData *CosmoTool::loadFlashMulti(const char *fname, int id, int loadflags)
{
SimuData *data;
int p, n;
H5File *fileID;
H5std_string filename;
//char filename[81];
double lbox, time;
int npart;
const double kpc2cm = 3.08568025e21;
const double km2cm = 1.e5;
data = new SimuData;
if (data == 0) {
return 0;
}
filename = fname;
H5File file (filename, H5F_ACC_RDONLY);
// simulation info
h5_read_flash3_header_info(&file, &time);
data->time = time;
h5_read_runtime_parameters(&file, &lbox, &npart);
data->NumPart = npart;
data->BoxSize = lbox/kpc2cm;
// particle data
for (int i = 0; i < 3; i++) {
data->Pos[i] = new float[data->NumPart];
if (data->Pos[i] == 0) {
delete data;
return 0;
}
}
for (int i = 0; i < 3; i++) {
data->Vel[i] = new float[data->NumPart];
if (data->Vel[i] == 0) {
delete data;
return 0;
}
}
data->Id = new int[data->NumPart];
if (data->Id == 0) {
delete data;
return 0;
}
int offset = 0;
h5_read_flash3_particles(&file, &npart, &npart, &offset,
data->Pos[0], data->Pos[1], data->Pos[2],
data->Vel[0], data->Vel[1], data->Vel[2],
data->Id);
for (int i = 0; i < 3; i++) {
for (int n = 0; i < data->NumPart; i++) {
data->Pos[n][i] = data->Pos[n][i] / kpc2cm;
data->Vel[n][i] = data->Vel[n][i] / km2cm;
}
}
file.close();
return data;
}

13
src/loadFlash.hpp Normal file
View File

@ -0,0 +1,13 @@
#ifndef __COSMO_LOAD_FLASH_HPP
#define __COSMO_LOAD_FLASH_HPP
#include "load_data.hpp"
#include "loadSimu.hpp"
namespace CosmoTool {
SimuData *loadFlashMulti(const char *fname, int id, int flags);
};
#endif