本文整理汇总了C++中stratimikos::DefaultLinearSolverBuilder::createPreconditioningStrategy方法的典型用法代码示例。如果您正苦于以下问题:C++ DefaultLinearSolverBuilder::createPreconditioningStrategy方法的具体用法?C++ DefaultLinearSolverBuilder::createPreconditioningStrategy怎么用?C++ DefaultLinearSolverBuilder::createPreconditioningStrategy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stratimikos::DefaultLinearSolverBuilder
的用法示例。
在下文中一共展示了DefaultLinearSolverBuilder::createPreconditioningStrategy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: comm
TEUCHOS_UNIT_TEST(tStratimikosFactory, test_RelatedFunctions)
{
using Teuchos::RCP;
using Teuchos::ParameterList;
// build global (or serial communicator)
#ifdef HAVE_MPI
Epetra_MpiComm comm(MPI_COMM_WORLD);
#else
Epetra_SerialComm comm;
#endif
// build epetra operator
RCP<Epetra_Operator> eA = buildStridedSystem(comm,5);
RCP<Thyra::LinearOpBase<double> > tA = Thyra::nonconstEpetraLinearOp(eA);
{
// build stratimikos factory, adding Teko's version
Stratimikos::DefaultLinearSolverBuilder stratFactory;
Teko::addTekoToStratimikosBuilder(stratFactory);
TEST_THROW(Teko::addTekoToStratimikosBuilder(stratFactory),std::logic_error);
Teko::addTekoToStratimikosBuilder(stratFactory,"Teko-2");
TEST_NOTHROW(stratFactory.getValidParameters()->sublist("Preconditioner Types").sublist("Teko"));
TEST_NOTHROW(stratFactory.getValidParameters()->sublist("Preconditioner Types").sublist("Teko-2"));
}
{
Teuchos::RCP<Teko::RequestHandler> rh = Teuchos::rcp(new Teko::RequestHandler);
// build stratimikos factory, adding Teko's version
Stratimikos::DefaultLinearSolverBuilder stratFactory;
Teko::addTekoToStratimikosBuilder(stratFactory,rh);
TEST_THROW(Teko::addTekoToStratimikosBuilder(stratFactory,rh),std::logic_error);
Teko::addTekoToStratimikosBuilder(stratFactory,rh,"Teko-2");
TEST_NOTHROW(stratFactory.getValidParameters()->sublist("Preconditioner Types").sublist("Teko"));
TEST_NOTHROW(stratFactory.getValidParameters()->sublist("Preconditioner Types").sublist("Teko-2"));
RCP<ParameterList> params = Teuchos::rcp(new ParameterList(*stratFactory.getValidParameters()));
ParameterList & tekoList = params->sublist("Preconditioner Types").sublist("Teko");
tekoList.set("Write Block Operator", false);
tekoList.set("Test Block Operator", false);
tekoList.set("Strided Blocking","1 1");
tekoList.set("Inverse Type","BGS");
ParameterList & ifl = tekoList.sublist("Inverse Factory Library");
ifl.sublist("BGS").set("Type","Block Gauss-Seidel");
ifl.sublist("BGS").set("Inverse Type","Amesos");
stratFactory.setParameterList(params);
RCP<Teko::StratimikosFactory> precFactory
= Teuchos::rcp_dynamic_cast<Teko::StratimikosFactory>(stratFactory.createPreconditioningStrategy("Teko-2"));
TEST_EQUALITY(precFactory->getRequestHandler(),rh);
}
}