Yet Another eXchange Tool 0.11.2
Loading...
Searching...
No Matches
xt_sort.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 "xt/xt_sort.h"
51#include "xt_sort_internal.h"
52
53void (*xt_sort_int)(int *a, size_t n)
55void (*xt_sort_xt_int)(Xt_int *a, size_t n)
57void (*xt_sort_index)(Xt_int *restrict a, int n, int *restrict idx,
58 int reset_index)
61void (*xt_sort_xt_int_permutation)(Xt_int a[], size_t n, int permutation[])
63void (*xt_sort_int_permutation)(int a[], size_t n, int permutation[])
65
66/*
67 * void xt_sort_init(void) {
68 *
69 * //! \todo getenv: key = XT_SORT_METHOD, possible values: { QUICKSORT, MERGESORT }; we might accept uppercase and lowercase values
70 *
71 * /\* xt_sort_index = ; *\/
72 * /\* xt_sort_idxpos = ; *\/
73 * }
74 */
75
76void
77xt_assign_id_map_int(size_t n, int *restrict a, int ofs)
78{
79 for(size_t i = 0; i < n; i++)
80 a[i] = (int)i + ofs;
81}
82
83
84
85/*
86 * Local Variables:
87 * c-basic-offset: 2
88 * coding: utf-8
89 * indent-tabs-mode: nil
90 * show-trailing-whitespace: t
91 * require-trailing-newline: t
92 * End:
93 */
void xt_mergesort_index(Xt_int *restrict v_idx, int n, int *restrict v_pos, int reset_pos)
Definition mergesort.c:69
void xt_mergesort_xt_int_permutation(Xt_int *a, size_t n, int *restrict permutation)
void xt_mergesort_idxpos(idxpos_type *v, size_t n)
void xt_mergesort_int_permutation(int *a, size_t n, int *permutation)
void xt_mergesort_int(int a[], size_t n)
void xt_mergesort_xt_int(Xt_int a[], size_t n)
struct idxpos_struct idxpos_type
XT_INT Xt_int
Definition xt_core.h:72
void xt_assign_id_map_int(size_t n, int *restrict a, int ofs)
Definition xt_sort.c:77
void(* xt_sort_idxpos)(idxpos_type *v, size_t n)
Definition xt_sort.c:60
void(* xt_sort_int)(int *a, size_t n)
Definition xt_sort.c:53
void(* xt_sort_xt_int_permutation)(Xt_int *restrict a, size_t n, int *restrict permutation)
void(* xt_sort_xt_int)(Xt_int *a, size_t n)
Definition xt_sort.c:55
void(* xt_sort_int_permutation)(int *restrict a, size_t n, int *restrict permutation)
void(* xt_sort_index)(Xt_int *restrict a, int n, int *restrict idx, int reset_index)
Definition xt_sort.c:57