当前位置: 首页>>代码示例>>C++>>正文


C++ DefaultLinearSolverBuilder::createPreconditioningStrategy方法代码示例

本文整理汇总了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);
  }
}
开发者ID:rainiscold,项目名称:trilinos,代码行数:57,代码来源:tStratimikosFactory.cpp


注:本文中的stratimikos::DefaultLinearSolverBuilder::createPreconditioningStrategy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。