Yet Another eXchange Tool  0.9.0
xt_xmap.c
Go to the documentation of this file.
1 
12 /*
13  * Keywords:
14  * Maintainer: Jörg Behrens <behrens@dkrz.de>
15  * Moritz Hanke <hanke@dkrz.de>
16  * Thomas Jahns <jahns@dkrz.de>
17  * URL: https://doc.redmine.dkrz.de/yaxt/html/
18  *
19  * Redistribution and use in source and binary forms, with or without
20  * modification, are permitted provided that the following conditions are
21  * met:
22  *
23  * Redistributions of source code must retain the above copyright notice,
24  * this list of conditions and the following disclaimer.
25  *
26  * Redistributions in binary form must reproduce the above copyright
27  * notice, this list of conditions and the following disclaimer in the
28  * documentation and/or other materials provided with the distribution.
29  *
30  * Neither the name of the DKRZ GmbH nor the names of its contributors
31  * may be used to endorse or promote products derived from this software
32  * without specific prior written permission.
33  *
34  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
35  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
36  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
37  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
38  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
39  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
40  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
41  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
42  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
43  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
44  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45  */
46 #ifdef HAVE_CONFIG_H
47 #include <config.h>
48 #endif
49 
50 #include <mpi.h>
51 
52 #include "xt/xt_xmap.h"
53 #include "xt_xmap_internal.h"
54 
56 
57  return xmap->vtable->get_communicator(xmap);
58 }
59 
61 
62  return xmap->vtable->get_num_destinations(xmap);
63 }
64 
66 
67  return xmap->vtable->get_num_sources(xmap);
68 }
69 
70 void xt_xmap_get_destination_ranks(Xt_xmap xmap, int * ranks) {
71 
72  xmap->vtable->get_destination_ranks(xmap, ranks);
73 }
74 
75 void xt_xmap_get_source_ranks(Xt_xmap xmap, int * ranks) {
76 
77  xmap->vtable->get_source_ranks(xmap, ranks);
78 }
79 
81 
82  return xmap->vtable->copy(xmap);
83 }
84 
85 void xt_xmap_delete(Xt_xmap xmap) {
86 
87  xmap->vtable->delete(xmap);
88 }
89 
91 
92  return xmap->vtable->get_in_iterator(xmap);
93 }
94 
96 
97  return xmap->vtable->get_out_iterator(xmap);
98 }
99 
101 
102  return iter->vtable->next(iter);
103 }
104 
106 
107  return iter->vtable->get_rank(iter);
108 }
109 
111 
112  return iter->vtable->get_transfer_pos(iter);
113 }
114 
116 
117  return iter->vtable->get_num_transfer_pos(iter);
118 }
119 
120 const struct Xt_pos_ext *
122  return iter->vtable->get_transfer_pos_ext(iter);
123 }
124 
126  return iter->vtable->get_num_transfer_pos_ext(iter);
127 }
128 
130 
131  iter->vtable->delete(iter);
132 }
133 
135  return xmap->vtable->get_max_src_pos(xmap);
136 }
137 
139  return xmap->vtable->get_max_dst_pos(xmap);
140 }
141 
143  return xmap->vtable->reorder(xmap, type);
144 }
145 
147  Xt_xmap xmap, const int * src_positions, const int * dst_positions) {
148  return xmap->vtable->update_pos(xmap, src_positions, dst_positions);
149 }
150 
151 Xt_xmap xt_xmap_spread(Xt_xmap xmap, int num_repetitions,
152  const int src_displacements[num_repetitions],
153  const int dst_displacements[num_repetitions]) {
154  return
155  xmap->vtable->spread(
156  xmap, num_repetitions, src_displacements, dst_displacements);
157 }
158 
159 /*
160  * Local Variables:
161  * c-basic-offset: 2
162  * coding: utf-8
163  * indent-tabs-mode: nil
164  * show-trailing-whitespace: t
165  * require-trailing-newline: t
166  * End:
167  */
int MPI_Comm
Definition: core.h:64
const struct Xt_xmap_vtable * vtable
const struct Xt_xmap_iter_vtable * vtable
int(* get_num_transfer_pos)(Xt_xmap_iter iter)
int const *(* get_transfer_pos)(Xt_xmap_iter iter)
int(* next)(Xt_xmap_iter iter)
const struct Xt_pos_ext *(* get_transfer_pos_ext)(Xt_xmap_iter iter)
int(* get_rank)(Xt_xmap_iter iter)
int(* get_num_transfer_pos_ext)(Xt_xmap_iter iter)
void(* delete)(Xt_xmap_iter iter)
Xt_xmap(* update_pos)(Xt_xmap xmap, const int *src_positions, const int *dst_positions)
int(* get_num_destinations)(Xt_xmap)
Xt_xmap(* reorder)(Xt_xmap xmap, enum xt_reorder_type type)
void(* delete)(Xt_xmap)
MPI_Comm(* get_communicator)(Xt_xmap)
int(* get_max_dst_pos)(Xt_xmap)
Xt_xmap_iter(* get_out_iterator)(Xt_xmap)
Xt_xmap_iter(* get_in_iterator)(Xt_xmap)
void(* get_source_ranks)(Xt_xmap, int *)
Xt_xmap(* spread)(Xt_xmap xmap, int num_repetitions, const int src_displacements[num_repetitions], const int dst_displacements[num_repetitions])
int(* get_max_src_pos)(Xt_xmap)
Xt_xmap(* copy)(Xt_xmap)
int(* get_num_sources)(Xt_xmap)
void(* get_destination_ranks)(Xt_xmap, int *)
Xt_xmap xt_xmap_update_positions(Xt_xmap xmap, const int *src_positions, const int *dst_positions)
Definition: xt_xmap.c:146
int xt_xmap_iterator_next(Xt_xmap_iter iter)
Definition: xt_xmap.c:100
Xt_xmap xt_xmap_reorder(Xt_xmap xmap, enum xt_reorder_type type)
Definition: xt_xmap.c:142
void xt_xmap_delete(Xt_xmap xmap)
Definition: xt_xmap.c:85
Xt_xmap_iter xt_xmap_get_out_iterator(Xt_xmap xmap)
Definition: xt_xmap.c:95
int xt_xmap_iterator_get_num_transfer_pos_ext(Xt_xmap_iter iter)
Definition: xt_xmap.c:125
Xt_xmap xt_xmap_spread(Xt_xmap xmap, int num_repetitions, const int src_displacements[num_repetitions], const int dst_displacements[num_repetitions])
Definition: xt_xmap.c:151
int const * xt_xmap_iterator_get_transfer_pos(Xt_xmap_iter iter)
Definition: xt_xmap.c:110
void xt_xmap_iterator_delete(Xt_xmap_iter iter)
Definition: xt_xmap.c:129
int xt_xmap_get_num_destinations(Xt_xmap xmap)
Definition: xt_xmap.c:60
Xt_xmap xt_xmap_copy(Xt_xmap xmap)
Definition: xt_xmap.c:80
int xt_xmap_iterator_get_rank(Xt_xmap_iter iter)
Definition: xt_xmap.c:105
int xt_xmap_get_max_dst_pos(Xt_xmap xmap)
Definition: xt_xmap.c:138
int xt_xmap_get_num_sources(Xt_xmap xmap)
Definition: xt_xmap.c:65
void xt_xmap_get_source_ranks(Xt_xmap xmap, int *ranks)
Definition: xt_xmap.c:75
const struct Xt_pos_ext * xt_xmap_iterator_get_transfer_pos_ext(Xt_xmap_iter iter)
Definition: xt_xmap.c:121
Xt_xmap_iter xt_xmap_get_in_iterator(Xt_xmap xmap)
Definition: xt_xmap.c:90
void xt_xmap_get_destination_ranks(Xt_xmap xmap, int *ranks)
Definition: xt_xmap.c:70
MPI_Comm xt_xmap_get_communicator(Xt_xmap xmap)
Definition: xt_xmap.c:55
int xt_xmap_get_max_src_pos(Xt_xmap xmap)
Definition: xt_xmap.c:134
int xt_xmap_iterator_get_num_transfer_pos(Xt_xmap_iter iter)
Definition: xt_xmap.c:115
exchange map declarations
xt_reorder_type
Definition: xt_xmap.h:239
contains declaration for the exchange map data structure