No. the fix should use the vector of 3 elements and use the proper constructor 
of range class.

Now I am able to receive
but I am trying to understand how the constructor works ...


int send_range(int t_id, MPI_Comm comm, Range range,ColumnVector rankrec, int 
mytag){        /* put base,limit,incr,nelem */
/*-------------------------------*/        /* just 3 doubles + 1 int */
// octave_range (double base, double limit, double inc)
  OCTAVE_LOCAL_BUFFER(int,tanktag,2);
  tanktag[0] = mytag;
  tanktag[1] = mytag+1;
  OCTAVE_LOCAL_BUFFER(double,d,3);
  d[0]= range.base();
  d[1]= range.limit();
  d[2]= range.inc();
  int info;
  for (octave_idx_type  i = 0; i<
 rankrec.nelem(); i++)
  {
    info = MPI_Send(&t_id, 1, MPI_INT, rankrec(i), tanktag[0], comm);
    if (info !=MPI_SUCCESS) return info;
    info = MPI_Send(d, 3, MPI_DOUBLE, rankrec(i), tanktag[1], comm);
    if (info !=MPI_SUCCESS) return info;
  }
   
return(MPI_SUCCESS);
}



int recv_range(MPI_Comm comm, Range &range,int source, int mytag){        /* 
put base,limit,incr,nelem */
/*-------------------------------*/        /* just 3 doubles + 1 int */
// octave_range (double base, double limit, double inc)
  MPI_Status stat;
  OCTAVE_LOCAL_BUFFER(int,tanktag,2);
  tanktag[0] = mytag;
  tanktag[1] = mytag+1;
  OCTAVE_LOCAL_BUFFER(double,d,3);

  // first receive
  int info = MPI_Recv(d, 3,
 MPI_DOUBLE,  source, tanktag[1] , comm,&stat);
  // second put it into the vector
  printf("\n d0 = %f",d[0]);
  printf("\n d1 = %f",d[1]);
  printf("\n d2 = %f",d[2]);
  double b= d[0];
  double l = d[1];
  double i = d[2];
...to be continued

  
  
return(info);
}





      
------------------------------------------------------------------------------

_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to