TARIS-BuildIsosurface.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2007 by Universidad Nacional de Colombia                *
00003  *   http://www.unal.edu.co                                                *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifdef HAVE_CONFIG_H
00021 #include <config.h>
00022 #endif
00023 
00024 #include <iostream>
00025 #include <string>
00026 #include <cstdlib>
00027 using namespace std;
00028 
00029 #include <HyperSurface.h>
00030 #include <Surface.h>
00031 #include <TarisApplication.h>
00032 #include <Tree.h>
00033 #include <vector>
00034 
00035 namespace Programs{
00036 
00044 class TARIS_BuildIsosurface{
00045         public:
00046                 static string usage()
00047                 {
00048                         system("clear") ;
00049                         return
00050                         "===================================\n"
00051                         "TARIS-BuildIsosurface (" __DATE__ ")\n"
00052                         "===================================\n"
00053                         "\n"
00054                         "Produces files in OOGL format containing the information that allows \n"
00055                         "to visualize an isopotential surface for a given cutoff, from the .cube\n"
00056                         "file. The OOGL files can be visualized with the \"geomview\" program:\n"
00057                         "(http://www.geom.uiuc.edu/software/geomview/)\n"
00058                         "\n"
00059                         "Syntax:\n"
00060                         "   $ TARIS-BuildIsosurface -c file [PARAMETERS]\n"
00061                         "\n"
00062                         "Required parameters:\n"
00063                         "   -c   file\n"
00064                         "           This is the name of the cube file containing the electrostatic\n"
00065                         "           potential data\n"
00066                         "\n"
00067                         "Optional parameters:\n"
00068                         "   -b   cutoff\n"
00069                         "           Potential value for the surface calculation potential data\n"
00070                         "           (default=-0.07)\n"
00071                         "   -o   output\n"
00072                         "           Name of the oogl output file\n"
00073                         "           (default=screen)\n"
00074                         "\n"
00075                         "For example:\n"
00076                         "   $ TARIS-BuildIsosurface -c file.cube -b -0.1 -o file.oogl\n"
00077                         "   $ geomview -nopanels file.oogl\n"
00078                         "\n"
00079                         "Authors:\n"
00080                         "   Nestor F. Aguirre, Ray M. Marin and Edgar E. Daza\n"
00081                         "   Universidad Nacional de Colombia\n"
00082                         ;
00083                 }
00084                 
00085                 static int main( int argc, char **argv )
00086                 {
00087                         
00088                         if( argc > 1 ){
00089                                 
00090                                 string cubeFileName = TarisApplication::extractParameter( argc, argv, "-c" ) ;
00091                                 double cutoff = atof( TarisApplication::extractParameter( argc, argv, "-b", "-0.07" ) ) ;
00092                                 string outputFileName = TarisApplication::extractParameter( argc, argv, "-o", "screen" ) ;
00093                                 
00094                                 HyperSurface hs ;
00095                                 hs.load( cubeFileName ) ;
00096                                 
00097                                 Surface output = hs.getIsosurface( cutoff ) ;
00098                                 
00099                                 if( outputFileName == "screen" ){
00100                                         output.printOogl( cout ) ;
00101                                 }else{
00102                                         ofstream file( outputFileName.c_str() ) ;
00103                                         output.printOogl( file ) ;
00104                                         file.close() ;
00105                                 }
00106                                 
00107                         }else{
00108                                 cout << usage() << endl ;
00109                         }
00110                         
00111                         return EXIT_SUCCESS;
00112                 }
00113 };
00114 
00115 }
00116 
00117 int main( int argc, char **argv )
00118 {
00119         return Programs::TARIS_BuildIsosurface::main( argc, argv ) ;
00120 }

Generated on Mon May 26 20:29:46 2008 for TARIS by  doxygen 1.5.4