AbstractLinAlgPack_DirectSparseSolverMA28SetOptions.cpp

Go to the documentation of this file.
00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
00005 //                  Copyright (2003) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 // 
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //  
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //  
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 
00025 // 
00026 // ***********************************************************************
00027 // @HEADER
00028 
00029 #include <assert.h>
00030 
00031 #include "AbstractLinAlgPack_DirectSparseSolverMA28SetOptions.hpp"
00032 #include "OptionsFromStreamPack_StringToBool.hpp"
00033 
00034 // Define the options
00035 namespace {
00036 
00037   const int local_num_options = 8;
00038 
00039   enum local_EOptions {
00040     ESTIMATED_FILLIN_RATIO
00041       ,U
00042     ,GROW
00043     ,TOL
00044     ,NSRCH
00045     ,LBIG
00046     ,PRINT_MA28_OUTPUTS
00047     ,OUTPUT_FILE_NAME
00048   };
00049 
00050   const char* local_SOptions[local_num_options] = {
00051     "estimated_fillin_ratio"
00052       ,"u"
00053     ,"grow"
00054     ,"tol"
00055     ,"nsrch"
00056     ,"lbig"
00057     ,"print_ma28_outputs"
00058     ,"output_file_name"
00059   };
00060 
00061 }
00062 
00063 namespace AbstractLinAlgPack {
00064 
00065 DirectSparseSolverMA28SetOptions::DirectSparseSolverMA28SetOptions(
00066       DirectSparseSolverMA28* qp_solver )
00067   : OptionsFromStreamPack::SetOptionsFromStreamNode(
00068         "DirectSparseSolverMA28", local_num_options, local_SOptions )
00069     , OptionsFromStreamPack::SetOptionsToTargetBase<
00070       DirectSparseSolverMA28 >( qp_solver )
00071 {}
00072 
00073 void DirectSparseSolverMA28SetOptions::setOption(
00074   int option_num, const std::string& option_value )
00075 {
00076   using OptionsFromStreamPack::StringToBool;
00077 
00078   switch( (local_EOptions)option_num ) {
00079     case ESTIMATED_FILLIN_RATIO: {
00080       target().estimated_fillin_ratio( ::atof( option_value.c_str() ) );
00081       break;
00082     }
00083     case U: {
00084       target().u( ::atof( option_value.c_str() ) );
00085       break;
00086     }
00087     case GROW: {
00088       target().grow( StringToBool( "grow", option_value.c_str() ) );
00089       break;
00090     }
00091     case TOL: {
00092       target().tol( ::atof( option_value.c_str() ) );
00093       break;
00094     }
00095     case NSRCH: {
00096       target().nsrch( ::atoi( option_value.c_str() ) );
00097       break;
00098     }
00099     case LBIG: {
00100       target().lbig( StringToBool( "lbig", option_value.c_str() ) );
00101       break;
00102     }
00103     case PRINT_MA28_OUTPUTS: {
00104       target().print_ma28_outputs( StringToBool( "grow", option_value.c_str() ) );
00105       break;
00106     }
00107     case OUTPUT_FILE_NAME: {
00108       if( option_value == "NONE" )
00109         target().output_file_name( "" );
00110       else
00111         target().output_file_name( option_value );
00112       break;
00113     }
00114     default:
00115       TEST_FOR_EXCEPT(true);  // Local error only?
00116   }
00117 }
00118 
00119 } // end namespace AbstractLinAlgPack 

Generated on Thu Sep 18 12:35:11 2008 for MOOCHO (Single Doxygen Collection) by doxygen 1.3.9.1