Optika GUI Toolik Version of the Day
example/CustomGUIExample/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 "Teuchos_ParameterList.hpp"
00029 #include "Teuchos_StandardParameterEntryValidators.hpp"
00030 #include "Teuchos_Array.hpp"  
00031 #include "Teuchos_Version.hpp"
00032 #include "Optika_GUI.hpp"
00033 #include "Teuchos_XMLParameterListHelpers.hpp"
00034 #include "Teuchos_FancyOStream.hpp"
00035 #include "Teuchos_VerboseObject.hpp"
00036 
00037 int main(int argc, char* argv[])
00038 {
00039  /*
00040   * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
00041   * !!!!!!!!!!!!!!!!              ATTENTION              !!!!!!!!!!!!!!!!!!!!!!
00042   * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
00043   * !!!!   PLEASE VIEW THE BASIC EXAMPLE FIRST BEFORE READING THIS       !!!!!!
00044   * !!!!   EXAMPLE. IT PROVIDES FUNDAMENTAL KNOWLEDGE THAT WILL BE VERY  !!!!!! 
00045   * !!!!   HELPFUL IN UNDERSTANDING THIS EXAMPLE.                        !!!!!!
00046   * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
00047   * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
00048   */ 
00049 
00050   /*
00051    * Defautls not good enought for you, eh? Well I guess That's understandable 
00052    * and why we've given you a few ways to customize your GUI as you see fit. 
00053    * The purpose of this example is to demonstrate those capabilities.
00054    */
00055 
00056   /* 
00057    * So let's setup a list of parameters to obtain. They could be anything 
00058    * really. We'll just reuse the list we created in the Basic Example 
00059    * (which you've read already because you're smart and headed the gigantic
00060    * warning I put at the top of this example.
00061    */
00062   using Teuchos::RCP;
00063   using Teuchos::ParameterList;
00064   using Teuchos::StringValidator;
00065   using Teuchos::tuple;
00066   using Teuchos::Array;
00067   using Teuchos::rcp;
00068   RCP<ParameterList> My_List = rcp(new ParameterList);
00069 
00070   My_List->set(
00071     "Max Iters", 
00072     1550, 
00073     "Determines the maximum number of iterations in the solver");
00074   My_List->set(
00075     "Tolerance", 
00076     1e-10,
00077     "The tolerance used for the convergence check");
00078   
00079   RCP<StringValidator> solverValidator = 
00080      rcp(new StringValidator(tuple<std::string>("GMRES", "CG", "TFQMR")));
00081   My_List->set(
00082     "Solver",
00083     "GMRES",
00084     "The type of solver to use.",
00085     solverValidator);
00086 
00087   Array<double> doubleArray( 10, 0.0 );
00088   My_List->set(
00089     "Initial Guess",
00090     doubleArray,
00091     "The initial guess as a RCP to an array object.");
00092 
00093   ParameterList& Prec_List = My_List->sublist(
00094     "Preconditioner",
00095     false,
00096     "Sublist that defines the preconditioner.");
00097 
00098   Prec_List.set("Type", "ILU", "The tpye of preconditioner to use");
00099   Prec_List.set(
00100     "Drop Tolerance",
00101     1e-3,
00102     "The tolerance below which entries from the"
00103     "factorization are left out of the factors.");
00104 
00111    Optika::OptikaGUI myGUI(My_List);
00112 
00117    myGUI.setWindowTitle("My Custom GUI");
00118 
00123    myGUI.setAboutInfo("This is a little GUI I made.");
00124 
00135    myGUI.setWindowIcon("myIcon.png");
00136 
00152    myGUI.setStyleSheet("myStyleSheet.qss");
00153 
00159    myGUI.exec();
00160 
00164   return 0;
00165 }
00166 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Defines