vtf-logo

FileVisualizer.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 // Copyright (C) 2002 Ralf Deiterding
00004 // Brandenburgische Universitaet Cottbus
00005 //
00006 // Copyright (C) 2003-2007 California Institute of Technology
00007 // Ralf Deiterding, ralf@amroc.net
00008 
00009 #ifndef AMROC_HDFVISUALIZER_H
00010 #define AMROC_HDFVISUALIZER_H
00011 
00019 #include "DAGHParams.h"
00020 #include "HDFToFile/FileVisualGrid.h"
00021                   
00028 class FileVisualizer {
00029 public:
00030   FileVisualizer() {}
00031   
00032   void Show(int step, std::string* solvername, std::string* inputname,
00033             std::string** filenames, int Nfilenames, FileVisualGridBase* gr) {
00034     FileVisualGridBase *Grid = gr;
00035     std::string sname;
00036     if (solvername) sname = *solvername;
00037     else sname = "solver.in";
00038     std::ifstream infile;
00039     infile.open(sname.c_str(), std::ios::in);
00040     if (!infile) {
00041       std::cerr << sname << " not found. Aborting." << std::endl;
00042       std::exit(-1);
00043     } 
00044     infile.close();
00045 
00046     ControlDevice DisplayCtrl(GetFileControlDevice(sname.c_str(),""));
00047     Grid->register_at(DisplayCtrl,"");
00048     DisplayCtrl.update();     
00049     Grid->SetUpdateName(inputname);
00050     Grid->update();  
00051 
00052     if (Grid->SetUp(step,filenames,Nfilenames) < 0) {
00053       std::cerr << "Nothing read in. Aborting." << std::endl;
00054       std::exit(-1);
00055     } 
00056     std::cerr << Grid->Size() << " Grids constructed from all levels."
00057               << std::endl;  
00058 
00059     int *blocks;          
00060     blocks = new int[3*Grid->Size()];
00061     Grid->SetBlocks(blocks);    
00062     
00063     Grid->Write();
00064     
00065     delete [] blocks; 
00066   }
00067 };
00068 
00069 #endif

Generated on Fri Aug 24 13:00:31 2007 for AMROC's HDF Tools - by  doxygen 1.4.7