yanera_main.c

Go to the documentation of this file.
00001 /*============================================================================
00002 Copyright 2006 Thad Harroun, Kevin Yager
00003 
00004 This file is part of "yanera 2.0".
00005 
00006 "yanera 2.0" is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
00007 
00008 "yanera 2.0" is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
00009 
00010 You should have received a copy of the GNU General Public License along with "yanera 2.0"; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 
00011 ============================================================================*/ 
00012 /*============================================================================*/
00018 #include "yanera.h"
00019 #include "yanera_util.h"
00020 #include "yanera_xml_input.h"
00021 #include "yanera_model_build.h"
00022 #include "yanera_profile.h"
00023 #include "yanera_quadrature.h"
00024 #include "yanera_data.h"
00025 #include "yanera_lstsq.h"
00026 #include "yanera_lstsq_constrained.h"
00027 #include "yanera_mdmin.h"
00028 #include "yanera_mdmin_simplex.h"
00029 #include "yanera_siman.h"
00030 #include "yanera_ool.h"
00031 #include "yanera_levmar.h"
00032 #include "yanera_reflectivity.h"
00033 #include "yanera_xml_output.h"
00034 /*============================================================================*/
00041 int main(int argc, char **argv) 
00042 { 
00043   yanera_container *yanera;
00044   /*---------------------------------
00045    * Program requires a filename of the XML file.
00046    */
00047   if (argc != 2) 
00048   {
00049     yanera_error("No XML inpout file specified.", __FILE__, __LINE__, NULL);
00050   }
00051   /*---------------------------------
00052    * Allocate a new yanera_container
00053    */
00054   yanera = yanera_initialize(argv[1]);
00055   /*---------------------------------
00056    *  Parse the XML file
00057    */
00058   yanera_read_xml(yanera);
00059   /*---------------------------------
00060    * Form the complete models from the XML models in memory
00061    */
00062   yanera_complete_models(yanera);
00063   /*---------------------------------
00064    * Read resolution
00065    */
00066   yanera_read_resolution(yanera);
00067   /*---------------------------------
00068    * Load the data
00069    */
00070   if (yanera->misc.fit_do == YES) 
00071   {
00072     yanera_load_data(yanera);
00073     
00074     if ((yanera->misc.fit_method == CONJUGATE_FR) || \
00075         (yanera->misc.fit_method == CONJUGATE_PR) || \
00076         (yanera->misc.fit_method == VECTOR_BFGS) || \
00077         (yanera->misc.fit_method == STEEP_DESC))
00078     { yanera_mdmin_main(yanera); }
00079     if (yanera->misc.fit_method == NMSIMPLEX)
00080     { yanera_mdmin_simplex_main(yanera); }
00081     if (yanera->misc.fit_method == SIMAN)
00082     { yanera_siman_main(yanera); }
00083 #ifdef HAVE_OOL
00084     if ((yanera->misc.fit_method == OOL_SPG) || \
00085         (yanera->misc.fit_method == OOL_GENCAN))
00086     { yanera_ool_main(yanera); }
00087 #endif
00088     if ((yanera->misc.fit_method == LMSDR) || \
00089         (yanera->misc.fit_method == LMDR))
00090     { yanera_lstsq_main(yanera); }
00091     if ((yanera->misc.fit_method == CLMSDR) || \
00092         (yanera->misc.fit_method == CLMDR))
00093     { yanera_lstsq_constrained_main(yanera); }
00094 #ifdef HAVE_LEVMAR
00095     if (yanera->misc.fit_method == LEVMAR)
00096     { yanera_levmar_main(yanera); }
00097 #endif
00098   }
00099   else
00100   {
00101     /*---------------------------------
00102      * Report results
00103      */
00104     yanera_report(yanera, -1, NULL);
00105   }
00106   
00107   /*---------------------------------
00108    * Free the memory
00109    */
00110   yanera_free(yanera);
00111   
00112   return(EXIT_SUCCESS);
00113 }
00114 

Generated on Thu May 29 10:56:33 2008 by  doxygen 1.5.5