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 
00033 namespace Optika{
00034 
00035 
00036 void RUN_BASIC_OPTIKA_TESTS(){
00037 
00038   using Teuchos::FancyOStream;
00039   using Teuchos::VerboseObjectBase;
00040   using Teuchos::StringToIntegralParameterEntryValidator;
00041   using Teuchos::tuple;
00042   using Teuchos::rcp;
00043 
00044   RCP<FancyOStream> out = VerboseObjectBase::getDefaultOStream();
00045 
00046   //Basic Test
00047   RCP<ParameterList> My_List = RCP<ParameterList>(new ParameterList);
00048 
00049   double *pointer = 0;
00050   My_List->set("Double pointer", pointer);
00051   My_List->set("Max Iters", 1550, "Determines the maximum number of iterations in the solver");
00052   My_List->set("Tolerance", 1e-10, "The tolerance used for the convergence check");
00053   
00054   RCP<StringToIntegralParameterEntryValidator<int> >
00055     solverValidator = rcp(
00056       new StringToIntegralParameterEntryValidator<int>(
00057         tuple<std::string>( "GMRES", "CG", "TFQMR" )
00058         ,"Solver"
00059         )
00060       );
00061   My_List->set(
00062     "Solver"
00063     ,"GMRES" // This will be validated by solverValidator right here!
00064     ,"The type of solver to use."
00065     ,solverValidator
00066     );
00067 
00068    RCP<EnhancedNumberValidator<int> > awesomenessValidator = 
00069    RCP<EnhancedNumberValidator<int> >(new EnhancedNumberValidator<int>(0,10));
00070     My_List->set("Awesomeness", 5, "Rate the awesomeness!!!", awesomenessValidator);
00071 
00072   Array<double> testArray( 10, 0.0 );
00073   
00074   My_List->set("Initial Guess", testArray, "The initial guess as a RCP to an array object.");
00075 
00076   ParameterList&
00077     Prec_List = My_List->sublist("Preconditioner",false,"Sublist that defines the preconditioner.");
00078 
00079   Prec_List.set("Type", "ILU", "The tpye of preconditioner to use");
00080   Prec_List.set("Drop Tolerance", 1e-3
00081                 ,"The tolerance below which entries from the\n""factorization are left out of the factors.");
00082 
00083   getInput(My_List);
00084 
00085   writeParameterListToXmlOStream(*My_List, *out);
00086 
00087 
00088 }
00089 
00090 
00091 }
00092 
00093 int main(){
00094   Optika::RUN_BASIC_OPTIKA_TESTS();
00095   return 0;
00096 }
00097 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Defines