TARIS-BuildTree.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 <cstdlib>
00026 using namespace std;
00027 
00028 #include <HyperSurface.h>
00029 #include <Surface.h>
00030 #include <TarisApplication.h>
00031 #include <Tree.h>
00032 #include <vector>
00033 
00034 namespace Programs{
00035 
00043 class TARIS_BuildTree{
00044         public:
00045                 static string usage()
00046                 {
00047                         system("clear") ;
00048                         return
00049                         "=============================\n"
00050                         "TARIS-BuildTree (" __DATE__ ")\n"
00051                         "=============================\n"
00052                         "\n"
00053                         "Produces files in GML format containing the information that allows \n"
00054                         "to visualize the corresponding molecule's tree, taking as parameters \n"
00055                         "the .cube file, the initial cutoff, the final cutoff and the step-size\n"
00056                         "for the scan \n"
00057                         "\n"
00058                         "Syntax:\n"
00059                         "   $ TARIS-BuildTree -c file [PARAMETERS]\n"
00060                         "\n"
00061                         "Required parameters:\n"
00062                         "   -c   file\n"
00063                         "           This is the name of the cube file containing the electrostatic\n"
00064                         "           potential data\n"
00065                         "\n"
00066                         "Optional parameters:\n"
00067                         "   -b   cutoffBegin\n"
00068                         "           Initial cutoff for the scan\n"
00069                         "           (default=-0.1)\n"
00070                         "   -e   cutoffEnd\n"
00071                         "           Final cutoff for the scan\n"
00072                         "           (default=-0.07)\n"
00073                         "   -s   stepSize\n"
00074                         "           Step-size for the scan\n"
00075                         "           (default=-0.005)\n"
00076                         "   -o   output\n"
00077                         "           Name of the gml output file\n"
00078                         "           (default=screen)\n"
00079                         "\n"
00080                         "For example:\n"
00081                         "   $ TARIS-BuildTree -c file.cube -o file.gml\n"
00082                         "\n"
00083                         "Authors:\n"
00084                         "   Nestor F. Aguirre, Ray M. Marin and Edgar E. Daza\n"
00085                         "   Universidad Nacional de Colombia\n"
00086                         ;
00087                 }
00088                 
00089                 static int main( int argc, char **argv )
00090                 {
00091                         
00092                         if( argc > 1 ){
00093                                 
00094                                 string cubeFileName = TarisApplication::extractParameter( argc, argv, "-c" ) ;
00095                                 double cutoffBegin = atof( TarisApplication::extractParameter( argc, argv, "-b", "-0.1" ) ) ;
00096                                 double cutoffEnd = atof( TarisApplication::extractParameter( argc, argv, "-e", "-0.07" ) ) ;
00097                                 double stepSize = atof( TarisApplication::extractParameter( argc, argv, "-s", "0.005" ) ) ;
00098                                 string outputFileName = TarisApplication::extractParameter( argc, argv, "-o", "screen" ) ;
00099                                 
00100                                 HyperSurface hs ;
00101                                 hs.load( cubeFileName ) ;
00102                                 
00103                                 Tree output = hs.buildAreaTree( cutoffBegin, cutoffEnd, stepSize ) ;
00104                                 
00105                                 Tree::print( output, cout ) ;
00106                                 
00107                                 if( outputFileName != "screen" ){
00108                                         output.save( outputFileName.c_str() ) ;
00109                                 }else{
00110                                         cout << "---------------" << endl ;
00111                                         cout << "GML FILE" << endl ;
00112                                         cout << "---------------" << endl ;
00113                                         cout << endl ;
00114                                         output.save( &cout ) ;
00115                                 }
00116                                 
00117                         }else{
00118                                 cout << usage() << endl ;
00119                         }
00120 
00121                         return EXIT_SUCCESS;
00122                 }
00123 };
00124 
00125 }
00126 
00127 int main( int argc, char **argv )
00128 {
00129         return Programs::TARIS_BuildTree::main( argc, argv ) ;
00130 }

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