Yet Another eXchange Tool 0.11.2
Loading...
Searching...
No Matches
xt_idxvec.c File Reference
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "xt/xt_core.h"
#include "xt/xt_idxlist.h"
#include "xt_idxlist_internal.h"
#include "xt/xt_idxempty.h"
#include "xt/xt_idxvec.h"
#include "xt_idxvec_internal.h"
#include "xt/xt_idxstripes.h"
#include "xt_idxstripes_internal.h"
#include "xt/xt_mpi.h"
#include "xt_idxlist_unpack.h"
#include "core/ppm_xfuncs.h"
#include "core/core.h"
#include "xt_stripe_util.h"
#include "xt/xt_sort.h"
#include "xt_config_internal.h"
#include "instr.h"
Include dependency graph for xt_idxvec.c:

Go to the source code of this file.

Classes

struct  Xt_idxvec_
 
struct  flags_min_max
 

Macros

#define MAX(a, b)
 
#define MIN(a, b)
 

Typedefs

typedef struct Xt_idxvec_Xt_idxvec
 

Enumerations

enum  { pack_header_size = 2 , unpack_header_size = pack_header_size-1 }
 

Functions

static void idxvec_delete (Xt_idxlist data)
 
static size_t idxvec_get_pack_size (Xt_idxlist data, MPI_Comm comm)
 
static void idxvec_pack (Xt_idxlist data, void *buffer, int buffer_size, int *position, MPI_Comm comm)
 
static Xt_idxlist idxvec_copy (Xt_idxlist idxlist)
 
static Xt_idxlist idxvec_sorted_copy (Xt_idxlist idxlist, Xt_config config)
 
static void idxvec_get_indices (Xt_idxlist idxlist, Xt_int *indices)
 
static Xt_int const * idxvec_get_indices_const (Xt_idxlist idxlist)
 
static int idxvec_get_num_index_stripes (Xt_idxlist idxlist)
 
static void idxvec_get_index_stripes (Xt_idxlist idxlist, struct Xt_stripe *stripes, size_t num_stripes_alloc)
 
static int idxvec_get_index_at_position (Xt_idxlist idxlist, int position, Xt_int *index)
 
static int idxvec_get_indices_at_positions (Xt_idxlist idxlist, const int *positions, int num, Xt_int *index, Xt_int undef_idx)
 
static int idxvec_get_position_of_index (Xt_idxlist idxlist, Xt_int index, int *position)
 
static int idxvec_get_position_of_index_off (Xt_idxlist idxlist, Xt_int index, int *position, int offset)
 
static size_t idxvec_get_positions_of_indices (Xt_idxlist idxlist, const Xt_int *indices, size_t num_indices, int *positions, int single_match_only)
 
static Xt_int idxvec_get_min_index (Xt_idxlist idxlist)
 
static Xt_int idxvec_get_max_index (Xt_idxlist idxlist)
 
static int idxvec_get_sorting (Xt_idxlist idxlist)
 
static struct Xt_vec_alloc idxvec_alloc_no_init (int num_indices)
 
static struct Xt_vec_alloc idxvec_alloc (int num_indices)
 
struct Xt_vec_alloc xt_idxvec_alloc (int num_indices)
 
Xt_idxlist xt_idxvec_new (const Xt_int *idxvec, int num_indices)
 
static struct flags_min_max get_sort_flags (size_t num_indices, const Xt_int vector[num_indices])
 
Xt_idxlist xt_idxvec_congeal (struct Xt_vec_alloc vec_alloc)
 
Xt_idxlist xt_idxvec_prealloc_new (const Xt_int *idxvec, int num_indices)
 
static size_t decode_stripe (struct Xt_stripe stripe, Xt_int *sorted_vector, int *sorted_vec_pos, int pos_offset)
 
static void generate_sorted_vector_from_stripes (const struct Xt_stripe stripes[], int num_stripes_, Xt_idxvec idxvec, Xt_config config)
 
Xt_idxlist xt_idxvec_from_stripes_new (const struct Xt_stripe stripes[], int num_stripes)
 
Xt_idxlist xt_idxvec_unpack (void *buffer, int buffer_size, int *position, MPI_Comm comm)
 
static const Xt_intget_sorted_vector (Xt_idxvec idxvec, Xt_config config)
 
PPM_DSO_INTERNAL const Xt_intxt_idxvec_get_sorted_vector (Xt_idxlist idxvec, Xt_config config)
 
Xt_idxlist xt_idxvec_get_intersection (Xt_idxlist idxlist_src, Xt_idxlist idxlist_dst, Xt_config config)
 
PPM_DSO_INTERNAL Xt_idxlist xt_idxvec_get_idxstripes (Xt_idxlist idxlist)
 
PPM_DSO_INTERNAL Xt_idxlist xt_idxvec_get_idxstripes_intersection (Xt_idxlist idxlist_src, Xt_idxlist idxlist_dst, Xt_config config)
 
static int idxvec_get_indices_at_positions (Xt_idxlist idxlist, const int *restrict positions, int num_pos_, Xt_int *index, Xt_int undef_idx)
 
static bool idx_vec_is_sorted (Xt_int const *idx, size_t n)
 

Variables

static const struct xt_idxlist_vtable idxvec_vtable
 
static const char filename [] = "xt_idxvec.c"
 

Detailed Description

Author
Jörg Behrens behre.nosp@m.ns@d.nosp@m.krz.d.nosp@m.e Moritz Hanke hanke.nosp@m.@dkr.nosp@m.z.de Thomas Jahns jahns.nosp@m.@dkr.nosp@m.z.de

Definition in file xt_idxvec.c.

Macro Definition Documentation

◆ MAX

#define MAX ( a,
b )
Value:
(((a)>=(b))?(a):(b))

Definition at line 75 of file xt_idxvec.c.

◆ MIN

#define MIN ( a,
b )
Value:
(((a)<(b))?(a):(b))

Definition at line 76 of file xt_idxvec.c.

Typedef Documentation

◆ Xt_idxvec

typedef struct Xt_idxvec_* Xt_idxvec

Definition at line 161 of file xt_idxvec.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
pack_header_size 
unpack_header_size 

Definition at line 506 of file xt_idxvec.c.

Function Documentation

◆ decode_stripe()

static size_t decode_stripe ( struct Xt_stripe stripe,
Xt_int * sorted_vector,
int * sorted_vec_pos,
int pos_offset )
static

Definition at line 324 of file xt_idxvec.c.

Here is the caller graph for this function:

◆ generate_sorted_vector_from_stripes()

static void generate_sorted_vector_from_stripes ( const struct Xt_stripe stripes[],
int num_stripes_,
Xt_idxvec idxvec,
Xt_config config )
static

Definition at line 347 of file xt_idxvec.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_sort_flags()

static struct flags_min_max get_sort_flags ( size_t num_indices,
const Xt_int vector[num_indices] )
static

Definition at line 258 of file xt_idxvec.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_sorted_vector()

static const Xt_int * get_sorted_vector ( Xt_idxvec idxvec,
Xt_config config )
static

Definition at line 572 of file xt_idxvec.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ idx_vec_is_sorted()

static bool idx_vec_is_sorted ( Xt_int const * idx,
size_t n )
static

Definition at line 946 of file xt_idxvec.c.

Here is the caller graph for this function:

◆ idxvec_alloc()

static struct Xt_vec_alloc idxvec_alloc ( int num_indices)
static

Definition at line 206 of file xt_idxvec.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ idxvec_alloc_no_init()

static struct Xt_vec_alloc idxvec_alloc_no_init ( int num_indices)
static

Definition at line 184 of file xt_idxvec.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ idxvec_copy()

static Xt_idxlist idxvec_copy ( Xt_idxlist idxlist)
static

Definition at line 774 of file xt_idxvec.c.

Here is the call graph for this function:

◆ idxvec_delete()

static void idxvec_delete ( Xt_idxlist data)
static

Definition at line 497 of file xt_idxvec.c.

◆ idxvec_get_index_at_position()

static int idxvec_get_index_at_position ( Xt_idxlist idxlist,
int position,
Xt_int * index )
static

Definition at line 841 of file xt_idxvec.c.

◆ idxvec_get_index_stripes()

static void idxvec_get_index_stripes ( Xt_idxlist idxlist,
struct Xt_stripe * stripes,
size_t num_stripes_alloc )
static

Definition at line 832 of file xt_idxvec.c.

Here is the call graph for this function:

◆ idxvec_get_indices()

static void idxvec_get_indices ( Xt_idxlist idxlist,
Xt_int * indices )
static

Definition at line 807 of file xt_idxvec.c.

◆ idxvec_get_indices_at_positions() [1/2]

static int idxvec_get_indices_at_positions ( Xt_idxlist idxlist,
const int * positions,
int num,
Xt_int * index,
Xt_int undef_idx )
static

◆ idxvec_get_indices_at_positions() [2/2]

static int idxvec_get_indices_at_positions ( Xt_idxlist idxlist,
const int *restrict positions,
int num_pos_,
Xt_int * index,
Xt_int undef_idx )
static

Definition at line 852 of file xt_idxvec.c.

◆ idxvec_get_indices_const()

static Xt_int const * idxvec_get_indices_const ( Xt_idxlist idxlist)
static

Definition at line 814 of file xt_idxvec.c.

◆ idxvec_get_max_index()

static Xt_int idxvec_get_max_index ( Xt_idxlist idxlist)
static

Definition at line 1083 of file xt_idxvec.c.

Here is the caller graph for this function:

◆ idxvec_get_min_index()

static Xt_int idxvec_get_min_index ( Xt_idxlist idxlist)
static

Definition at line 1076 of file xt_idxvec.c.

Here is the caller graph for this function:

◆ idxvec_get_num_index_stripes()

static int idxvec_get_num_index_stripes ( Xt_idxlist idxlist)
static

Definition at line 822 of file xt_idxvec.c.

Here is the call graph for this function:

◆ idxvec_get_pack_size()

static size_t idxvec_get_pack_size ( Xt_idxlist data,
MPI_Comm comm )
static

Definition at line 511 of file xt_idxvec.c.

◆ idxvec_get_position_of_index()

static int idxvec_get_position_of_index ( Xt_idxlist idxlist,
Xt_int index,
int * position )
static

Definition at line 941 of file xt_idxvec.c.

Here is the call graph for this function:

◆ idxvec_get_position_of_index_off()

static int idxvec_get_position_of_index_off ( Xt_idxlist idxlist,
Xt_int index,
int * position,
int offset )
static
Todo
check datatype of variables lb, ub and middle

Definition at line 880 of file xt_idxvec.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ idxvec_get_positions_of_indices()

static size_t idxvec_get_positions_of_indices ( Xt_idxlist idxlist,
const Xt_int * indices,
size_t num_indices,
int * positions,
int single_match_only )
static
Todo
try linear scan of sorted data instead (requires performance test first)

Definition at line 956 of file xt_idxvec.c.

Here is the call graph for this function:

◆ idxvec_get_sorting()

static int idxvec_get_sorting ( Xt_idxlist idxlist)
static

Definition at line 1091 of file xt_idxvec.c.

◆ idxvec_pack()

void idxvec_pack ( Xt_idxlist data,
void * buffer,
int buffer_size,
int * position,
MPI_Comm comm )
static

Definition at line 522 of file xt_idxvec.c.

◆ idxvec_sorted_copy()

static Xt_idxlist idxvec_sorted_copy ( Xt_idxlist idxlist,
Xt_config config )
static

Definition at line 781 of file xt_idxvec.c.

Here is the call graph for this function:

◆ xt_idxvec_alloc()

struct Xt_vec_alloc xt_idxvec_alloc ( int num_indices)

Definition at line 200 of file xt_idxvec.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xt_idxvec_congeal()

Xt_idxlist xt_idxvec_congeal ( struct Xt_vec_alloc vec_alloc)

Definition at line 284 of file xt_idxvec.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xt_idxvec_from_stripes_new()

Xt_idxlist xt_idxvec_from_stripes_new ( const struct Xt_stripe stripes[],
int num_stripes )

Definition at line 470 of file xt_idxvec.c.

Here is the call graph for this function:

◆ xt_idxvec_get_idxstripes()

PPM_DSO_INTERNAL Xt_idxlist xt_idxvec_get_idxstripes ( Xt_idxlist idxlist)

Definition at line 664 of file xt_idxvec.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xt_idxvec_get_idxstripes_intersection()

PPM_DSO_INTERNAL Xt_idxlist xt_idxvec_get_idxstripes_intersection ( Xt_idxlist idxlist_src,
Xt_idxlist idxlist_dst,
Xt_config config )
Todo
:
  1. better estimate of matched indices,
  2. use stride sign to choose search loop

Definition at line 683 of file xt_idxvec.c.

Here is the call graph for this function:

◆ xt_idxvec_get_intersection()

Xt_idxlist xt_idxvec_get_intersection ( Xt_idxlist idxlist_src,
Xt_idxlist idxlist_dst,
Xt_config config )

Definition at line 605 of file xt_idxvec.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xt_idxvec_get_sorted_vector()

PPM_DSO_INTERNAL const Xt_int * xt_idxvec_get_sorted_vector ( Xt_idxlist idxvec,
Xt_config config )

Definition at line 566 of file xt_idxvec.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xt_idxvec_new()

Xt_idxlist xt_idxvec_new ( const Xt_int * idxlist,
int num_indices )

generates a new index list based on an index vector

Parameters
[in]idxlistarray containing the global indices
[in]num_indicesnumber of indices in idxlist
Returns
returns a Xt_idxlist

Definition at line 213 of file xt_idxvec.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xt_idxvec_prealloc_new()

Xt_idxlist xt_idxvec_prealloc_new ( const Xt_int * idxvec,
int num_indices )

Definition at line 308 of file xt_idxvec.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xt_idxvec_unpack()

Xt_idxlist xt_idxvec_unpack ( void * buffer,
int buffer_size,
int * position,
MPI_Comm comm )

Definition at line 536 of file xt_idxvec.c.

Here is the call graph for this function:

Variable Documentation

◆ filename

const char filename[] = "xt_idxvec.c"
static

Definition at line 158 of file xt_idxvec.c.

◆ idxvec_vtable

const struct xt_idxlist_vtable idxvec_vtable
static
Initial value:
= {
.delete = idxvec_delete,
.get_pack_size = idxvec_get_pack_size,
.pack = idxvec_pack,
.copy = idxvec_copy,
.sorted_copy = idxvec_sorted_copy,
.get_indices = idxvec_get_indices,
.get_indices_const = idxvec_get_indices_const,
.get_num_index_stripes = idxvec_get_num_index_stripes,
.get_index_stripes = idxvec_get_index_stripes,
.get_index_at_position = idxvec_get_index_at_position,
.get_indices_at_positions = idxvec_get_indices_at_positions,
.get_position_of_index = idxvec_get_position_of_index,
.get_positions_of_indices = idxvec_get_positions_of_indices,
.get_position_of_index_off = idxvec_get_position_of_index_off,
.get_positions_of_indices_off = NULL,
.get_min_index = idxvec_get_min_index,
.get_max_index = idxvec_get_max_index,
.get_sorting = idxvec_get_sorting,
.get_bounding_box = NULL,
.idxlist_pack_code = VECTOR,
}
@ VECTOR
static Xt_int idxvec_get_min_index(Xt_idxlist idxlist)
Definition xt_idxvec.c:1076
static int idxvec_get_position_of_index(Xt_idxlist idxlist, Xt_int index, int *position)
Definition xt_idxvec.c:941
static void idxvec_delete(Xt_idxlist data)
Definition xt_idxvec.c:497
static void idxvec_get_indices(Xt_idxlist idxlist, Xt_int *indices)
Definition xt_idxvec.c:807
static Xt_idxlist idxvec_copy(Xt_idxlist idxlist)
Definition xt_idxvec.c:774
static int idxvec_get_index_at_position(Xt_idxlist idxlist, int position, Xt_int *index)
Definition xt_idxvec.c:841
static void idxvec_pack(Xt_idxlist data, void *buffer, int buffer_size, int *position, MPI_Comm comm)
Definition xt_idxvec.c:522
static size_t idxvec_get_pack_size(Xt_idxlist data, MPI_Comm comm)
Definition xt_idxvec.c:511
static int idxvec_get_indices_at_positions(Xt_idxlist idxlist, const int *positions, int num, Xt_int *index, Xt_int undef_idx)
static int idxvec_get_sorting(Xt_idxlist idxlist)
Definition xt_idxvec.c:1091
static Xt_idxlist idxvec_sorted_copy(Xt_idxlist idxlist, Xt_config config)
Definition xt_idxvec.c:781
static int idxvec_get_position_of_index_off(Xt_idxlist idxlist, Xt_int index, int *position, int offset)
Definition xt_idxvec.c:880
static void idxvec_get_index_stripes(Xt_idxlist idxlist, struct Xt_stripe *stripes, size_t num_stripes_alloc)
Definition xt_idxvec.c:832
static Xt_int const * idxvec_get_indices_const(Xt_idxlist idxlist)
Definition xt_idxvec.c:814
static Xt_int idxvec_get_max_index(Xt_idxlist idxlist)
Definition xt_idxvec.c:1083
static int idxvec_get_num_index_stripes(Xt_idxlist idxlist)
Definition xt_idxvec.c:822
static size_t idxvec_get_positions_of_indices(Xt_idxlist idxlist, const Xt_int *indices, size_t num_indices, int *positions, int single_match_only)
Definition xt_idxvec.c:956

Definition at line 135 of file xt_idxvec.c.