Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fb5922b048bbbfbd862961f4dd9db29bd1ca74a8
[simgrid.git] / src / smpi / include / smpi_datatype_derived.hpp
1 /* Copyright (c) 2009-2020. 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(const Type_Contiguous&) = delete;
22   Type_Contiguous& operator=(const Type_Contiguous&) = delete;
23   ~Type_Contiguous();
24   void serialize(const void* noncontiguous, void* contiguous, int count) override;
25   void unserialize(const void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op) override;
26 };
27
28 class Type_Hvector: public Datatype{
29   int block_count_;
30   int block_length_;
31   MPI_Aint block_stride_;
32   MPI_Datatype old_type_;
33
34 public:
35   Type_Hvector(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int block_length, MPI_Aint block_stride,
36                MPI_Datatype old_type);
37   Type_Hvector(const Type_Hvector&) = delete;
38   Type_Hvector& operator=(const Type_Hvector&) = delete;
39   ~Type_Hvector();
40   void serialize(const void* noncontiguous, void* contiguous, int count) override;
41   void unserialize(const void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op) override;
42 };
43
44 class Type_Vector : public Type_Hvector {
45 public:
46   Type_Vector(int size, MPI_Aint lb, MPI_Aint ub, int flags, int count, int blocklen, int stride,
47               MPI_Datatype old_type);
48 };
49
50 class Type_Hindexed: public Datatype{
51   int block_count_;
52   int* block_lengths_;
53   MPI_Aint* block_indices_;
54   MPI_Datatype old_type_;
55
56 public:
57   Type_Hindexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, const int* block_lengths,
58                 const MPI_Aint* block_indices, MPI_Datatype old_type);
59   Type_Hindexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, const int* block_lengths, const int* block_indices,
60                 MPI_Datatype old_type, MPI_Aint factor);
61   Type_Hindexed(const Type_Hindexed&) = delete;
62   Type_Hindexed& operator=(const Type_Hindexed&) = delete;
63   ~Type_Hindexed();
64   void serialize(const void* noncontiguous, void* contiguous, int count) override;
65   void unserialize(const void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op) override;
66 };
67
68 class Type_Indexed : public Type_Hindexed {
69 public:
70   Type_Indexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, const int* block_lengths, const int* block_indices,
71                MPI_Datatype old_type);
72 };
73
74 class Type_Struct: public Datatype{
75   int block_count_;
76   int* block_lengths_;
77   MPI_Aint* block_indices_;
78   MPI_Datatype* old_types_;
79
80 public:
81   Type_Struct(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, const int* block_lengths,
82               const MPI_Aint* block_indices, const MPI_Datatype* old_types);
83   Type_Struct(const Type_Struct&) = delete;
84   Type_Struct& operator=(const Type_Struct&) = delete;
85   ~Type_Struct();
86   void serialize(const void* noncontiguous, void* contiguous, int count) override;
87   void unserialize(const void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op) override;
88 };
89
90 } // namespace smpi
91 } // namespace simgrid
92
93 #endif