42 #ifndef __Belos_OrthoManagerFactory_hpp
43 #define __Belos_OrthoManagerFactory_hpp
46 #ifdef HAVE_BELOS_TSQR
48 #endif // HAVE_BELOS_TSQR
55 #include <Teuchos_StandardCatchMacros.hpp>
81 template<
class Scalar,
class MV,
class OP>
85 std::vector<std::string> theList_;
90 #ifdef HAVE_BELOS_TSQR
94 #endif // HAVE_BELOS_TSQR
103 #ifdef HAVE_BELOS_TSQR
105 return (name ==
"TSQR");
108 #endif // HAVE_BELOS_TSQR
115 theList_[index++] =
"DGKS";
116 theList_[index++] =
"ICGS";
117 theList_[index++] =
"IMGS";
118 #ifdef HAVE_BELOS_TSQR
119 theList_[index++] =
"TSQR";
120 #endif // HAVE_BELOS_TSQR
121 theList_[index++] =
"Simple";
132 const std::vector<std::string>&
139 return (std::find (theList_.begin(), theList_.end(), name) != theList_.end());
147 TEUCHOS_TEST_FOR_EXCEPTION(numValid <= 0, std::logic_error,
148 "Invalid number " << numValid <<
" of valid MatOrtho"
149 "Manager names. Please report this bug to the Belos "
152 for (
int k = 0; k < numValid - 1; ++k)
153 out <<
"\"" << theList_[k] <<
"\", ";
156 out <<
"\"" << theList_[numValid-1] <<
"\"";
167 std::ostringstream os;
189 Teuchos::RCP<const Teuchos::ParameterList>
192 if (name ==
"DGKS") {
193 return Belos::getDGKSDefaultParameters<Scalar, MV, OP> ();
195 #ifdef HAVE_BELOS_TSQR
196 else if (name ==
"TSQR") {
200 #endif // HAVE_BELOS_TSQR
201 else if (name ==
"ICGS") {
202 return Belos::getICGSDefaultParameters<Scalar, MV, OP> ();
204 else if (name ==
"IMGS") {
205 return Belos::getIMGSDefaultParameters<Scalar, MV, OP> ();
207 else if (name ==
"Simple") {
212 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
213 "Invalid orthogonalization manager name \"" << name
215 <<
". For many of the test executables, the "
216 "orthogonalization manager name often corresponds "
217 "to the \"ortho\" command-line argument.");
220 TEUCHOS_UNREACHABLE_RETURN(Teuchos::null);
237 Teuchos::RCP<const Teuchos::ParameterList>
240 if (name ==
"DGKS") {
241 return Belos::getDGKSFastParameters<Scalar, MV, OP> ();
243 #ifdef HAVE_BELOS_TSQR
244 else if (name ==
"TSQR") {
248 #endif // HAVE_BELOS_TSQR
249 else if (name ==
"ICGS") {
250 return Belos::getICGSFastParameters<Scalar, MV, OP> ();
252 else if (name ==
"IMGS") {
253 return Belos::getIMGSFastParameters<Scalar, MV, OP> ();
255 else if (name ==
"Simple") {
260 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
261 "Invalid orthogonalization manager name \"" << name
263 <<
". For many of the test executables, the "
264 "orthogonalization manager name often corresponds "
265 "to the \"ortho\" command-line argument.");
268 TEUCHOS_UNREACHABLE_RETURN(Teuchos::null);
291 Teuchos::RCP<Belos::MatOrthoManager<Scalar, MV, OP> >
293 const Teuchos::RCP<const OP>& M,
295 const std::string& label,
296 const Teuchos::RCP<Teuchos::ParameterList>& params)
298 #ifdef HAVE_BELOS_TSQR
300 #endif // HAVE_BELOS_TSQR
307 if (ortho ==
"DGKS") {
309 return rcp (
new ortho_type (params, label, M));
311 #ifdef HAVE_BELOS_TSQR
312 else if (ortho ==
"TSQR") {
314 return rcp (
new ortho_type (params, label, M));
316 #endif // HAVE_BELOS_TSQR
317 else if (ortho ==
"ICGS") {
319 return rcp (
new ortho_type (params, label, M));
321 else if (ortho ==
"IMGS") {
323 return rcp (
new ortho_type (params, label, M));
325 else if (ortho ==
"Simple") {
326 TEUCHOS_TEST_FOR_EXCEPTION(ortho ==
"Simple", std::logic_error,
327 "SimpleOrthoManager does not yet support "
328 "the MatOrthoManager interface");
330 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
331 "Invalid orthogonalization manager name: Valid names"
333 "the test executables, the orthogonalization manager"
334 " name often corresponds to the \"ortho\" command-"
336 TEUCHOS_UNREACHABLE_RETURN(Teuchos::null);
355 Teuchos::RCP<Belos::OrthoManager<Scalar, MV> >
357 const Teuchos::RCP<const OP>& M,
359 const std::string& label,
360 const Teuchos::RCP<Teuchos::ParameterList>& params)
362 #ifdef HAVE_BELOS_TSQR
364 #endif // HAVE_BELOS_TSQR
367 if (ortho ==
"Simple") {
368 TEUCHOS_TEST_FOR_EXCEPTION(! M.is_null(), std::logic_error,
369 "SimpleOrthoManager is not yet supported "
370 "when the operator M is nontrivial (i.e., "
374 #ifdef HAVE_BELOS_TSQR
383 else if (ortho ==
"TSQR" && M.is_null()) {
386 #endif // HAVE_BELOS_TSQR
396 #endif // __Belos_OrthoManagerFactory_hpp