Yet Another eXchange Tool 0.11.1
Loading...
Searching...
No Matches
xt_idxlist_unpack.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://dkrz-sw.gitlab-pages.dkrz.de/yaxt/
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 "core/core.h"
51#include "xt/xt_mpi.h"
52#include "xt/xt_idxlist.h"
53#include "xt/xt_idxempty.h"
54#include "xt/xt_idxvec.h"
56#include "xt/xt_idxsection.h"
57#include "xt/xt_idxstripes.h"
58#include "xt_idxlist_unpack.h"
59
60
61
62static const char filename[] = "xt_idxlist_unpack.c";
63
64typedef Xt_idxlist (*idxlist_unpack)(void*,int,int*,MPI_Comm);
65
73
74static const unsigned xt_num_unpack_routines
75= sizeof(unpack) / sizeof(unpack[0]);
76
77Xt_idxlist xt_idxlist_unpack(void *buffer, int buffer_size,
78 int *position, MPI_Comm comm) {
79
80 int type;
81 // unpack the type of the index list to be unpacked
82 xt_mpi_call(MPI_Unpack(buffer, buffer_size, position,
83 &type, 1, MPI_INT, comm), comm);
84 if (type >= 0 && (unsigned)type < xt_num_unpack_routines)
85 return unpack[type](buffer, buffer_size, position, comm);
86 Xt_abort(comm, "xt_idxlist_unpack: unknown index list type",
87 filename, __LINE__);
88
89 return NULL;
90}
91
92/*
93 * Local Variables:
94 * c-basic-offset: 2
95 * coding: utf-8
96 * indent-tabs-mode: nil
97 * show-trailing-whitespace: t
98 * require-trailing-newline: t
99 * End:
100 */
int MPI_Comm
Definition core.h:64
struct Xt_idxlist_ * Xt_idxlist
Definition xt_core.h:84
Xt_idxlist xt_idxempty_unpack(void *buffer, int buffer_size, int *position, MPI_Comm comm)
index list declaration
Xt_idxlist xt_idxlist_unpack(void *buffer, int buffer_size, int *position, MPI_Comm comm)
Xt_idxlist xt_idxlist_collection_unpack(void *buffer, int buffer_size, int *position, MPI_Comm comm)
Xt_idxlist(* idxlist_unpack)(void *, int, int *, MPI_Comm)
static const char filename[]
static const idxlist_unpack unpack[]
static const unsigned xt_num_unpack_routines
Xt_idxlist xt_idxsection_unpack(void *buffer, int buffer_size, int *position, MPI_Comm comm)
Xt_idxlist xt_idxstripes_unpack(void *buffer, int buffer_size, int *position, MPI_Comm comm)
Xt_idxlist xt_idxvec_unpack(void *buffer, int buffer_size, int *position, MPI_Comm comm)
Definition xt_idxvec.c:535
utility routines for MPI
#define xt_mpi_call(call, comm)
Definition xt_mpi.h:68