Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: [OMPI users] MPI_Type_struct for template class with dynamic arrays and objs. instantiated from other classes
From: Victor Pomponiu (victor.pomponiu_at_[hidden])
Date: 2012-01-18 00:36:26


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
I have consulted several threads from the archive

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 {

// no properties, only public/private methods;

 * VecDataBlock.h: Base class for storable data having a pairwise
 * distance measure.

class VecDataBlock {

  VecData** dataList; // Array of data items for this
  int numItems; // Number of data items assigned to the
  int blockID; // Integer identifier for this block.
  int sampleID; // The sample identifier for this
  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 {
  virtual ~MemberBlock_base () {};

template <class ScoreType>
class MemberBlock: public MemberBlock_base {

  char* fileNamePrefix; // The file name prefix for the block save
  ofstream* saveFile; // refers to an open file currently being
used for accumulating
  VecDataBlock* dataBlock; // The block of data items upon
  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
  ScoreType** memberScoreLList; // the scores of members associated with
                                                   // each data the
  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