tests/lbpm_uCT_pp is setup to read recon.volume netcdf files from ARgonne

This commit is contained in:
James E McClure
2016-03-17 16:48:26 -04:00
parent 6798eb5eae
commit 593e1fb9b5
2 changed files with 31 additions and 4 deletions

View File

@@ -4,6 +4,7 @@ ADD_LBPM_EXECUTABLE( lbpm_color_simulator )
ADD_LBPM_EXECUTABLE( lbpm_sphere_pp )
ADD_LBPM_EXECUTABLE( lbpm_random_pp )
ADD_LBPM_EXECUTABLE( lbpm_segmented_pp )
ADD_LBPM_EXECUTABLE( lbpm_uCT_pp )
ADD_LBPM_EXECUTABLE( lbpm_segmented_decomp )
ADD_LBPM_EXECUTABLE( lbpm_disc_pp )
ADD_LBPM_EXECUTABLE( lbpm_captube_pp )

View File

@@ -41,15 +41,41 @@ int main(int argc, char **argv)
{
PROFILE_START("Main");
std::vector<std::string> filenames;
//std::vector<std::string> filenames;
std::string filename;
if ( argc==0 ) {
printf("At least one filename must be specified\n");
return 1;
}
else {
filename=std::string(argv[1]);
printf("Reading file: %s\n",filename.c_str());
}
for (int i=1; i<argc; i++)
load( argv[i] );
int fid = netcdf::open(filename);
// Read all of the attributes
std::vector<std::string> attr = netcdf::getAttNames( fid );
for (size_t i=0; i<attr.size(); i++) {
printf("Reading attribute %s\n",attr[i].c_str());
netcdf::VariableType type = netcdf::getAttType( fid, attr[i] );
if ( type == netcdf::STRING ){
Array<std::string> tmp = netcdf::getAtt<std::string>( fid, attr[i] );
}
else{
//Array<double> tmp = netcdf::getAtt<double>( fid, attr[i] );
}
}
// Read the data array
std::string varname("VOLUME");
printf("Reading %s\n",varname.c_str());
Array<float> VOLUME = netcdf::getVar<float>( fid, varname);
//printf("VOLUME size = %zu \n",VOLUME.length());
printf("VOLUME dims = %zu x %zu x %zu \n",VOLUME.size(0),VOLUME.size(1),VOLUME.size(2));
printf("Sucess!! \n");
netcdf::close( fid );
PROFILE_SAVE("TestNetcdf");
return 0;