コード例 #1
0
std::pair<unsigned int,Real> RBSCMConstruction::compute_SCM_bounds_on_training_set()
{
  START_LOG("compute_SCM_bounds_on_training_set()", "RBSCMConstruction");

  // Now compute the maximum bound error over training_parameters
  unsigned int new_C_J_index = 0;
  Real max_SCM_error = 0.;

  unsigned int first_index = get_first_local_training_index();
  for(unsigned int i=0; i<get_local_n_training_samples(); i++)
  {
    set_params_from_training_set(first_index+i);
    rb_scm_eval->set_parameters( get_parameters() );
    Real LB = rb_scm_eval->get_SCM_LB();
    Real UB = rb_scm_eval->get_SCM_UB();

    Real error_i = SCM_greedy_error_indicator(LB, UB);

    if( error_i > max_SCM_error )
    {
      max_SCM_error = error_i;
      new_C_J_index = i;
    }
  }

  unsigned int global_index = first_index + new_C_J_index;
  std::pair<unsigned int,Real> error_pair(global_index, max_SCM_error);
  get_global_max_error_pair(this->comm(),error_pair);

  STOP_LOG("compute_SCM_bounds_on_training_set()", "RBSCMConstruction");

  return error_pair;
}
コード例 #2
0
void RBEIMConstruction::initialize_parametrized_functions_in_training_set()
{
  if(!serial_training_set)
  {
    libMesh::err << "Error: We must have serial_training_set==true in "
                 << "RBEIMConstruction::initialize_parametrized_functions_in_training_set"
                 << std::endl;
    libmesh_error();
  }

  libMesh::out << "Initializing parametrized functions in training set..." << std::endl;
  // initialize rb_eval's parameters
  get_rb_evaluation().initialize_parameters(*this);

  _parametrized_functions_in_training_set.resize( get_n_training_samples() );
  for(unsigned int i=0; i<get_n_training_samples(); i++)
  {
    set_params_from_training_set(i);
    truth_solve(-1);

    _parametrized_functions_in_training_set[i] = solution->clone().release();

    libMesh::out << "Completed solve for training sample " << (i+1) << " of " << get_n_training_samples() << std::endl;
  }

  _parametrized_functions_in_training_set_initialized = true;

  libMesh::out << "Parametrized functions in training set initialized" << std::endl << std::endl;
}
コード例 #3
0
void RBConstructionBase<Base>::set_params_from_training_set_and_broadcast(unsigned int index)
{
  libmesh_assert(training_parameters_initialized);

  unsigned int root_id = 0;
  if( (this->get_first_local_training_index() <= index) &&
      (index < this->get_last_local_training_index()) )
    {
      // Set parameters on only one processor
      set_params_from_training_set(index);

      // set root_id, only non-zero on one processor
      root_id = this->processor_id();
    }

  // broadcast
  this->comm().max(root_id);
  broadcast_parameters(root_id);
}