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


C++ MooseVariable类代码示例

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


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

示例1: coupledCallback

VariableSecond &
Coupleable::coupledSecondOld(const std::string & var_name, unsigned int comp)
{
  coupledCallback(var_name, true);
  if (_nodal)
    mooseError("Nodal variables do not have second derivatives");

  validateExecutionerType(var_name);
  MooseVariable * var = getVar(var_name, comp);
  return (_c_is_implicit) ? var->secondSlnOld() : var->secondSlnOlder();
}
开发者ID:atomica,项目名称:moose,代码行数:11,代码来源:Coupleable.C

示例2:

void
SystemBase::reinitNodesNeighbor(const std::vector<dof_id_type> & nodes, THREAD_ID tid)
{
  const std::vector<MooseVariable *> & vars = _vars[tid].variables();
  for (std::vector<MooseVariable *>::const_iterator it = vars.begin(); it != vars.end(); ++it)
  {
    MooseVariable *var = *it;
    var->reinitNodesNeighbor(nodes);
    var->computeNodalNeighborValues();
  }
}
开发者ID:amccaskey,项目名称:moose,代码行数:11,代码来源:SystemBase.C

示例3: validateExecutionerType

const VariableValue &
NeighborCoupleable::coupledNeighborValueOld(const std::string & var_name, unsigned int comp)
{
  validateExecutionerType(var_name, "coupledNeighborValueOld");

  MooseVariable * var = getVar(var_name, comp);
  if (_neighbor_nodal)
    return (_c_is_implicit) ? var->nodalValueOldNeighbor() : var->nodalValueOlderNeighbor();
  else
    return (_c_is_implicit) ? var->slnOldNeighbor() : var->slnOlderNeighbor();
}
开发者ID:radioactivekate,项目名称:moose,代码行数:11,代码来源:NeighborCoupleable.C

示例4: getVar

VariableValue &
Coupleable::coupledDotDu(const std::string & var_name, unsigned int comp)
{
  MooseVariable * var = getVar(var_name, comp);
  if (var->kind() == Moose::VAR_AUXILIARY)
    mooseError("Coupling time derivative of an auxiliary variable is not allowed.");

  if (_nodal)
    return var->nodalSlnDuDotDu();
  else
    return var->duDotDu();
}
开发者ID:atomica,项目名称:moose,代码行数:12,代码来源:Coupleable.C

示例5: coupledCallback

VariableSecond &
Coupleable::coupledSecond(const std::string & var_name, unsigned int comp)
{
  if (!isCoupled(var_name)) // Return default 0
    return _default_second;

  coupledCallback(var_name, false);
  if (_nodal)
    mooseError("Nodal variables do not have second derivatives");

  MooseVariable * var = getVar(var_name, comp);
  return (_c_is_implicit) ? var->secondSln() : var->secondSlnOlder();
}
开发者ID:anilkunwar,项目名称:moose,代码行数:13,代码来源:Coupleable.C

示例6: mooseError

const VariableGradient &
NeighborCoupleable::coupledNeighborGradientOlder(const std::string & var_name, unsigned int comp)
{
  if (_neighbor_nodal)
    mooseError("Nodal variables do not have gradients");

  validateExecutionerType(var_name, "coupledNeighborGradientOlder");
  MooseVariable * var = getVar(var_name, comp);
  if (_c_is_implicit)
    return var->gradSlnOlderNeighbor();
  else
    mooseError("Older values not available for explicit schemes");
}
开发者ID:radioactivekate,项目名称:moose,代码行数:13,代码来源:NeighborCoupleable.C

示例7: getVar

VariableValue &
Coupleable::coupledDotDu(const std::string & var_name, unsigned int comp)
{
  if (!isCoupled(var_name)) // Return default 0
    return _default_value_zero;

  MooseVariable * var = getVar(var_name, comp);

  if (_nodal)
    return var->nodalSlnDuDotDu();
  else
    return var->duDotDu();
}
开发者ID:anilkunwar,项目名称:moose,代码行数:13,代码来源:Coupleable.C

示例8: coupledCallback

const VariableValue &
Coupleable::coupledNodalValue(const std::string & var_name, unsigned int comp)
{
  if (!isCoupled(var_name))
    return *getDefaultValue(var_name);

  coupledCallback(var_name, false);
  MooseVariable * var = getVar(var_name, comp);

  if (!_coupleable_neighbor)
    return (_c_is_implicit) ? var->nodalValue() : var->nodalValueOld();
  else
    return (_c_is_implicit) ? var->nodalValueNeighbor() : var->nodalValueOldNeighbor();
}
开发者ID:aeslaughter,项目名称:moose,代码行数:14,代码来源:Coupleable.C

示例9: 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

示例10:

void
AuxiliarySystem::addVariable(const std::string & var_name, const FEType & type, Real scale_factor, const std::set< SubdomainID > * const active_subdomains/* = NULL*/)
{
  SystemTempl<TransientExplicitSystem>::addVariable(var_name, type, scale_factor, active_subdomains);
  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
  {
    MooseVariable * var = dynamic_cast<MooseVariable *>(_vars[tid].getVariable(var_name));
    if (var != NULL)
    {
      if (var->feType().family == LAGRANGE)
        _nodal_vars[tid][var_name] = var;
      else
        _elem_vars[tid][var_name] = var;
    }
  }
}
开发者ID:MatthewWilliamNoble,项目名称:moose,代码行数:16,代码来源:AuxiliarySystem.C

示例11:

void
AuxiliarySystem::reinitElem(const Elem * /*elem*/, THREAD_ID tid)
{
  for (const auto & it : _nodal_vars[tid])
  {
    MooseVariable * var = it.second;
    var->computeElemValues();
  }

  for (const auto & it : _elem_vars[tid])
  {
    MooseVariable * var = it.second;
    var->reinitAux();
    var->computeElemValues();
  }
}
开发者ID:gnsteve,项目名称:moose,代码行数:16,代码来源:AuxiliarySystem.C

示例12: mooseError

unsigned int
PolycrystalICTools::assignPointToGrain(const Point & p,
                                       const std::vector<Point> & centerpoints,
                                       const MooseMesh & mesh,
                                       const MooseVariable & var,
                                       const Real maxsize)
{
  unsigned int grain_num = centerpoints.size();

  Real min_distance = maxsize;
  unsigned int min_index = grain_num;
  // Loops through all of the grain centers and finds the center that is closest to the point p
  for (unsigned int grain = 0; grain < grain_num; grain++)
  {
    Real distance = mesh.minPeriodicDistance(var.number(), centerpoints[grain], p);

    if (min_distance > distance)
    {
      min_distance = distance;
      min_index = grain;
    }
  }

  if (min_index >= grain_num)
    mooseError("ERROR in PolycrystalVoronoiVoidIC: didn't find minimum values in grain_value_calc");

  return min_index;
}
开发者ID:FHilty,项目名称:moose,代码行数:28,代码来源:PolycrystalICTools.C

示例13: validateExecutionerType

const VariableValue &
Coupleable::coupledValueOlder(const std::string & var_name, unsigned int comp)
{
  if (!isCoupled(var_name))
    return *getDefaultValue(var_name);

  validateExecutionerType(var_name);
  coupledCallback(var_name, true);
  MooseVariable * var = getVar(var_name, comp);

  if (!_coupleable_neighbor)
  {
    if (_nodal)
    {
      if (_c_is_implicit)
        return var->nodalSlnOlder();
      else
        mooseError("Older values not available for explicit schemes");
    }
    else
    {
      if (_c_is_implicit)
        return var->slnOlder();
      else
        mooseError("Older values not available for explicit schemes");
    }
  }
  else
  {
    if (_nodal)
    {
      if (_c_is_implicit)
        return var->nodalSlnOlderNeighbor();
      else
        mooseError("Older values not available for explicit schemes");
    }
    else
    {
      if (_c_is_implicit)
        return var->slnOlderNeighbor();
      else
        mooseError("Older values not available for explicit schemes");
    }
  }
}
开发者ID:aeslaughter,项目名称:moose,代码行数:45,代码来源:Coupleable.C

示例14:

void
MultiAppCopyTransfer::transferDofObject(libMesh::DofObject * to_object,
                                        libMesh::DofObject * from_object,
                                        MooseVariable & to_var,
                                        MooseVariable & from_var)
{
  if (to_object->n_dofs(to_var.sys().number(), to_var.number()) >
      0) // If this variable has dofs at this node
    for (unsigned int comp = 0; comp < to_object->n_comp(to_var.sys().number(), to_var.number());
         ++comp)
    {
      dof_id_type dof = to_object->dof_number(to_var.sys().number(), to_var.number(), comp);
      dof_id_type from_dof =
          from_object->dof_number(from_var.sys().number(), from_var.number(), comp);
      Real from_value = from_var.sys().solution()(from_dof);
      to_var.sys().solution().set(dof, from_value);
    }
}
开发者ID:mangerij,项目名称:moose,代码行数:18,代码来源:MultiAppCopyTransfer.C

示例15: VariableValue

VariableValue &
Coupleable::coupledNodalValue(const std::string & var_name, unsigned int comp)
{
  if (!isCoupled(var_name)) // Need to generate a "default value" filled VariableValue
  {
    VariableValue * value = _default_value[var_name];
    if (value == NULL)
    {
      value = new VariableValue(_coupleable_max_qps, _coupleable_params.defaultCoupledValue(var_name));
      _default_value[var_name] = value;
    }
    return *_default_value[var_name];
  }

  coupledCallback(var_name, false);
  MooseVariable * var = getVar(var_name, comp);
  return (_c_is_implicit) ? var->nodalValue() : var->nodalValueOld();
}
开发者ID:anilkunwar,项目名称:moose,代码行数:18,代码来源:Coupleable.C


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