main( int argc, char *argv[] ) { v5dstruct v; if (argc!=2) { printf("Usage:\n"); printf(" v5dinfo file\n"); exit(0); } if (!v5dOpenFile( argv[1], &v )) { printf("Error: couldn't open %s\n", argv[1] ); exit(0); } v5dPrintStruct( &v ); v5dCloseFile( &v ); exit(0); }
void avtVis5DFileFormat::PopulateDatabaseMetaData(avtDatabaseMetaData *md, int timeState) { Initialize(); // Don't alphabetize the variables in the client menus. md->SetMustAlphabetizeVariables(false); if(v5dfile != 0) { #if 0 // Print the structure of the file. v5dPrintStruct(v5dfile); #endif // // Add the mesh // std::string meshName("grid"); avtMeshType mt; if(v5dfile->Projection == 0 || v5dfile->Projection == 1) mt = AVT_RECTILINEAR_MESH; else mt = AVT_CURVILINEAR_MESH; avtMeshMetaData *mmd = new avtMeshMetaData(meshName, 1, 1, 1, 0, 3, 3, mt); if(v5dfile->Projection == 1) { mmd->xUnits = "degrees"; mmd->yUnits = "degrees"; mmd->xLabel = "W Longitude"; mmd->yLabel = "N Latitude"; } else if(v5dfile->Projection != 0) { mmd->xUnits = "degrees"; mmd->yUnits = "degrees"; mmd->xLabel = "Longitude"; mmd->yLabel = "Latitude"; } mmd->zLabel = "Levels"; if(v5dfile->VerticalSystem == 1 || v5dfile->VerticalSystem == 2) mmd->zUnits = "km"; else if(v5dfile->VerticalSystem == 3) mmd->zUnits = "mb"; md->Add(mmd); // // Add the scalars // for(int i = 0; i < v5dfile->NumVars; ++i) { char varName[10], units[20], *cptr = 0; strcpy(varName, v5dfile->VarName[i]); strcpy(units, v5dfile->Units[i]); for(cptr = varName + 8; cptr >= varName; --cptr) { if(*cptr == ' ') *cptr = '\0'; else break; } for(cptr = units + 18; cptr >= varName; --cptr) { if(*cptr == ' ') *cptr = '\0'; else break; } if(varName[0] != '\0') { avtScalarMetaData *smd = new avtScalarMetaData( varName, meshName, AVT_NODECENT); smd->hasUnits = units[0] != '\0'; if(smd->hasUnits) smd->units = std::string(units); smd->hasDataExtents = true; smd->minDataExtents = v5dfile->MinVal[i]; smd->maxDataExtents = v5dfile->MaxVal[i]; md->Add(smd); } } } }