18 template<
class ScalarType>
25 typedef ScalarType NormType;
27 std::vector<std::pair<std::string, std::string> > solvers;
28 solvers.push_back (std::make_pair (
"A",
"1"));
29 solvers.push_back (std::make_pair (
"A",
"2"));
30 solvers.push_back (std::make_pair (
"B",
"3"));
31 solvers.push_back (std::make_pair (
"B",
"4"));
32 solvers.push_back (std::make_pair (
"C",
"5"));
33 solvers.push_back (std::make_pair (
"C",
"6"));
35 for (
size_t k = 0; k < solvers.size (); ++k) {
36 const std::string packageName = solvers[k].first;
37 const std::string solverName = solvers[k].second;
38 cout <<
"Package \"" << packageName <<
"\", solver \"" << solverName
41 Trilinos::Details::getLinearSolver<MV, OP, NormType> (packageName, solverName);
42 if (solver.
get () == NULL) {
43 std::ostringstream err;
44 err <<
"Solver \"" << solvers[k].second <<
"\" from package \""
45 << solvers[k].first <<
"\" does not exist!";
46 throw std::logic_error (err.str ());
52 solver->setMatrix (A);
60 cout <<
"Finished solver->solve(X, B)" << endl << endl;
70 int err = EXIT_SUCCESS;
72 cout <<
"Test ScalarType=float" << endl;
74 testSolvers<float> ();
75 }
catch (std::exception& e) {
76 cout <<
"testSolvers<float>() threw an exception: " << e.what () << endl;
80 cout << endl <<
"Test ScalarType=double" << endl;
82 testSolvers<double> ();
83 }
catch (std::exception& e) {
84 cout <<
"testSolvers<double>() threw an exception: " << e.what () << endl;
88 cout << endl <<
"Test ScalarType=int (should not work)" << endl;
91 cout <<
"testSolvers<int>() should not have worked!" << endl;
93 }
catch (std::exception&) {
94 cout <<
"Of course testSolvers<int>() threw an exception: "
95 "no packages registered themselves for ScalarType=int. "
96 "This is correct behavior in that case." << endl;
T * get() const
Get the raw C++ pointer to the underlying object.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
int main(int argc, char *argv[])
Smart reference counting pointer class for automatic garbage collection.