| 237 | |
| 238 | } |
| 239 | int FileChannel::recvMatrix(int dbTag, int commitTag, |
| 240 | Matrix &theMatrix, |
| 241 | ChannelAddress *theAddress) |
| 242 | { |
| 243 | // if o.k. get a pointer to the data in the Matrix and |
| 244 | // place the incoming data there |
| 245 | int nleft, rows, cols; |
| 246 | rows = theMatrix.noRows(); |
| 247 | cols = theMatrix.noCols(); |
| 248 | |
| 249 | double *data = new double[rows*cols]; |
| 250 | void *gMsg = (void *)data; |
| 251 | nleft = rows*cols* sizeof(double); |
| 252 | |
| 253 | if ( fread( gMsg, nleft, 1, theFile) != 1 ) { |
| 254 | printf("Error in FileChannel::recvMatrix, did not read\n"); |
| 255 | delete []data; |
| 256 | return -1; |
| 257 | } |
| 258 | |
| 259 | else { |
| 260 | theMatrix.setData(data, rows, cols); |
| 261 | return 0; |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | int FileChannel::sendVector(int dbTag, int commitTag, |
| 266 | const Vector &theVector, ChannelAddress *theAddress ) |