Hi, for several days I am trying to create MPI derived datatype in order to send/receive an user defined object. I'm trying to implement it using MPI::Datatype::Create_struct. I have consulted several threads from the archive
http://www.open-mpi.org/community/lists/users/2012/01/18093.php http://www.open-mpi.org/community/lists/users/2005/08/0123.php http://www.open-mpi.org/community/lists/users/2008/08/6302.php but I'm still havening difficulties to solve this issue. There are some particular features that makes the task more difficult. Let me explain: the obj. that I want to transmit is instantiated from a class called MemberBlock. This class is a template class and contains: dynamic allocating arrays, and objs. instantiated from other classes. Bellow is the class declaration. Therefore how can I construct a MPI dervied data type in this situation? Any suggestions are highly appreciated Thank you, Victor Pomponiu ------------------------------------------------------------------------------------------------------------------------- /** * VecData.h: Interface class for data appearing in vector format. */ # include "DistData.h" //Interface class for data having a pairwise distance measure. class VecData: public DistData { public: // no properties, only public/private methods; ......... } /** * VecDataBlock.h: Base class for storable data having a pairwise * distance measure. */ class VecDataBlock { public: VecData** dataList; // Array of data items for this block. int numItems; // Number of data items assigned to the block. int blockID; // Integer identifier for this block. int sampleID; // The sample identifier for this block int globalOffset; // Index of the first block item relative to the full data set. char* fileNamePrefix; // The file name prefix used for saving data to disk. char commentChar; // The character denoting input comment lines. // methods .......... } /** * MemberBlock.h: Class storing and managing member lists for a given * block of data objects. */ class MemberBlock_base { public: virtual ~MemberBlock_base () {}; }; template <class ScoreType> class MemberBlock: public MemberBlock_base { public: char* fileNamePrefix; // The file name prefix for the block save file. ofstream* saveFile; // refers to an open file currently being used for accumulating VecDataBlock* dataBlock; // The block of data items upon which int globalOffset; // The position of this block with respect to the global ordering. int numItems; // The number of data items assigned to the block. int sampleLevel; // The sample level from which ScoreType** memberScoreLList; // the scores of members associated with // each data the item. int** memberIndexLList; // for each data item a list of global indices of its members. int* memberSizeList; // the number of list members. int memberListBufferSize; // buffer size for storing an individual member list. int saveCount; // Keeps track of the number of member lists saved float* tempDistBuffer; // A temporary buffer for storing distances, used for breaking //methods.... }