Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' into actor-yield
[simgrid.git] / src / smpi / include / smpi_datatype_derived.hpp
1 /* Copyright (c) 2009-2010, 2012-2017. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #ifndef SMPI_DATATYPE_DERIVED_HPP
8 #define SMPI_DATATYPE_DERIVED_HPP
9
10 #include "smpi_datatype.hpp"
11
12 namespace simgrid{
13 namespace smpi{
14
15 class Type_Contiguous: public Datatype {
16   int block_count_;
17   MPI_Datatype old_type_;
18
19 public:
20   Type_Contiguous(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, MPI_Datatype old_type);
21   ~Type_Contiguous();
22   void serialize(void* noncontiguous, void* contiguous, int count);
23   void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
24 };
25
26 class Type_Hvector: public Datatype{
27   int block_count_;
28   int block_length_;
29   MPI_Aint block_stride_;
30   MPI_Datatype old_type_;
31
32 public:
33   Type_Hvector(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int block_length, MPI_Aint block_stride,
34                MPI_Datatype old_type);
35   ~Type_Hvector();
36   void serialize(void* noncontiguous, void* contiguous, int count);
37   void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
38 };
39
40 class Type_Vector : public Type_Hvector {
41 public:
42   Type_Vector(int size, MPI_Aint lb, MPI_Aint ub, int flags, int count, int blocklen, int stride,
43               MPI_Datatype old_type);
44 };
45
46 class Type_Hindexed: public Datatype{
47   int block_count_;
48   int* block_lengths_;
49   MPI_Aint* block_indices_;
50   MPI_Datatype old_type_;
51
52 public:
53   Type_Hindexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths,
54                 MPI_Aint* block_indices, MPI_Datatype old_type);
55   Type_Hindexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths, int* block_indices,
56                 MPI_Datatype old_type, MPI_Aint factor);
57   ~Type_Hindexed();
58   void serialize(void* noncontiguous, void* contiguous, int count);
59   void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
60 };
61
62 class Type_Indexed : public Type_Hindexed {
63 public:
64   Type_Indexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths, int* block_indices,
65                MPI_Datatype old_type);
66 };
67
68 class Type_Struct: public Datatype{
69   int block_count_;
70   int* block_lengths_;
71   MPI_Aint* block_indices_;
72   MPI_Datatype* old_types_;
73
74 public:
75   Type_Struct(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths,
76               MPI_Aint* block_indices, MPI_Datatype* old_types);
77   ~Type_Struct();
78   void serialize(void* noncontiguous, void* contiguous, int count);
79   void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
80 };
81
82
83 }
84 }
85
86 #endif