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


C++ MooseVariable::add方法代码示例

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


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

示例1: sentinel

void
ComputeIndicatorThread::onElement(const Elem * elem)
{
  for (const auto & it : _aux_sys._elem_vars[_tid])
  {
    MooseVariable * var = it.second;
    var->prepareAux();
  }

  _fe_problem.prepare(elem, _tid);
  _fe_problem.reinitElem(elem, _tid);

  // Set up Sentinel class so that, even if reinitMaterials() throws, we
  // still remember to swap back during stack unwinding.
  SwapBackSentinel sentinel(_fe_problem, &FEProblemBase::swapBackMaterials, _tid);

  _fe_problem.reinitMaterials(_subdomain, _tid);

  // Compute
  if (!_finalize)
  {
    if (_indicator_whs.hasActiveBlockObjects(_subdomain, _tid))
    {
      const std::vector<std::shared_ptr<Indicator>> & indicators =
          _indicator_whs.getActiveBlockObjects(_subdomain, _tid);
      for (const auto & indicator : indicators)
        indicator->computeIndicator();
    }
  }

  // Finalize
  else
  {
    if (_indicator_whs.hasActiveBlockObjects(_subdomain, _tid))
    {
      const std::vector<std::shared_ptr<Indicator>> & indicators =
          _indicator_whs.getActiveBlockObjects(_subdomain, _tid);
      for (const auto & indicator : indicators)
        indicator->finalize();
    }

    if (_internal_side_indicators.hasActiveBlockObjects(_subdomain, _tid))
    {
      const std::vector<std::shared_ptr<InternalSideIndicator>> & internal_indicators =
          _internal_side_indicators.getActiveBlockObjects(_subdomain, _tid);
      for (const auto & internal_indicator : internal_indicators)
        internal_indicator->finalize();
    }
  }

  if (!_finalize) // During finalize the Indicators should be setting values in the vectors manually
  {
    Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
    for (const auto & it : _aux_sys._elem_vars[_tid])
    {
      MooseVariable * var = it.second;
      var->add(_aux_sys.solution());
    }
  }
}
开发者ID:mangerij,项目名称:moose,代码行数:60,代码来源:ComputeIndicatorThread.C

示例2: lock

void
ComputeIndicatorThread::onElement(const Elem *elem)
{
  for (std::map<std::string, MooseVariable *>::iterator it = _aux_sys._elem_vars[_tid].begin(); it != _aux_sys._elem_vars[_tid].end(); ++it)
  {
    MooseVariable * var = it->second;
    var->prepareAux();
  }

  _fe_problem.prepare(elem, _tid);
  _fe_problem.reinitElem(elem, _tid);

  _fe_problem.reinitMaterials(_subdomain, _tid);

  const std::vector<Indicator *> & indicators = _indicator_whs[_tid].active();

  if (!_finalize)
    for (std::vector<Indicator *>::const_iterator it = indicators.begin(); it != indicators.end(); ++it)
      (*it)->computeIndicator();
  else
  {
    for (std::vector<Indicator *>::const_iterator it = indicators.begin(); it != indicators.end(); ++it)
      (*it)->finalize();

    // Now finalize the side integral side_indicators as well
    {
      const std::vector<Indicator *> & side_indicators = _indicator_whs[_tid].activeInternalSideIndicators();
      for (std::vector<Indicator *>::const_iterator it = side_indicators.begin(); it != side_indicators.end(); ++it)
        (*it)->finalize();
    }
  }

  _fe_problem.swapBackMaterials(_tid);

  if (!_finalize) // During finalize the Indicators should be setting values in the vectors manually
  {
    Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
    for (std::map<std::string, MooseVariable *>::iterator it = _aux_sys._elem_vars[_tid].begin(); it != _aux_sys._elem_vars[_tid].end(); ++it)
    {
      MooseVariable * var = it->second;
      var->add(_aux_sys.solution());
    }
  }
}
开发者ID:DarinReid,项目名称:moose,代码行数:44,代码来源:ComputeIndicatorThread.C


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