Ejemplo n.º 1
0
int query_cell ( int n, int r )
{
   int k,fail,*b,i,j,mv,nl[r],kk;
   double *c,normal[n],pt[n];

   printf("\nGive a cell number : "); scanf("%d", &k);

   fail = celcon_get_inner_normal(n,k,normal);
   if (fail==1)
      printf("an error happened...\n");
   else
   {
      printf("inner normal for cell %d :\n", k);
      for(i=0;i<n;i++) printf("%.15le\n", normal[i]);
      fail = celcon_number_of_points_in_cell(k,r,nl);
      printf("number of points in supports :");
      for(i=0;i<r;i++) printf(" %d",nl[i]); printf("\n");
      printf("points in the supports :\n");
      for(i=0;i<r;i++)
      {
         for(j=0;j<nl[i];j++)
         {
            fail = celcon_get_point_in_cell(n,k,i+1,j+1,pt);
            for(kk=0; kk<n-1; kk++) printf(" %d",(int) pt[kk]);
            printf(" %.15le\n", pt[n-1]);
         }
      }
      fail = celcon_mixed_volume(k,&mv);
      printf("mixed volume : %d\n",mv);
      {
         int cl[1+r+2*n];
         double inner_normal[n];

         fail = celcon_retrieve_mixed_cell(n,r,k,cl,inner_normal);
         printf("the inner normal for cell %d : \n", k);
         for(i=0; i<n; i++) printf(" %.15le\n", inner_normal[i]);
         printf("total number of points in supports : %d\n",cl[0]);
         printf("number of points in supports : ");
         for(i=1; i<=r; i++) printf(" %d", cl[i]); printf("\n");
         printf("labels of points : ");
         kk=r;
         for(i=1; i<=r; i++)
         {
            for(j=0; j<cl[i]; j++) printf(" %d", cl[++kk]);
            printf(" | ");
         }
         printf("\n");
      }
   }
   return fail;
}
Ejemplo n.º 2
0
int query_cell ( int n, int r, int *cellnb, int tosolve )
{
    int k,fail,*b,i,j,mv,nl[r],kk,mvcell;
    double *c,normal[n],pt[n];
    char ch;

    printf("Give a cell number : ");
    scanf("%d", &k);

    if(tosolve == 1)
    {
        fail = celcon_standard_random_coefficient_system();
        fail = celcon_standard_polyhedral_homotopy();
    }

    fail = celcon_get_inner_normal(n,k,normal);
    if (fail==1)
        printf("an error happened...\n");
    else
    {
        *cellnb = k;
        printf("inner normal for cell %d :\n", k);
        for(i=0; i<n; i++) printf("%.15le\n", normal[i]);
        fail = celcon_number_of_points_in_cell(k,r,nl);
        printf("number of points in supports :");
        for(i=0; i<r; i++) printf(" %d",nl[i]);
        printf("\n");
        scanf("%c",&ch); /* get previous new line symbol */
        printf("Hit enter to continue.");
        scanf("%c",&ch); /* catch new line symbol */
        printf("points in the supports :\n");
        for(i=0; i<r; i++)
        {
            for(j=0; j<nl[i]; j++)
            {
                fail = celcon_get_point_in_cell(n,k,i+1,j+1,pt);
                for(kk=0; kk<n-1; kk++) printf(" %d",(int) pt[kk]);
                printf(" %.15le\n", pt[n-1]);
            }
        }
        fail = celcon_mixed_volume(k,&mv);
        printf("mixed volume : %d\n",mv);
        printf("Hit enter to continue.");
        scanf("%c",&ch); /* catch new line symbol */
        if(tosolve == 1)
        {
            fail = celcon_solve_standard_start_system(k,&mvcell);
            printf("The number of solutions : %d\n", mvcell);
            printf("Hit enter to continue.");
            scanf("%c",&ch); /* catch new line symbol */
        }
        {
            int cl[1+r+2*n];
            double inner_normal[n];

            fail = celcon_retrieve_mixed_cell(n,r,k,cl,inner_normal);
            printf("the inner normal for cell %d : \n", k);
            for(i=0; i<n; i++) printf(" %.15le\n", inner_normal[i]);
            printf("total number of points in supports : %d\n",cl[0]);
            printf("number of points in supports : ");
            for(i=1; i<=r; i++) printf(" %d", cl[i]);
            printf("\n");
            printf("labels of points : ");
            kk=r;
            for(i=1; i<=r; i++)
            {
                for(j=0; j<cl[i]; j++) printf(" %d", cl[++kk]);
                printf(" | ");
            }
            printf("\n");
            printf("Hit enter to continue.");
            scanf("%c",&ch); /* catch new line symbol */
        }
    }
    return fail;
}