void AddPeriodicBCAction::setPeriodicVars(PeriodicBoundaryBase & p, const std::vector<VariableName> & var_names) { NonlinearSystem & nl = _problem->getNonlinearSystem(); std::vector<VariableName> const * var_names_ptr; // If var_names is empty - then apply this periodic condition to all variables in the system if (var_names.empty()) var_names_ptr = &nl.getVariableNames(); else var_names_ptr = &var_names; for (std::vector<VariableName>::const_iterator it = var_names_ptr->begin(); it != var_names_ptr->end(); ++it) { unsigned int var_num = nl.getVariable(0, (*it)).number(); p.set_variable(var_num); _mesh->addPeriodicVariable(var_num, p.myboundary, p.pairedboundary); } }
void AddPeriodicBCAction::setPeriodicVars(PeriodicBoundaryBase & p, const std::vector<VariableName> & var_names) { NonlinearSystemBase & nl = _problem->getNonlinearSystemBase(); const std::vector<VariableName> * var_names_ptr; // If var_names is empty - then apply this periodic condition to all variables in the system if (var_names.empty()) var_names_ptr = &nl.getVariableNames(); else var_names_ptr = &var_names; for (const auto & var_name : *var_names_ptr) { unsigned int var_num = nl.getVariable(0, var_name).number(); p.set_variable(var_num); _mesh->addPeriodicVariable(var_num, p.myboundary, p.pairedboundary); } }