Ejemplo n.º 1
0
int recursive (source *src, order *ord, int *p, int *res, int j, int cur, int n){
  //if (j >= n) return 1;
  int i;
  for (i = j; i<n; i++){
    /*int s=0;
      for (s=0; s<n;s++)
      printf("_%d %d\n", res[s], p[i]);*/
      
    if (iscorrect (src, ord, n-1, res, p[i])){
       if (cur > max)
       max = cur;
      res[cur] = p[i];
      
      d = (int**) realloc(d, (size+1)*sizeof(int*));
      d[size] = (int*) malloc(n*sizeof(int));
      memcpy(d[size], res, n*sizeof(int));
      size++;
      
      if (recursive (src, ord, p, res, i+1, cur+1, n)) return 1;
      res[cur] = 0; //backtrace
    }
    //printf("=========\n");
  }

  return 0;
}
Ejemplo n.º 2
0
/*
void delete_uncorrect_prd_from_ord(order *hd){
  order *head = get_head_order(hd);
  a_product *cur, *temp;
  whi
}
*/
void delete_imp_orders (order *ord, source *src){
  order *temp,*head = get_head_order(ord);
  while (head!=NULL){
    if(!iscorrect(src,ord,0,0,head->id)){
      if(head->n != NULL) (head->n)->prev = head->prev;
      if (head->prev != NULL) (head->prev)->n = head->n;
      temp = head->n;
      free(head);
      head = temp;
    }else{
      head = head->n;
    }
  }
}
Ejemplo n.º 3
0
INT init_iter_forces( DOUBLE* _E )
{
    INT i;
    if ( !iscorrect( ) ) return 1;
    memset( repeat, 0, sizeof (INT) * g_threads );
    for ( i = 0; i < g_threads; ++i )
    {
        memset( F[i], 0, sizeof (DOUBLE) * DIMS0 * size );
    }
    if ( _E )
    {
        memset( _E, 0, sizeof (DOUBLE) * (ENERGY_LAST + 1) );
        for ( i = 0; i < g_threads; ++i )
        {
            memset( ES[i], 0, sizeof (DOUBLE) * (ENERGY_LAST + 1) );
        }
    }
	return 0;
}