<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
Hello,<br><br>I wonder if i can create a new MPI_DATATYPE for my structure that include an array declared as a pointer: I have the following structures:<br><br><pre>struct elt
{ long ind;
double val;
};
typedef struct elt elt;
</pre><br><pre>struct Fragment
{
int num;
elt *elt;
};
typedef struct Fragment Fragment;<br><br>elt's size is not the same for all Fragment, and i try to send data using MPI_SCATTER, i tried the following code:<br><br>MPI_Datatype MPI_elt;
MPI_Datatype typeelt[2] = {MPI_LONG,MPI_DOUBLE};
int l_bloc[2]={1,1};
MPI_Aint dispo[2];
elt ELT;
MPI_Address(&ELT.ind, dispo);
MPI_Address(&ELT.val, dispo+1);
MPI_Aint base2 = dispo[0];
for (j=0; j <2; j++) dispo[j] -= base2;
MPI_Type_struct(2, l_bloc,dispo,typeelt,&MPI_elt);
MPI_Type_commit(&MPI_elt);
MPI_Datatype MPI_FRAGMENT
MPI_Datatype typeFRAGMENT[2] = {MPI_INT,MPI_AINT};
int l_bloc3[2]={1,1};
MPI_Aint disposition[2];
Fragment FN;
MPI_Address(&FN.num, disposition);
MPI_Address(&FN.elt, disposition+1);
MPI_Aint base3 = disposition[0];
for (j=0; j <2; j++) disposition[j] -= base3;
MPI_Type_struct(2, l_bloc3,disposition, typeFRAGMENT,&MPI_FRAGMENT);
MPI_Type_commit(&MPI_FRAGMENT);
<br>but i don't receive the whole values of elt, any help please?<br><br>Thanks. <br></pre><br>                                            </div></body>
</html>