17 int main(
int argc,
char* argv[])
35 myPL.set(
"Max Iters", 1550,
"Determines the maximum number of iterations in the solver");
36 myPL.set(
"Tolerance", 1e-10,
"The tolerance used for the convergence check");
40 RCP<Teuchos::StringToIntegralParameterEntryValidator<int> >
43 Teuchos::tuple<std::string>(
"GMRES",
"CG",
"TFQMR" )
50 ,
"The type of solver to use"
58 myPL.set(
"Tolerance", as<float>(1e-10),
"The tolerance used for the convergence check");
66 myPL.set<Array<double> >(
"Initial Guess", tuple<double>( 10, 0.0 ),
67 "The initial guess as a RCP to an array object.");
73 ParameterList& Prec_List = myPL.sublist(
"Preconditioner",
false,
74 "Sublist that defines the preconditioner.");
77 Prec_List.set(
"Type",
"ILU",
"The tpye of preconditioner to use");
78 Prec_List.set(
"Drop Tolerance", 1e-3,
79 "The tolerance below which entries from the\n""factorization are left out of the factors.");
83 bool solver_defined =
false, prec_defined =
false, dtol_double =
false;
84 solver_defined = myPL.isParameter(
"Solver");
87 prec_defined = myPL.isSublist(
"Preconditioner");
90 bool tol_double =
false;
91 tol_double = myPL.INVALID_TEMPLATE_QUALIFIER isType<double>(
"Tolerance");
94 dtol_double = Teuchos::isParameterType<double>(Prec_List,
"Drop Tolerance");
100 its = myPL.get(
"Max Iters", 1200);
104 tol = myPL.get<
float>(
"Tolerance");
108 solver = solverValidator->validateString(
109 Teuchos::getParameter<std::string>(myPL,
"Solver")
113 Array<double> init_guess = myPL.get<Array<double> >(
"Initial Guess");
115 std::cout <<
"\n# Printing this parameter list using opeator<<(...) ...\n\n";
116 std::cout << myPL << std::endl;
118 std::cout <<
"\n# Printing the parameter list only showing documentation fields ...\n\n";
119 myPL.print(std::cout,
120 ParameterList::PrintOptions().showDoc(
true).indent(2).showTypes(
true));
127 std::cout <<
"\n# Showing unused parameters ...\n\n";
128 myPL.unused( std::cout );
133 return ( success ? EXIT_SUCCESS : EXIT_FAILURE );
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
Templated Parameter List class.
#define TEUCHOS_STANDARD_CATCH_STATEMENTS(VERBOSE, ERR_STREAM, SUCCESS_FLAG)
Simple macro that catches and reports standard exceptions and other exceptions.
std::string Teuchos_Version()
A list of parameters of arbitrary type.
TypeTo as(const TypeFrom &t)
Convert from one value type to another.
int main(int argc, char *argv[])
Templated array class derived from the STL std::vector.
Smart reference counting pointer class for automatic garbage collection.
#define TEUCHOS_ASSERT_EQUALITY(val1, val2)
This macro is checks that to numbers are equal and if not then throws an exception with a good error ...
Definition of Teuchos::as, for conversions between types.
Replacement for std::vector that is compatible with the Teuchos Memory Management classes...