Ejemplo n.º 1
0
int main (int arc, char** argv)
{
	init_up();
	init_cup();
	
	
	int resol = atoi(argv[1]);
	solveB3(0.0,M_PI,resol);
	solveCup(0.0,M_PI,resol);
	
	//plotting error graphics
	char args[80];
	strcpy(args,"gnuplot -e \"outputname='./img/err");
	strcat(args,argv[1]);
	strcat(args,".eps'\" errplot2f.conf");
	system(args);
	
	//plotting graphics
	strcpy(args,"gnuplot -e \"outputname='./img/plot");
	strcat(args,argv[1]);
	strcat(args,".eps'\" plot2f.conf");
	system(args);
	printf("%f %f %f\n",f_B_3(0.),f_B_3(1.),f_B_3(2.));
	return 0;
}
//-----------------------------------------------------------------------------
void
init_rlc_um (struct rlc_um_entity *rlcP)
{
//-----------------------------------------------------------------------------
#ifndef NO_THREAD_SAFE
  pthread_mutexattr_t attr;
  int             error_code;
#endif

  memset (rlcP, 0, sizeof (struct rlc_um_entity));
  // TX SIDE
  init_cnt_up (&rlcP->pdus_to_mac_layer, NULL);

#ifndef NO_THREAD_SAFE
  // init mutex protect input sdu buffer
  pthread_mutexattr_init (&attr);
#    ifdef USER_MODE
  pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE_NP);
#    else
  pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_NORMAL);
#    endif
  if ((error_code = pthread_mutex_init (&rlcP->mutex_input_buffer, &attr))) {
    msg ("[RLC_UM %p][ERROR] init mutex input buffer %d\n", rlcP, error_code);
  }
#    ifndef USER_MODE
  //pthread_mutexattr_setprotocol(&rlcP->mutex_input_buffer, PTHREAD_PRIO_INHERIT);
#    endif
#endif

  rlcP->protocol_state = RLC_NULL_STATE;
  rlcP->nb_sdu = 0;
  rlcP->next_sdu_index = 0;
  rlcP->current_sdu_index = 0;

  rlcP->li_one_byte_short_to_add_in_next_pdu = 0;
  rlcP->li_exactly_filled_to_add_in_next_pdu = 0;
  rlcP->li_length_15_was_used_for_previous_pdu = 0;

  rlcP->vt_us = 0;
  rlcP->first_li_in_next_pdu = RLC_LI_UNDEFINED;

  // RX SIDE
  init_up (&rlcP->pdus_from_mac_layer, NULL);
  rlcP->vr_us = 0;
  rlcP->output_sdu_size_to_write = 0;
  rlcP->output_sdu_in_construction = NULL;
}