~ubuntu-branches/ubuntu/utopic/adios/utopic

« back to all changes in this revision

Viewing changes to src/core/util.h

  • Committer: Package Import Robot
  • Author(s): Alastair McKinstry
  • Date: 2013-12-09 15:21:31 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20131209152131-jtd4fpmdv3xnunnm
Tags: 1.5.0-1
* New upstream.
* Standards-Version: 3.9.5
* Include latest config.{sub,guess} 
* New watch file.
* Create libadios-bin for binaries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef UTIL_H_
 
2
#define UTIL_H_
 
3
 
 
4
#include <stdint.h>
 
5
#include "public/adios_types.h"
 
6
#include "public/adios_selection.h"
 
7
 
 
8
typedef struct read_request
 
9
{
 
10
    ADIOS_SELECTION * sel;
 
11
    int varid;
 
12
    int from_steps;
 
13
    int nsteps;
 
14
    void * data;
 
15
    uint64_t datasize; // size of selection to hold data
 
16
// above is the common fields that all read method will use
 
17
    void * priv; // private structure for each read method
 
18
    struct read_request * next;
 
19
} read_request;
 
20
 
 
21
/* Reverse the order in an array in place.
 
22
   use swapping from Fortran/column-major order to ADIOS-read-api/C/row-major order and back
 
23
*/
 
24
void swap_order(int n, uint64_t *array, int *timedim);
 
25
void change_endianness( void *data, uint64_t slice_size, enum ADIOS_DATATYPES type);
 
26
void copy_data (void *dst, void *src,
 
27
                int idim,
 
28
                int ndim,
 
29
                uint64_t* size_in_dset,
 
30
                uint64_t* ldims,
 
31
                const uint64_t * readsize,
 
32
                uint64_t dst_stride,
 
33
                uint64_t src_stride,
 
34
                uint64_t dst_offset,
 
35
                uint64_t src_offset,
 
36
                uint64_t ele_num,
 
37
                int      size_of_type,
 
38
                enum ADIOS_FLAG change_endiness,
 
39
                enum ADIOS_DATATYPES type
 
40
                );
 
41
void alloc_namelist (char ***namelist, int length);
 
42
void free_namelist (char **namelist, int length);
 
43
void list_insert_read_request_tail (read_request ** h, read_request * q);
 
44
void list_insert_read_request_next (read_request ** h, read_request * q);
 
45
void list_append_read_request_list (read_request ** h, read_request * q);
 
46
void list_free_read_request (read_request * h);
 
47
int list_get_length (read_request * h);
 
48
ADIOS_SELECTION * copy_selection (const ADIOS_SELECTION * sel);
 
49
void free_selection (ADIOS_SELECTION * sel);
 
50
 
 
51
/*******************************************************
 
52
   Processing parameter lists
 
53
**********************************************************/
 
54
/*
 
55
   Process a ;-separated and possibly multi-line text and 
 
56
   create a list of name=value pairs from each 
 
57
   item which has a "name=value" pattern. Whitespaces are removed. 
 
58
   Input is not modified. Space is allocated;
 
59
   Also, simple "name" or "name=" patterns are processed and 
 
60
   returned with value=NULL. 
 
61
*/
 
62
struct PairStruct {
 
63
    char * name;
 
64
    char * value;
 
65
    struct PairStruct * next;
 
66
};
 
67
typedef struct PairStruct PairStruct;
 
68
 
 
69
PairStruct * text_to_name_value_pairs (const char * text);
 
70
void free_name_value_pairs (PairStruct * pairs);
 
71
 
 
72
/**********************************************************
 
73
   Timing
 
74
**********************************************************/
 
75
/* sleep for a bit */
 
76
void adios_nanosleep (int sec, int nanosec);
 
77
/* get current time as double (in seconds) */
 
78
double adios_gettime();
 
79
 
 
80
#endif