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


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

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


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

示例1: lock

void
ComputeElemAuxVarsThread::onElement(const Elem * elem)
{
  if (_auxs[_tid].activeBlockElementKernels(_subdomain).size() > 0 || _auxs[_tid].activeElementKernels().size() > 0)
  {
    _fe_problem.prepare(elem, _tid);
    _fe_problem.reinitElem(elem, _tid);
    _fe_problem.reinitMaterials(elem->subdomain_id(), _tid);

    // block
    for(std::vector<AuxKernel*>::const_iterator block_element_aux_it = _auxs[_tid].activeBlockElementKernels(_subdomain).begin();
        block_element_aux_it != _auxs[_tid].activeBlockElementKernels(_subdomain).end(); ++block_element_aux_it)
      (*block_element_aux_it)->compute();

    // global
    for(std::vector<AuxKernel *>::const_iterator aux_it = _auxs[_tid].activeElementKernels().begin();
        aux_it!=_auxs[_tid].activeElementKernels().end();
        aux_it++)
      (*aux_it)->compute();

    _fe_problem.swapBackMaterials(_tid);

    // update the solution vector
    {
      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->insert(_system.solution());
      }
    }
  }
}
开发者ID:Jieun2,项目名称:moose,代码行数:33,代码来源:ComputeElemAuxVarsThread.C

示例2: sentinel

void
ComputeElemAuxVarsThread::onElement(const Elem * elem)
{
  if (_aux_kernels.hasActiveBlockObjects(_subdomain, _tid))
  {
    const std::vector<std::shared_ptr<AuxKernel>> & kernels =
        _aux_kernels.getActiveBlockObjects(_subdomain, _tid);
    _fe_problem.prepare(elem, _tid);
    _fe_problem.reinitElem(elem, _tid);

    // Set up the sentinel so that, even if reinitMaterials() throws, we
    // still remember to swap back.
    SwapBackSentinel sentinel(_fe_problem, &FEProblem::swapBackMaterials, _tid, _need_materials);

    if (_need_materials)
      _fe_problem.reinitMaterials(elem->subdomain_id(), _tid);

    for (const auto & aux : kernels)
      aux->compute();

    // update the solution vector
    {
      Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
      for (const auto & it : _aux_sys._elem_vars[_tid])
      {
        MooseVariable * var = it.second;
        var->insert(_aux_sys.solution());
      }
    }
  }
}
开发者ID:radioactivekate,项目名称:moose,代码行数:31,代码来源:ComputeElemAuxVarsThread.C

示例3: lock

void
ComputeElemAuxBcsThread::operator() (const ConstBndElemRange & range)
{
  ParallelUniqueId puid;
  _tid = puid.id;

  for (ConstBndElemRange::const_iterator elem_it = range.begin() ; elem_it != range.end(); ++elem_it)
  {
    const BndElement * belem = *elem_it;

    const Elem * elem = belem->_elem;
    unsigned short int side = belem->_side;
    BoundaryID boundary_id = belem->_bnd_id;

    if (elem->processor_id() == _problem.processor_id())
    {
      // prepare variables
      for (std::map<std::string, MooseVariable *>::iterator it = _sys._elem_vars[_tid].begin(); it != _sys._elem_vars[_tid].end(); ++it)
      {
        MooseVariable * var = it->second;
        var->prepareAux();
      }

      if (_auxs[_tid].elementalBCs(boundary_id).size() > 0)
      {
        _problem.prepare(elem, _tid);
        _problem.reinitElemFace(elem, side, boundary_id, _tid);
        _problem.reinitMaterialsBoundary(boundary_id, _tid);

        const std::vector<AuxKernel*> & bcs = _auxs[_tid].elementalBCs(boundary_id);
        for (std::vector<AuxKernel*>::const_iterator element_bc_it = bcs.begin(); element_bc_it != bcs.end(); ++element_bc_it)
            (*element_bc_it)->compute();

        _problem.swapBackMaterialsFace(_tid);
      }

      // update the solution vector
      {
        Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
        for (std::map<std::string, MooseVariable *>::iterator it = _sys._elem_vars[_tid].begin(); it != _sys._elem_vars[_tid].end(); ++it)
        {
          MooseVariable * var = it->second;
          var->insert(_sys.solution());
        }
      }
    }
  }
}
开发者ID:DarinReid,项目名称:moose,代码行数:48,代码来源:ComputeElemAuxBcsThread.C


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