Exemplo n.º 1
0
/*-------------------------------------------------------------------------
 * xmunmap - xmunmap
 *-------------------------------------------------------------------------
 */
SYSCALL xmunmap(int virtpage )
{
  bs_map_t *temp_bs,*prev_bs;
  int i;
  STATWORD        ps;
  //kprintf("\nCalled XMUNMAP for <%d>",virtpage);
  /* sanity check ! */
  if ( (virtpage < 4096) ){ 
	kprintf("xmummap call error: virtpage (%d) invalid! \n", virtpage);
	return SYSERR;
  }
  disable(ps);
  write_back_data(currpid);

  for(i = 0; i < TOTAL_BS;i++)
  {
     if(bsm_tab[i].bs_status == BSM_UNMAPPED)
        continue;
     temp_bs = &bsm_tab[i];
     while(temp_bs != NULL)
     {
        if(temp_bs->bs_vpno == virtpage)
        {
           /* Write the BS if mapped to the main memory */
           
           if(prev_bs == NULL && temp_bs->next == NULL)
           {
              //write_back_data(currpid,i);
              /* This was the only mapping in the list and hence make the BSM available to use for other process */
              //kprintf("\nOnly Mapping");
              free_frm(i,temp_bs->bs_pid);
              free_bsm(i);
              //temp_bs->bs_status = BSM_UNMAPPED;
           }
           else
           {
              //write_back_data(currpid,i);
              //kprintf("\nRemoiving already mapped ");
              free_frm(i,temp_bs->bs_pid);
              temp_bs->bs_vpno = -1;
              //prev_bs->next = temp_bs->next; /* remove the node from the list as this is no more a valid mapping */
              restore(ps);
              return OK;
           }
        }
        prev_bs = temp_bs;
        temp_bs = temp_bs->next;
     }
  }
  restore(ps);
  return SYSERR;
}
Exemplo n.º 2
0
void RadialInterpolatePoints( const AcGePoint3dArray& datas, AcGePoint3dArray& pts )
{
    MQ<double>          rbf; // RBF as kernel we can use : MQ, IMQ, GAU, TPS, POT
    Polinomio<double>   pol;
    double              c;
    Matrix<double>      A;
    Vector<double>      x, y, f, b, lambda;
    Vector<double>      x_new, y_new, f_new;
    int                 n, m;

    //define the number of nodes
    n = 10;

    //define the shape parameter for MQ kernel
    c = 3.0;

    //make the 2d data, see 2d-comun.hpp
    make_data( datas, x, y, f );
    n = x.GetSize();

    //configure the associate polynomial
    // pol.make( data_dimension, degree_pol)
    pol.make( 2 , rbf.get_degree_pol() );

    //get the number of elements in the polynomial base
    m = pol.get_M();

    //make aditional data for:  Ax=b
    b.Reallocate( n + m );
    b = 0.0;

    //fill the expanded vector b = [f 0]
    for( int i = 0;  i < n;  i++ )
        b( i ) = f( i );

    //fill the Gramm matrix
    fill_gram( rbf, pol, c, x, y, A );

    //solve the linear system by LU factorization
    lambda = gauss( A, b );

    make_data( pts, x_new, y_new, f_new );

    //interpolate the data
    f_new = interpolate( rbf, pol, c, lambda, x, y, x_new, y_new );

    write_back_data( f_new, pts );
}