\section{dens-trans.C File Reference}
\label{dens-trans_C}\index{dens-trans.C@{dens-trans.C}}
{\tt \#include $<$fstream.h$>$}\par
{\tt \#include $<$stdlib.h$>$}\par


Include dependency graph for dens-trans.C:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=70pt]{dens-trans_C_incl}
\end{center}
\end{figure}
\subsection*{Functions}
\begin{CompactItemize}
\item 
int {\bf main} (int argc, char $\ast$$\ast$argv)
\end{CompactItemize}


\subsection{Function Documentation}
\index{dens-trans.C@{dens-trans.C}!main@{main}}
\index{main@{main}!dens-trans.C@{dens-trans.C}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int main (int {\em argc}, char $\ast$$\ast$ {\em argv})}\label{dens-trans_C_a0}




Definition at line 4 of file dens-trans.C.\footnotesize\begin{verbatim}00004                                  {
00005 
00006   if (argc != 2) {
00007     cerr << "must supply the filename as arg 1" << endl;
00008     exit (1);
00009   }
00010   
00011   ifstream in(argv[1]);
00012 
00013   if (!in){
00014     cerr << "Unable to open " << argv[1] << endl;
00015     exit (2);
00016   }
00017   
00018   char d[255];
00019   char temp[255];
00020   
00021   int xdim, ydim, zdim;
00022   double minx, miny, minz;
00023   double maxx, maxy, maxz;
00024     
00025   in.getline(d,255); // # AVS
00026   cout << d << endl;
00027   in.getline(d,255); // ndim
00028   cout << d << endl;
00029   //dim1
00030   in.ignore(5);
00031   in >>  xdim;
00032   cout << "xdim= "<< xdim << endl;
00033   //dim2
00034   in.ignore(6); // +\n
00035   in >>  ydim;
00036   cout << "ydim= "<< ydim << endl;
00037   //dim3
00038   in.ignore(6); // +\n
00039   in >>  zdim;
00040   cout << "zdim= "<< zdim << endl;
00041   
00042   cerr << "dim: " << xdim << ", "<< ydim << ", "<< zdim << endl;
00043 
00044   in.getline(d,255); // \n
00045 
00046   in.getline(d,255); // nspace
00047   cout << d << endl;
00048   in.getline(d,255); // vclean
00049   cout << d << endl;
00050   in.getline(d,255); // data
00051   cout << d << endl;
00052   in.getline(d,255); // field
00053   cout << d << endl;
00054   
00055   // mins
00056   in.ignore (9);
00057   in >>  minx >> miny >> minz;
00058   cout << "min_ext= " << minx << " " << miny << " " << minz << endl;
00059   cerr << "min: " <<  minx << ", " << miny << ", " << minz << endl;
00060   
00061   // maxs
00062   in.ignore (10);
00063   in >>  maxx >> maxy >> maxz;
00064   cout << "max_ext= " << maxx << " " << maxy << " " << maxz << endl;
00065   cerr << "max: "  <<  maxx << ", " << maxy << ", " << maxz << endl;
00066 
00067   in.getline(d,255); // nspace
00068 
00069   in.getline(d,255); // # end of header
00070   cout << d << endl;
00071   in.ignore(2); // ^L^L  #!!##! WHATEVER -- drop these;
00072 
00073   float val;
00074   long read = 0;
00075   
00076   for (int zh =0;zh<zdim ;zh++){
00077     for (int yh =0;yh<ydim ;yh++){
00078       for (int xh =0;xh<xdim ;xh++){
00079         in.read(&val,sizeof(float));
00080         if (!in.good()){
00081           cerr << "reading error!\n read "<< read << " entries, expected "<< xdim*ydim*zdim << endl;
00082           exit(3);
00083         }
00084         read++;
00085         cout << val << " ";       
00086       }
00087     }
00088   }
00089 \end{verbatim}\normalsize 
