Optika GUI Toolik Version of the Day
test/gui/basic/main.cpp
Go to the documentation of this file.
00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 //         Optika: A Tool For Developing Parameter Obtaining GUIs
00005 //                Copyright (2009) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, with Sandia Corporation, the 
00008 // U.S. Government retains certain rights in this software.
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 Kurtis Nusbaum (klnusbaum@gmail.com) 
00025 // 
00026 // ***********************************************************************
00027 // @HEADER
00028 #include "Optika_GUI.hpp"
00029 #include "Teuchos_XMLParameterListHelpers.hpp"
00030 #include "Teuchos_VerboseObject.hpp"
00031 #include "Teuchos_FancyOStream.hpp"
00032 int main(){
00033   Teuchos::RCP<Teuchos::FancyOStream> out = Teuchos::VerboseObjectBase::getDefaultOStream();
00034 
00035   //Basic Test
00036   Teuchos::RCP<Teuchos::ParameterList> My_List = Teuchos::RCP<Teuchos::ParameterList>(new Teuchos::ParameterList);
00037 
00038   double *pointer = 0;
00039   My_List->set("Double pointer", pointer);
00040   My_List->set("Max Iters", 1550, "Determines the maximum number of iterations in the solver");
00041   My_List->set("Tolerance", 1e-10, "The tolerance used for the convergence check");
00042   
00043   Teuchos::RCP<Teuchos::StringToIntegralParameterEntryValidator<int> >
00044     solverValidator = Teuchos::rcp(
00045       new Teuchos::StringToIntegralParameterEntryValidator<int>(
00046         Teuchos::tuple<std::string>( "GMRES", "CG", "TFQMR" )
00047         ,"Solver"
00048         )
00049       );
00050   My_List->set(
00051     "Solver"
00052     ,"GMRES" // This will be validated by solverValidator right here!
00053     ,"The type of solver to use."
00054     ,solverValidator
00055     );
00056 
00057    Teuchos::RCP<Optika::EnhancedNumberValidator<int> > awesomenessValidator = 
00058    Teuchos::RCP<Optika::EnhancedNumberValidator<int> >(new Optika::EnhancedNumberValidator<int>(0,10));
00059     My_List->set("Awesomeness", 5, "Rate the awesomeness!!!", awesomenessValidator);
00060 
00061   Teuchos::Array<double> testArray( 10, 0.0 );
00062   
00063   My_List->set("Initial Guess", testArray, "The initial guess as a RCP to an array object.");
00064 
00065   Teuchos::ParameterList&
00066     Prec_List = My_List->sublist("Preconditioner",false,"Sublist that defines the preconditioner.");
00067 
00068   Prec_List.set("Type", "ILU", "The tpye of preconditioner to use");
00069   Prec_List.set("Drop Tolerance", 1e-3
00070                 ,"The tolerance below which entries from the\n""factorization are left out of the factors.");
00071 
00072   Optika::getInput(My_List);
00073 
00074   Teuchos::writeParameterListToXmlOStream(*My_List, *out);
00075 
00076   return 0;
00077 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends