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


C++ Split::setup方法代码示例

本文整理汇总了C++中Split::setup方法的典型用法代码示例。如果您正苦于以下问题:C++ Split::setup方法的具体用法?C++ Split::setup怎么用?C++ Split::setup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Split的用法示例。


在下文中一共展示了Split::setup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PetscOptionsSetValue

void
Split::setup(const std::string& prefix)
{
  PetscErrorCode ierr;
  std::string dmprefix = prefix + "dm_moose_", opt, val;

  // var options
  if (_vars.size()) {
    opt = dmprefix + "vars";
    val="";
    for (unsigned int j = 0; j < _vars.size(); ++j)
      val += (j ? "," : "") + _vars[j];
    ierr = PetscOptionsSetValue(opt.c_str(), val.c_str());
    CHKERRABORT(_communicator.get(), ierr);
  }

  // block options
  if (_blocks.size()) {
    opt = dmprefix + "blocks";
    val = "";
    for (unsigned int j = 0; j < _blocks.size(); ++j)
      val += (j ? "," : "") + _blocks[j];
    ierr = PetscOptionsSetValue(opt.c_str(), val.c_str());
    CHKERRABORT(_communicator.get(), ierr);
  }

  // side options
  if (_sides.size()) {
    opt = dmprefix + "sides";
    val = "";
    for (unsigned int j = 0; j < _sides.size(); ++j)
      val += (j ? "," : "") + _sides[j];
    ierr = PetscOptionsSetValue(opt.c_str(), val.c_str());
    CHKERRABORT(_communicator.get(), ierr);
  }

  // unside options
  if (_unsides.size()) {
    opt = dmprefix + "unsides";
    val = "";
    for (unsigned int j = 0; j < _unsides.size(); ++j)
      val += (j ? "," : "") + _unsides[j];
    ierr = PetscOptionsSetValue(opt.c_str(), val.c_str());
    CHKERRABORT(_communicator.get(), ierr);
  }

  if (_splitting.size()) {
    // If this split has subsplits, it is presumed that the pc_type used to solve this split's subsystem is fieldsplit
    // with the following parameters (unless overridden by the user-specified petsc_options below).
    opt = prefix + "pc_type";
    val = "fieldsplit";
    ierr = PetscOptionsSetValue(opt.c_str(), val.c_str());
    CHKERRABORT(_communicator.get(), ierr);

    // set Splitting Type
    const char * petsc_splitting_type[] = {
      "additive",
      "multiplicative",
      "symmetric_multiplicative",
      "schur"
    };
    opt = prefix + "pc_fieldsplit_type";
    ierr = PetscOptionsSetValue(opt.c_str(), petsc_splitting_type[_splitting_type]);
    CHKERRABORT(_communicator.get(), ierr);

    if (_splitting_type == SplittingTypeSchur)
    {
      // set Schur Type
      const char * petsc_schur_type[] = {
        "diag",
        "upper",
        "lower",
        "full"
      };
      opt = prefix + "pc_fieldsplit_schur_fact_type";
      ierr = PetscOptionsSetValue(opt.c_str(), petsc_schur_type[_splitting_type]);
      CHKERRABORT(_communicator.get(), ierr);

      // set Schur Preconditioner
      const char * petsc_schur_pre[] = {
        "self",
        "selfp",
        #if PETSC_VERSION_LESS_THAN(3,4,0)
          "diag"
        #else
          "a11"
        #endif
      };
      opt = prefix + "pc_fieldsplit_schur_precondition";
      ierr = PetscOptionsSetValue(opt.c_str(), petsc_schur_pre[_schur_pre]);
      CHKERRABORT(_communicator.get(), ierr);

      // set Schur AInv
      const char * petsc_schur_ainv[] = {
        "diag",
        "lump"
      };
      opt = prefix + "mat_schur_complement_ainv_type";
      ierr = PetscOptionsSetValue(opt.c_str(), petsc_schur_ainv[_schur_ainv]);
      CHKERRABORT(_communicator.get(), ierr);
//.........这里部分代码省略.........
开发者ID:smharper,项目名称:moose,代码行数:101,代码来源:Split.C


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