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 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Kurtis Nusbaum (klnusbaum@gmail.com) 
00038 // 
00039 // ***********************************************************************
00040 // @HEADER
00041 #include "Optika_GUI.hpp"
00042 #include "Teuchos_XMLParameterListHelpers.hpp"
00043 #include "Teuchos_VerboseObject.hpp"
00044 #include "Teuchos_FancyOStream.hpp"
00045 
00046 namespace Optika{
00047 
00048 
00049 void RUN_BASIC_OPTIKA_TESTS(){
00050 
00051   using Teuchos::FancyOStream;
00052   using Teuchos::VerboseObjectBase;
00053   using Teuchos::StringToIntegralParameterEntryValidator;
00054   using Teuchos::tuple;
00055   using Teuchos::rcp;
00056 
00057   RCP<FancyOStream> out = VerboseObjectBase::getDefaultOStream();
00058 
00059   //Basic Test
00060   RCP<ParameterList> My_List = RCP<ParameterList>(new ParameterList);
00061 
00062   double *pointer = 0;
00063   My_List->set("Double pointer", pointer);
00064   My_List->set("Max Iters", 1550, "Determines the maximum number of iterations in the solver");
00065   My_List->set("Tolerance", 1e-10, "The tolerance used for the convergence check");
00066   
00067   RCP<StringToIntegralParameterEntryValidator<int> >
00068     solverValidator = rcp(
00069       new StringToIntegralParameterEntryValidator<int>(
00070         tuple<std::string>( "GMRES", "CG", "TFQMR" )
00071         ,"Solver"
00072         )
00073       );
00074   My_List->set(
00075     "Solver"
00076     ,"GMRES" // This will be validated by solverValidator right here!
00077     ,"The type of solver to use."
00078     ,solverValidator
00079     );
00080 
00081    RCP<EnhancedNumberValidator<int> > awesomenessValidator = 
00082    RCP<EnhancedNumberValidator<int> >(new EnhancedNumberValidator<int>(0,10));
00083     My_List->set("Awesomeness", 5, "Rate the awesomeness!!!", awesomenessValidator);
00084 
00085   Array<double> testArray( 10, 0.0 );
00086   
00087   My_List->set("Initial Guess", testArray, "The initial guess as a RCP to an array object.");
00088 
00089   ParameterList&
00090     Prec_List = My_List->sublist("Preconditioner",false,"Sublist that defines the preconditioner.");
00091 
00092   Prec_List.set("Type", "ILU", "The tpye of preconditioner to use");
00093   Prec_List.set("Drop Tolerance", 1e-3
00094                 ,"The tolerance below which entries from the\n""factorization are left out of the factors.");
00095 
00096   getInput(My_List);
00097 
00098   writeParameterListToXmlOStream(*My_List, *out);
00099 
00100 
00101 }
00102 
00103 
00104 }
00105 
00106 int main(){
00107   Optika::RUN_BASIC_OPTIKA_TESTS();
00108   return 0;
00109 }
00110 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Defines