Logo AND Algorithmique Numérique Distribuée

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