Exemplo n.º 1
0
int read_supports ( int r, int n )
{
   int cnt[r],i,j,k,fail;
   double x[n];

   for(i=0; i<r; i++)
   {
      printf("  number of points in support %d : ",i+1);
      scanf("%d",&cnt[i]);
   }

   for(i=0; i<r; i++)
     for(j=0; j<cnt[i]; j++)
     {
        printf("Reading point %d of support %d...\n",j+1,i+1);
        printf("  give %d coordinates : ",n-1);
        for(k=0; k<n-1; k++) scanf("%lf", &x[k]);
        printf("  give lifting : "); scanf("%lf",&x[n-1]);
        /* printf("  the lifted point is ");
           for(k=0; k<n; k++) printf(" %lf",x[k]); printf("\n"); */
        fail = celcon_append_lifted_point(n,i+1,x);
        if (fail != 0) return fail;
     }

   return fail;
}
Exemplo n.º 2
0
void supports_broadcast ( int myid, int nspt, int dim )
{
   int mix[nspt];
   int fail,i,j;
   double point[dim];
 
   if(myid == 0)
   { 
      fail = celcon_type_of_mixture(&nspt,mix);  
      if(v>0) printf("The number of occurrences of supports is: ");
      if(v>0) Print_Integer_Array(nspt,mix);
   }
    
   MPI_Bcast(mix,nspt,MPI_INT,0,MPI_COMM_WORLD);
   if(myid != 0)
      fail = celcon_set_type_of_mixture(nspt,mix);  

   if(myid == 0)
   {
      fail = celcon_length_of_supports(&nspt,mix); 
      /* get #different supports and #points of each support. */
      if(v>0) printf("The number of points in root supports is: ");
      if(v>0) Print_Integer_Array(nspt,mix);
   }
   MPI_Bcast(mix,nspt,MPI_INT,0,MPI_COMM_WORLD);
    
   for(i=0;i<nspt;i++)
      for(j=0;j<mix[i];j++)
      {
         if(myid==0) fail = celcon_get_lifted_point(dim,i+1,j+1,point);
         MPI_Bcast(point,dim,MPI_DOUBLE,0,MPI_COMM_WORLD);
         if(myid!=0) fail = celcon_append_lifted_point(dim,i+1,point);
      }
}