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


C++ MooseSharedPointer::dimension方法代码示例

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


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

示例1: mooseError

void
MortarPeriodicAction::act()
{
  // get the mesh
  MooseSharedPointer<MortarPeriodicMesh> mesh =
      MooseSharedNamespace::dynamic_pointer_cast<MortarPeriodicMesh>(_mesh);
  if (!mesh)
    mooseError("Please use a MortarPeriodicMesh in your simulation.");

  // mesh dimension
  const unsigned short dim = mesh->dimension();

  // periodicity subblock name
  std::string periodicity_name = name();

  // axis names
  const std::vector<BoundaryName> axis = {"x", "y", "z"};

  // boundaries
  const std::vector<BoundaryName> boundary_names = {"left", "bottom", "back"};
  // opposite boundaries
  const std::vector<BoundaryName> opposite_boundary_names = {"right", "top", "front"};

  // mortar subdomains
  const std::vector<SubdomainID> & mortar_subdomains = mesh->getMortarSubdomains();

  // iterate over the periodic directions
  for (unsigned short i = 0; i < dim; ++i)
    if (mesh->getPeriodicDirections().contains(i))
    {
      // initialize subdomain restriction set
      std::set<SubdomainID> subdomain_restriction = {mortar_subdomains[i]};

      // Lagrange multiplier variable base name
      const std::string lm_base = "lm_" + periodicity_name + "_" + boundary_names[i];

      // mortar interface name
      const std::string mi_name =
          "mi_" + periodicity_name + "_" + boundary_names[i] + '_' + opposite_boundary_names[i];

      //
      // Add Lagrange multiplier variables
      //

      if (_current_task == "add_variable")
      {
        for (auto & var : _variables)
        {
          switch (_periodicity)
          {
            case 0: // gradient
              for (unsigned short j = 0; j < dim; ++j)
                _problem->addVariable(lm_base + "_" + var + "_d" + axis[j],
                                      FEType(Utility::string_to_enum<Order>("FIRST"),
                                             Utility::string_to_enum<FEFamily>("LAGRANGE")),
                                      1.0,
                                      &subdomain_restriction);
              break;

            case 1: // value
              _problem->addVariable(lm_base + "_" + var,
                                    FEType(Utility::string_to_enum<Order>("FIRST"),
                                           Utility::string_to_enum<FEFamily>("LAGRANGE")),
                                    1.0,
                                    &subdomain_restriction);
              break;

            default:
              mooseError("Periodicity type not implemented");
          }
        }
      }

      //
      // Add Mortar interfaces
      //

      if (_current_task == "add_mortar_interface")
      {
        _mesh->addMortarInterface(mi_name,
                                  boundary_names[i],
                                  opposite_boundary_names[i],
                                  Moose::stringify(mortar_subdomains[i]));
        if (_displaced_mesh)
          _displaced_mesh->addMortarInterface(mi_name,
                                              boundary_names[i],
                                              opposite_boundary_names[i],
                                              Moose::stringify(mortar_subdomains[i]));
      }

      //
      // Add Constraints
      //

      if (_current_task == "add_constraint")
      {
        for (auto & var : _variables)
        {
          const std::string ct_base =
              "ct_" + periodicity_name + "_" + boundary_names[i] + "_" + var;
//.........这里部分代码省略.........
开发者ID:aeslaughter,项目名称:moose,代码行数:101,代码来源:MortarPeriodicAction.C


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