Optika GUI Toolik Version of the Day
example/CustomFunctionExample/main.cpp File Reference
#include "Teuchos_ParameterList.hpp"
#include "Teuchos_StandardParameterEntryValidators.hpp"
#include "Teuchos_Array.hpp"
#include "Teuchos_Version.hpp"
#include "Optika_GUI.hpp"
#include "Teuchos_XMLParameterListHelpers.hpp"
#include "Teuchos_FancyOStream.hpp"
#include "Teuchos_VerboseObject.hpp"
Include dependency graph for example/CustomFunctionExample/main.cpp:

Go to the source code of this file.


void customFunction (Teuchos::RCP< const Teuchos::ParameterList > currentParams)
int main (int argc, char *argv[])

Function Documentation

void customFunction ( Teuchos::RCP< const Teuchos::ParameterList currentParams)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!! ATTENTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!! PLEASE VIEW THE BASIC EXAMPLE FIRST BEFORE READING THIS !!!!!!!! !!!! EXAMPLE. IT PROVIDES FUNDAMENTAL KNOWLEDGE THAT WILL BE !!!!!!!! !!!! VERY HELPFUL IN UNDERSTANDING THIS EXAMPLE !!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Don't worry about this little guy right now. We'll come back to him later. We just needed to prototype it.

The custom function must always have this signature (returning void and taking a single RCP<const ParameterList> parameter). When the user clicks action button the function will be called. The current values for the parameter list are what will be given as the argument. Here we simply read what some of the settings the user has selected and print them out. But in theory, you could do anything you want with the parameters at this point. The GUI will terminate once the user exits (by some means of closing the GUI window), and control will be returned back to what ever function called getInput() (in this case the main()).

Definition at line 157 of file example/CustomFunctionExample/main.cpp.

int main ( int  argc,
char *  argv[] 

Sometimes, you would rather have a slightly different workflow than the one Optika offers by default. This is why Optika also offers a second, tighter workflow that goes like this: 1. Construct a Parameter List of inputs. 2. Create a function which will run given the inputs. 3. Call getInput() like normal, except also pass the memory address of the function. 4. Everytime the user clicks the action button on the GUI, your custom function will run. 5. The user may click quit when they are finished and control will be returned to you. This alternative workflow allows the user to quickly tweak and re-try different parameter configurations.

We start off like normal. I'm actually just going to repeat what we did in the BasicExample

Here is where things get switched up a bit. Along with the list, we pass along the address of the "customFunction" (the Teuchos::null is there because we don't want to specify any dependencies for this GUI). Let's skip down a bit and take a look at the function.

Definition at line 66 of file example/CustomFunctionExample/main.cpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Defines