0

I have a structure :

    struct vertex
    {
     double a; double b;
    }

    struct polygon
    {
     int numofVertex;
     vertex v[10];
    }

How to send this nested structure in MPI using MPI_Send?

1 Answer 1

0

Since your structure does not contain any pointers, it's easily possible.

MPI_Send(ptr_to_your_struct, sizeof(struct polygon), MPI_BYTES, ...);
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the solution, I think the sent structure can be easily accessed by MPI_Recv(ptr_to_struct, sizeof(struct polygon), MPI_BYTES, ...);
Can you provide some insight when the structure contains pointer fields. Moreover, I have asked this problem as a new question. stackoverflow.com/questions/5972018/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.