File: block_subs.h

package info (click to toggle)
gmt 4.5.12-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 71,528 kB
  • ctags: 12,619
  • sloc: ansic: 138,042; sh: 4,992; csh: 1,085; makefile: 1,034; asm: 38
file content (97 lines) | stat: -rw-r--r-- 2,847 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*--------------------------------------------------------------------
 *    $Id: block_subs.h 10173 2014-01-01 09:52:34Z pwessel $
 *
 *	Copyright (c) 1991-2014 by P. Wessel and W. H. F. Smith
 *	See LICENSE.TXT file for copying and redistribution conditions.
 *
 *	This program is free software; you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License as published by
 *	the Free Software Foundation; version 2 or any later version.
 *
 *	This program is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU General Public License for more details.
 *
 *	Contact info: gmt.soest.hawaii.edu
 *--------------------------------------------------------------------*/

/* These functions are used in both blockmedian and blockmode and are
 * thus defined in an include file to avoid duplication of code.
 * They are not used anywhere else.  Prototypes are listed in both
 * main programs. [PW, 25-MAR-2006].
 * 64-bit Ready.
 */

/* Function prototypes for comparison functions used by both blockmedian
   and blockmode.
 */

#if defined(BLOCKMEAN)
#define BLOCKMEAN_CTRL BLOCK_CTRL
#elif defined(BLOCKMEDIAN)
#define BLOCKMEDIAN_CTRL BLOCK_CTRL
#else
#define BLOCKMODE_CTRL BLOCK_CTRL
#endif

struct BLOCK_CTRL {	/* All control options for this program (except common args) */
	struct C {	/* -C */
		GMT_LONG active;
	} C;
	struct E {	/* -E */
		GMT_LONG active;
		int mode;	/* Used in blockmedian to select box-and-whisker output (-Eb) */
	} E;
	struct F {	/* -F */
		GMT_LONG active;
	} F;
	struct I {	/* -Idx[/dy] */
		GMT_LONG active;
		double xinc, yinc;
	} I;
#if !defined(BLOCKMEAN)
	struct Q {	/* -Q */
		GMT_LONG active;
	} Q;
#endif
#if defined(BLOCKMEDIAN)
	struct T {	/* -T<quantile> */
		GMT_LONG active;
		double quantile;
	} T;
#endif
	struct S {	/* -S[w|z] */
		GMT_LONG active;
		int mode;
	} S;
	struct W {	/* -W[i][o] */
		GMT_LONG active;
		GMT_LONG weighted[2];
	} W;
};

#if defined(BLOCKMEAN)
void *New_blockmean_Ctrl (), Free_blockmean_Ctrl (struct BLOCKMEAN_CTRL *C);
#elif defined(BLOCKMEDIAN)
void *New_blockmedian_Ctrl (), Free_blockmedian_Ctrl (struct BLOCKMEDIAN_CTRL *C);
#else
void *New_blockmode_Ctrl (), Free_blockmode_Ctrl (struct BLOCKMODE_CTRL *C);
#endif

#define BLK_X	0
#define BLK_Y	1
#if !defined(BLOCKMEAN)
#define BLK_Z	2
#define BLK_W	3
#endif

struct BLK_DATA {
	double	 a[4];	/* a[0] = x, a[1] = y, a[2] = z, a[3] = w  */
	GMT_LONG i;	/* Index to data value */
};

int BLK_compare_x (const void *point_1, const void *point_2);
int BLK_compare_y (const void *point_1, const void *point_2);
int BLK_compare_index_z (const void *point_1, const void *point_2);
int BLK_compare_sub (const void *point_1, const void *point_2, int item);