t8  1.2.0
t8code is a C library to manage a forest of adaptive space-trees of general element classes in parallel.
t8_cmesh_offset.h
Go to the documentation of this file.
1 /*
2  This file is part of t8code.
3  t8code is a C library to manage a collection (a forest) of multiple
4  connected adaptive space-trees of general element classes in parallel.
5 
6  Copyright (C) 2015 the developers
7 
8  t8code is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12 
13  t8code is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with t8code; if not, write to the Free Software Foundation, Inc.,
20  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22 
31 #ifndef T8_CMESH_OFFSET_H
32 #define T8_CMESH_OFFSET_H
33 
34 #include <t8.h>
35 #include <t8_cmesh.h>
36 
37 T8_EXTERN_C_BEGIN ();
38 
46 t8_gloidx_t t8_offset_first (int proc, const t8_gloidx_t *offset);
47 
60  t8_offset_first_tree_to_entry (t8_gloidx_t first_tree, int shared);
61 
68 t8_gloidx_t t8_offset_num_trees (int proc, const t8_gloidx_t *offset);
69 
76 t8_gloidx_t t8_offset_last (int proc, const t8_gloidx_t *offset);
77 
84 int t8_offset_empty (int proc, const t8_gloidx_t *offset);
85 
97 int t8_offset_next_nonempty_rank (int rank, int mpisize,
98  const t8_gloidx_t *offset);
99 
100 #if T8_ENABLE_DEBUG
114 int t8_offset_consistent (int mpisize,
115  const t8_shmem_array_t offset_shmem,
116  t8_gloidx_t num_trees);
117 #endif
118 
127 int t8_offset_in_range (t8_gloidx_t tree_id, int proc,
128  const t8_gloidx_t *offset);
129 
136 int t8_offset_any_owner_of_tree (int mpisize,
137  t8_gloidx_t gtree,
138  const t8_gloidx_t *offset);
139 
153 int t8_offset_first_owner_of_tree (int mpisize,
154  t8_gloidx_t gtree,
155  const t8_gloidx_t *offset,
156  int *some_owner);
157 
171 int t8_offset_last_owner_of_tree (int mpisize,
172  t8_gloidx_t gtree,
173  const t8_gloidx_t *offset,
174  int *some_owner);
175 
186 int t8_offset_next_owner_of_tree (int mpisize,
187  t8_gloidx_t gtree,
188  const t8_gloidx_t *offset,
189  int current_owner);
190 
201 int t8_offset_prev_owner_of_tree (int mpisize,
202  t8_gloidx_t gtree,
203  const t8_gloidx_t *offset,
204  int current_owner);
205 
214 void t8_offset_all_owners_of_tree (int mpisize,
215  t8_gloidx_t gtree,
216  const t8_gloidx_t *offset,
217  sc_array_t *owners);
218 
229 int t8_offset_nosend (int proc, int mpisize,
230  const t8_gloidx_t *offset_from,
231  const t8_gloidx_t *offset_to);
232 
243 int t8_offset_sendsto (int proca, int procb,
244  const t8_gloidx_t *t8_offset_from,
245  const t8_gloidx_t *t8_offset_to);
246 
260 int t8_offset_sendstree (int proc_send, int proc_to,
261  t8_gloidx_t gtree,
262  const t8_gloidx_t *offset_from,
263  const t8_gloidx_t *offset_to);
264 
276 int t8_offset_range_send (int start, int end, int mpirank,
277  const t8_gloidx_t *offset_from,
278  const t8_gloidx_t *offset_to);
279 
284 void t8_offset_print (t8_shmem_array_t offset,
285  sc_MPI_Comm comm);
286 
287 T8_EXTERN_C_END ();
288 
289 #endif /* !T8_CMESH_OFFSET_H */
Shared memory array structure.
Definition: t8_shmem.c:35
This is the administrative header file for t8code.
int64_t t8_gloidx_t
A type for global indexing that holds really big numbers.
Definition: t8.h:105
We define the coarse mesh of trees in this file.
t8_gloidx_t t8_offset_last(int proc, const t8_gloidx_t *offset)
Return the last local tree of a given process in a partition.
Definition: t8_cmesh_offset.c:74
void t8_offset_all_owners_of_tree(int mpisize, t8_gloidx_t gtree, const t8_gloidx_t *offset, sc_array_t *owners)
Compute a list of all processes that own a specific tree.n offset minus 1.
Definition: t8_cmesh_offset.c:342
t8_gloidx_t t8_offset_first(int proc, const t8_gloidx_t *offset)
Return the global id of the first local tree of a given process in a partition.
Definition: t8_cmesh_offset.c:40
int t8_offset_last_owner_of_tree(int mpisize, t8_gloidx_t gtree, const t8_gloidx_t *offset, int *some_owner)
Find the biggest process that has a given tree as local tree.
Definition: t8_cmesh_offset.c:298
int t8_offset_sendstree(int proc_send, int proc_to, t8_gloidx_t gtree, const t8_gloidx_t *offset_from, const t8_gloidx_t *offset_to)
Query whether in a repartitioning setting, a given process sends a given tree to a second process.
Definition: t8_cmesh_offset.c:497
int t8_offset_prev_owner_of_tree(int mpisize, t8_gloidx_t gtree, const t8_gloidx_t *offset, int current_owner)
Given a process current_owner that has the tree gtree as local tree, find the next smaller rank that ...
Definition: t8_cmesh_offset.c:287
int t8_offset_range_send(int start, int end, int mpirank, const t8_gloidx_t *offset_from, const t8_gloidx_t *offset_to)
Count the number of processes in a given range [a,b] that send to a given other process in a repartit...
Definition: t8_cmesh_offset.c:537
int t8_offset_next_nonempty_rank(int rank, int mpisize, const t8_gloidx_t *offset)
Find the next higher rank that is not empty.
Definition: t8_cmesh_offset.c:112
int t8_offset_next_owner_of_tree(int mpisize, t8_gloidx_t gtree, const t8_gloidx_t *offset, int current_owner)
Given a process current_owner that has the tree gtree as local tree, find the next bigger rank that a...
Definition: t8_cmesh_offset.c:275
int t8_offset_nosend(int proc, int mpisize, const t8_gloidx_t *offset_from, const t8_gloidx_t *offset_to)
Query whether in a repartition setting a given process does send any of its local trees to any other ...
Definition: t8_cmesh_offset.c:375
t8_gloidx_t t8_offset_first_tree_to_entry(t8_gloidx_t first_tree, int shared)
Given the global tree id of the first local tree of a process and the flag whether it is shared or no...
Definition: t8_cmesh_offset.c:53
int t8_offset_first_owner_of_tree(int mpisize, t8_gloidx_t gtree, const t8_gloidx_t *offset, int *some_owner)
Find the smallest process that has a given tree as local tree.
Definition: t8_cmesh_offset.c:206
int t8_offset_any_owner_of_tree(int mpisize, t8_gloidx_t gtree, const t8_gloidx_t *offset)
Find any process that has a given tree as local tree.
Definition: t8_cmesh_offset.c:177
void t8_offset_print(t8_shmem_array_t offset, sc_MPI_Comm comm)
Print an offset array.
Definition: t8_cmesh_offset.c:552
t8_gloidx_t t8_offset_num_trees(int proc, const t8_gloidx_t *offset)
The number of trees of a given process in a partition.
Definition: t8_cmesh_offset.c:60
int t8_offset_sendsto(int proca, int procb, const t8_gloidx_t *t8_offset_from, const t8_gloidx_t *t8_offset_to)
Query whether in a repartitioning setting, a given process sends local trees (and then possibly ghost...
Definition: t8_cmesh_offset.c:448
int t8_offset_empty(int proc, const t8_gloidx_t *offset)
Check whether a given process has no local trees in a given partition.
Definition: t8_cmesh_offset.c:97
int t8_offset_in_range(t8_gloidx_t tree_id, int proc, const t8_gloidx_t *offset)
Determine whether a given global tree id is a local tree of a given process in a certain partition.
Definition: t8_cmesh_offset.c:166