Example #1
0
void
SystemBase::prepareFace(THREAD_ID tid, bool resize_data)
{
  if (_subproblem.hasActiveElementalMooseVariables(tid)) // We only need to do something if the element prepare was restricted
  {
    const std::set<MooseVariable *> & active_elemental_moose_variables = _subproblem.getActiveElementalMooseVariables(tid);

    std::vector<MooseVariable *> newly_prepared_vars;

    const std::vector<MooseVariable *> & vars = _vars[tid].variables();
    for (std::vector<MooseVariable *>::const_iterator it = vars.begin(); it != vars.end(); ++it)
    {
      MooseVariable *var = *it;
      if (&var->sys() == this && !active_elemental_moose_variables.count(var)) // If it wasnt in the active list we need to prepare it
      {
        var->prepare();
        newly_prepared_vars.push_back(var);
      }
    }

    // Make sure to resize the residual and jacobian datastructures for all the new variables
    if (resize_data)
      for (unsigned int i=0; i<newly_prepared_vars.size(); i++)
        _subproblem.assembly(tid).prepareVariable(newly_prepared_vars[i]);
  }
}
Example #2
0
void
SystemBase::prepare(THREAD_ID tid)
{
  if (_subproblem.hasActiveElementalMooseVariables(tid))
  {
    const std::set<MooseVariable *> & active_elemental_moose_variables = _subproblem.getActiveElementalMooseVariables(tid);
    const std::vector<MooseVariable *> & vars = _vars[tid].variables();
    for (std::vector<MooseVariable *>::const_iterator it = vars.begin(); it != vars.end(); ++it)
      (*it)->clearDofIndices();

    for (std::set<MooseVariable *>::iterator it = active_elemental_moose_variables.begin();
        it != active_elemental_moose_variables.end();
        ++it)
      if (&(*it)->sys() == this)
        (*it)->prepare();
  }
  else
  {
    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->prepare();
    }
  }
}