#include "Didasko_ConfigDefs.h"
#ifdef HAVE_MPI
#include "mpi.h"
#endif
#if defined(HAVE_DIDASKO_TEUCHOS)
#include "Teuchos_ParameterList.hpp"
#include "Teuchos_ConfigDefs.hpp"
int main(int argc, char* argv[])
{
#ifdef HAVE_MPI
MPI_Init(&argc,&argv);
#endif
Teuchos::ParameterList My_List;
My_List.set("Max Iters", 1550);
My_List.set("Tolerance", 1e-10);
My_List.set("Solver", "GMRES");
My_List.set("Tolerance", (float)(1e-10));
Teuchos::ParameterList& Prec_List = My_List.sublist("Preconditioner");
Prec_List.set("Type", "ILU");
Prec_List.set("Drop Tolerance", 1e-3);
bool solver_defined, prec_defined, tol_double, dtol_double;
solver_defined = My_List.isParameter("Solver");
prec_defined = My_List.isSublist("Preconditioner");
tol_double = My_List.INVALID_TEMPLATE_QUALIFIER isType<double>("Tolerance");
dtol_double = Teuchos::isParameterType<double>(Prec_List, "Drop Tolerance");
int its;
its = My_List.get("Max Iters", 1200);
float tol = My_List.INVALID_TEMPLATE_QUALIFIER get<float>("Tolerance");
try {
tol = My_List.INVALID_TEMPLATE_QUALIFIER get<float>("Tolerance");
}
catch (std::exception& e) {
tol = 1e-6;
}
try {
tol = Teuchos::getParameter<float>(My_List, "Tolerance");
}
catch (std::exception& e) {
tol = 1e-6;
}
cout<< My_List << endl;
My_List.unused( cout );
#ifdef HAVE_MPI
MPI_Finalize();
#endif
return 0;
}
#else
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
#ifdef HAVE_MPI
MPI_Init(&argc,&argv);
#endif
puts("Please configure Didasko with:\n"
"--enable-teuchos");
#ifdef HAVE_MPI
MPI_Finalize();
#endif
return 0;
}
#endif