Next: , Previous: bpipe_iochannel_write, Up: Internal Functions


A.5.21 bpipe_matrix_copy

Copy all or part of an N-dimensional matrix to a destination matrix.

Synopsis

     #include <bpipe/bpipe.h>
     
     
     
int bpipe_matrix_copy( BPDataType type, BPXMap xmap, BPMatrix *src, BPMatrix *dst, BPMatrixMap *map, void *udata, int (*copy)(void *udata,size_t dest,size_t src,size_t nbytes) );

Parameters

BPDataType type
type of a datum
          
          
Possible values for a BPDataType are as follows: BPDType_char, BPDType_double, BPDType_int, BPDType_uint, BPDType_DVector2, BPDType_DVector3, BPDType_IVector2, BPDType_IVector3, BPDType_UIVector2, BPDType_UIVector3, BPDType_DComplex, BPDType_DCVector2, BPDType_DCVector3
BPXMap xmap
what type of mapping
          
          
Possible values for a BPXMap are as follows: BPXMap_Input_to_Core, BPXMap_Core_to_Output, BPXMap_Core_to_Core
BPMatrix *src
description of the source matrix
BPMatrix *dst
description of the destination matrix
BPMatrixMap *map
the mapping from source to destination
void *udata
copy routine specific information
int (*copy)(void *udata,size_t dest,size_t src,size_t nbytes)
this will be called multiple times to copy the chunks of data

Description

This routine analyzes the structure of the matrix (or submatrix) to be copied and the destination matrix to ensure that the largest possible chunks of memory are transferred. It passes information about contigous chunks to a user supplied function, which is responsible for the actual copying operation. The user supplied function is called by bpipe_datatype_copy.

Returns

It returns zero upon success, non-zero otherwise. Upon error bpipe_errno is set.

Errors

Upon error bpipe_errno is set to one of the following errors:

BPEBADARG
the matrix copy request was inconsistent with the sizes of the source and destination matrices or there were non-positive extents.
BPEIOERR
one of the copy operations failed
BPENOMEM
a memory allocation failed