Logo AND Algorithmique Numérique Distribuée

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