GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
fpreclass.c
Go to the documentation of this file.
1 
2 /**********************************************************************
3  *
4  * G_fpreclass_init (r)
5  *
6  * struct FPReclass *r;
7  *
8  * initializes new reclassification structure. calls
9  * G_fpreclass_clear() before it returns.
10  *
11  **********************************************************************
12  *
13  * void
14  * G_fpreclass_reset (r)
15  *
16  * struct FPReclass *r;
17  *
18  * resets the number of defined rules to 0 and free's space allocated
19  * for rules. calls G_fpreclass_clear ().
20  *
21  **********************************************************************
22  *
23  * void
24  * G_fpreclass_clear (r)
25  *
26  * struct FPReclass *r;
27  *
28  * resets the number of defined rules to 0. Resets default Min and Max
29  * to be unknown. (see G_fpreclass_set_domain (), G_fpreclass_set_range ()).
30  * deactivates default mapping.
31  *
32  **********************************************************************
33  *
34  * void
35  * G_fpreclass_set_domain (r, dLow, dHigh)
36  *
37  * struct FPReclass *r;
38  * DCELL dLow, dHigh;
39  *
40  * defines the domain for the default mapping and
41  * activates default mapping. (see G_fpreclass_perform_d ()).
42  *
43  * note: dHigh < dLow is valid.
44  *
45  **********************************************************************
46  *
47  * void
48  * G_fpreclass_set_range (r, low, high)
49  *
50  * struct FPReclass *r;
51  * DCELL low, high;
52  *
53  * defines the range for the default mapping. does NOT
54  * activate default mapping. (see G_fpreclass_perform_d ()).
55  *
56  **********************************************************************
57  *
58  * int
59  * G_fpreclass_get_limits (r, dMin, dMax, rMin, rmax)
60  *
61  * const struct FPReclass *r;
62  * DCELL *dMin, *dMax;
63  * DCELL *rMin, *rmax;
64  *
65  * returns the minimum and maximum values of all the rules defined.
66  *
67  * returns: -1 if after G_fpreclass_init (), or any call to
68  * G_fpreclass_clear () or G_fpreclass_reset () neither
69  * G_fpreclass_add_rule () nor G_fpreclass_set_domain () is
70  * used. in this case the returned minimum and maximum
71  * range and domain values are undefined.
72  * 0 if the default rule values are returned.domain values
73  * are identical to those set with G_fpreclass_set_domain ().
74  * range values are either reclassification internal default,
75  * or the values set with G_fpreclass_set_range ().
76  * 1 otherwise. in this case the values returned correspond
77  * to the extreme values of the defined rules (they need
78  * not be identical to the values set with
79  * G_fpreclass_set_domain ()).
80  *
81  **********************************************************************
82  *
83  * int
84  * G_fpreclass_nof_rules (r)
85  *
86  * const struct FPReclass *r;
87  *
88  * returns the number of reclassification rules defined. This number does
89  * not include the 2 infinite intervals.
90  *
91  **********************************************************************
92  *
93  * void
94  * G_fpreclass_get_ith_rule (r, i, dLow, dHigh, rLow, rHigh)
95  *
96  * const struct FPReclass *r;
97  * int i;
98  * DCELL *dLow, *dHigh;
99  * DCELL *rLow, *rHigh;
100  *
101  * returns the i'th reclassification rule, for
102  * 0 <= i < G_fpreclass_nof_rules().
103  * a larger value for i means that the rule has been added later.
104  *
105  **********************************************************************
106  * void
107  * G_fpreclass_set_neg_infinite_rule (r, dLeft, c)
108  *
109  * struct FPReclass *r;
110  * DCELL dLeft;
111  * DCELL c;
112  *
113  * defines a rule for values "dLeft" and smaller. values in this range
114  * are mapped to "c" if none of the "finite" reclassification rules applies.
115  *
116  * **********************************************************************
117  *
118  * int
119  * G_fpreclass_get_neg_infinite_rule (r, dLeft, c)
120  *
121  * const struct FPReclass *r;
122  * DCELL *dLeft;
123  * DCELL *c;
124  *
125  * returns in "dLeft" and "c" the rule values for the negative infinite
126  * interval (see G_fpreclass_set_neg_infinite_rule ()).
127  *
128  * returns: 0 if this rule is not defined
129  * 1 otherwise.
130  *
131  **********************************************************************
132  * void
133  * G_fpreclass_set_pos_infinite_rule (r, dRight, c)
134  *
135  * struct FPReclass *r;
136  * DCELL dRight;
137  * DCELL c;
138  *
139  * defines a rule for values "dRight" and larger. values in this range
140  * are mapped to "c" if neither any of the "finite" reclassification
141  * rules nor the negative infinite rule applies.
142  *
143  * **********************************************************************
144  *
145  * int
146  * G_fpreclass_get_pos_infinite_rule (r, dRight, c)
147  *
148  * const struct FPReclass *r;
149  * DCELL *dRight;
150  * DCELL *c;
151  *
152  * returns in "dRight" and "c" the rule values for the positive infinite
153  * interval (see G_fpreclass_set_pos_infinite_rule ()).
154  *
155  * returns: 0 if this rule is not defined
156  * 1 otherwise.
157  *
158  **********************************************************************
159  *
160  * void
161  * G_fpreclass_reverse_rule_order (r)
162  *
163  * struct FPReclass *r;
164  *
165  * reverses the order in which the reclassification rules are stored. (see
166  * also G_fpreclass_get_ith_rule () and G_fpreclass_perform_XY ()).
167  *
168  **********************************************************************
169  *
170  * void
171  * G_fpreclass_add_rule (r, dLow, dHigh, rLow, rHigh)
172  *
173  * struct FPReclass *r;
174  * DCELL dLow, dHigh;
175  * DCELL rLow, rHigh;
176  *
177  * adds a new rule to the set of reclassification rules. if dLow > dHigh
178  * the rule will be stored with the low and high values interchanged.
179  *
180  * Note: currently no cleanup of rules is performed, i.e. redundant
181  * rules are not removed.
182  *
183  **********************************************************************
184  *
185  * DCELL
186  * G_fpreclass_get_cell_value (r, cellValue)
187  *
188  * const struct FPReclass *r;
189  * DCELL *cellValue;
190  *
191  * returns the reclassified value corresponding to "cellValue".
192  *
193  * if several reclassification rules apply for cellValue, the one which has
194  * been inserted latest (i.e. the one of them which is returned by
195  * G_fpreclass_get_ith_rule() for the largest i) is used. if no such rule
196  * applies the cellValue is first tested against the negative infinite
197  * rule, and finally against the positive infinite rule. if none of
198  * these rules apply, NO_DATA is returned. the actual value of NO_DATA
199  * is found by calling G_set_d_null_value()
200  *
201  * if after G_fpreclass_init (), or any call to G_fpreclass_clear () or
202  * G_fpreclass_reset () neither G_fpreclass_add_rule (),
203  * G_fpreclass_set_neg_infinite_rule (),
204  * G_fpreclass_set_pos_infinite_rule (), * nor G_fpreclass_set_domain ()
205  * is used NO_DATA is returned independently of the cellValue.
206  *
207  * if G_fpreclass_set_domain () is called but no explicit reclassification
208  * rule is set, the default mapping to the cell range set with
209  * G_fpreclass_set_range () or, if the cell range is not set,
210  * to the default CELL range [0,256 - 1] is applied.
211  *
212  **********************************************************************
213  *
214  * void
215  * G_fpreclass_perform_XY (r, xcell, ycell, n)
216  *
217  * const struct FPReclass *r;
218  * XCELL *xcell;
219  * YCELL *ycell;
220  * int n;
221  *
222  * "X" and "Y" in the function name can be any of "d", "f", or "i". These
223  * correspond to "DCELL", "FCELL", and "CELL", respectively, and denote
224  * the type of the domain and range values.
225  *
226  * returns in "ycell" the reclassified YCELL values corresponding to the
227  * XCELL values stored in "xcell". the number of elements reclassified
228  * is n. reclassification is performed by repeated application of
229  * G_fpreclass_get_cell_value ().
230  *
231  **********************************************************************/
232 
233 /*--------------------------------------------------------------------------*/
234 
235 /*
236  the reclassification table is stored as a linear array. rules are added
237  starting from index 0. redundant rules are not eliminated. rules are tested
238  from the highest index downto 0. there are two "infinite" rules. support is
239  provided to reverse the order of the rules.
240  */
241 
242 /*--------------------------------------------------------------------------*/
243 
244 #include <grass/gis.h>
245 
246 /*--------------------------------------------------------------------------*/
247 
248 #undef MIN
249 #undef MAX
250 #define MIN(a,b) ((a) < (b) ? (a) : (b))
251 #define MAX(a,b) ((a) > (b) ? (a) : (b))
252 
253 #define NO_DEFAULT_RULE (! r->defaultDRuleSet)
254 #define NO_LEFT_INFINITE_RULE (! r->infiniteLeftSet)
255 #define NO_RIGHT_INFINITE_RULE (! r->infiniteRightSet)
256 #define NO_FINITE_RULE (r->nofRules <= 0)
257 #define NO_EXPLICIT_RULE (NO_FINITE_RULE && \
258  NO_LEFT_INFINITE_RULE && NO_RIGHT_INFINITE_RULE)
259 
260 #define DEFAULT_MIN ((DCELL) 1)
261 #define DEFAULT_MAX ((DCELL) 255)
262 
263 /*--------------------------------------------------------------------------*/
264 
265 void G_fpreclass_clear(struct FPReclass *r)
266 {
267  r->nofRules = 0;
268  r->defaultDRuleSet = 0;
269  r->defaultRRuleSet = 0;
270  r->infiniteRightSet = r->infiniteLeftSet = 0;
271 }
272 
273 /*--------------------------------------------------------------------------*/
274 
275 void G_fpreclass_reset(struct FPReclass *r)
276 {
278 
279  if (r->maxNofRules > 0)
280  G_free(r->table);
281 
282  r->maxNofRules = 0;
283 }
284 
285 /*--------------------------------------------------------------------------*/
286 
287 int G_fpreclass_init(struct FPReclass *r)
288 {
289  r->maxNofRules = 0;
291 
292  return 1;
293 }
294 
295 /*--------------------------------------------------------------------------*/
296 
297 void G_fpreclass_set_domain(struct FPReclass *r, DCELL dLow, DCELL dHigh)
298 {
299  r->defaultDMin = dLow;
300  r->defaultDMax = dHigh;
301  r->defaultDRuleSet = 1;
302 }
303 
304 /*--------------------------------------------------------------------------*/
305 
306 void G_fpreclass_set_range(struct FPReclass *r, DCELL low, DCELL high)
307 {
308  r->defaultRMin = low;
309  r->defaultRMax = high;
310  r->defaultRRuleSet = 1;
311 }
312 
313 /*--------------------------------------------------------------------------*/
314 
315 static void
316 fpreclass_set_limits(struct FPReclass *r, DCELL dLow, DCELL dHigh, DCELL rLow,
317  DCELL rHigh)
318 {
319  r->dMin = dLow;
320  r->dMax = dHigh;
321  r->rMin = rLow;
322  r->rMax = rHigh;
323 }
324 
325 /*--------------------------------------------------------------------------*/
326 
327 static void
328 fpreclass_update_limits(struct FPReclass *r, DCELL dLow, DCELL dHigh,
329  DCELL rLow, DCELL rHigh)
330 {
331  if (NO_EXPLICIT_RULE) {
332  fpreclass_set_limits(r, dLow, dHigh, rLow, rHigh);
333  return;
334  }
335 
336  r->dMin = MIN(r->dMin, MIN(dLow, dHigh));
337  r->dMax = MAX(r->dMax, MAX(dLow, dHigh));
338  r->rMin = MIN(r->rMin, MIN(rLow, rHigh));
339  r->rMax = MAX(r->rMax, MAX(rLow, rHigh));
340 }
341 
342 /*--------------------------------------------------------------------------*/
343 
344 int
345 G_fpreclass_get_limits(const struct FPReclass *r, DCELL * dMin, DCELL * dMax,
346  DCELL * rMin, DCELL * rMax)
347 {
348  if (NO_EXPLICIT_RULE) {
349  if (NO_DEFAULT_RULE)
350  return -1;
351 
352  *dMin = r->defaultDMin;
353  *dMax = r->defaultDMax;
354 
355  if (r->defaultRRuleSet) {
356  *rMin = r->defaultRMin;
357  *rMax = r->defaultRMax;
358  }
359  else {
360  *rMin = DEFAULT_MIN;
361  *rMax = DEFAULT_MAX;
362  }
363 
364  return 0;
365  }
366 
367  *dMin = r->dMin;
368  *dMax = r->dMax;
369  *rMin = r->rMin;
370  *rMax = r->rMax;
371 
372  return 1;
373 }
374 
375 /*--------------------------------------------------------------------------*/
376 
377 int G_fpreclass_nof_rules(const struct FPReclass *r)
378 {
379  return r->nofRules;
380 }
381 
382 /*--------------------------------------------------------------------------*/
383 
384 void
385 G_fpreclass_get_ith_rule(const struct FPReclass *r, int i, DCELL * dLow,
386  DCELL * dHigh, DCELL * rLow, DCELL * rHigh)
387 {
388  *dLow = r->table[i].dLow;
389  *dHigh = r->table[i].dHigh;
390  *rLow = r->table[i].rLow;
391  *rHigh = r->table[i].rHigh;
392 }
393 
394 /*--------------------------------------------------------------------------*/
395 
396 static void fpreclass_table_increase(struct FPReclass *r)
397 {
398  if (r->nofRules < r->maxNofRules)
399  return;
400 
401  if (r->maxNofRules == 0) {
402  r->maxNofRules = 50;
403  r->table = (struct FPReclass_table *)
404  G_malloc(r->maxNofRules * sizeof(struct FPReclass_table));
405  }
406  else {
407  r->maxNofRules += 50;
408  r->table = (struct FPReclass_table *)
409  G_realloc((char *)r->table,
410  r->maxNofRules * sizeof(struct FPReclass_table));
411  }
412 }
413 
414 /*--------------------------------------------------------------------------*/
415 
416 void
417 G_fpreclass_set_neg_infinite_rule(struct FPReclass *r, DCELL dLeft, DCELL c)
418 {
419  r->infiniteDLeft = dLeft;
420  r->infiniteRLeft = c;
421  fpreclass_update_limits(r, dLeft, dLeft, c, c);
422  r->infiniteLeftSet = 1;
423 }
424 
425 /*--------------------------------------------------------------------------*/
426 
427 int
428 G_fpreclass_get_neg_infinite_rule(const struct FPReclass *r, DCELL * dLeft,
429  DCELL * c)
430 {
431  if (r->infiniteLeftSet == 0)
432  return 0;
433 
434  *dLeft = r->infiniteDLeft;
435  *c = r->infiniteRLeft;
436 
437  return 1;
438 }
439 
440 /*--------------------------------------------------------------------------*/
441 
442 void
443 G_fpreclass_set_pos_infinite_rule(struct FPReclass *r, DCELL dRight, DCELL c)
444 {
445  r->infiniteDRight = dRight;
446  r->infiniteRRight = c;
447  fpreclass_update_limits(r, dRight, dRight, c, c);
448  r->infiniteRightSet = 1;
449 }
450 
451 /*--------------------------------------------------------------------------*/
452 
453 int
454 G_fpreclass_get_pos_infinite_rule(const struct FPReclass *r, DCELL * dRight,
455  DCELL * c)
456 {
457  if (r->infiniteRightSet == 0)
458  return 0;
459 
460  *dRight = r->infiniteDRight;
461  *c = r->infiniteRRight;
462 
463  return 1;
464 }
465 
466 /*--------------------------------------------------------------------------*/
467 
468 void
469 G_fpreclass_add_rule(struct FPReclass *r, DCELL dLow, DCELL dHigh, DCELL rLow,
470  DCELL rHigh)
471 {
472  int i;
473  struct FPReclass_table *p;
474 
475  fpreclass_table_increase(r);
476 
477  i = r->nofRules;
478 
479  p = &(r->table[i]);
480  if (dHigh >= dLow) {
481  p->dLow = dLow;
482  p->dHigh = dHigh;
483  p->rLow = rLow;
484  p->rHigh = rHigh;
485  }
486  else {
487  p->dLow = dHigh;
488  p->dHigh = dLow;
489  p->rLow = rHigh;
490  p->rHigh = rLow;
491  }
492 
493  fpreclass_update_limits(r, dLow, dHigh, rLow, rHigh);
494 
495  r->nofRules++;
496 }
497 
498 /*--------------------------------------------------------------------------*/
499 
500 void G_fpreclass_reverse_rule_order(struct FPReclass *r)
501 {
502  struct FPReclass_table tmp;
503  struct FPReclass_table *pLeft, *pRight;
504 
505  pLeft = r->table;
506  pRight = &(r->table[r->nofRules - 1]);
507 
508  while (pLeft < pRight) {
509  tmp.dLow = pLeft->dLow;
510  tmp.dHigh = pLeft->dHigh;
511  tmp.rLow = pLeft->rLow;
512  tmp.rHigh = pLeft->rHigh;
513 
514  pLeft->dLow = pRight->dLow;
515  pLeft->dHigh = pRight->dHigh;
516  pLeft->rLow = pRight->rLow;
517  pLeft->rHigh = pRight->rHigh;
518 
519  pRight->dLow = tmp.dLow;
520  pRight->dHigh = tmp.dHigh;
521  pRight->rLow = tmp.rLow;
522  pRight->rHigh = tmp.rHigh;
523 
524  pLeft++;
525  pRight--;
526  }
527 }
528 
529 /*--------------------------------------------------------------------------*/
530 
531 static DCELL
532 fpreclass_interpolate(DCELL dLow, DCELL dHigh, DCELL rLow, DCELL rHigh,
533  DCELL dValue)
534 {
535  if (rLow == rHigh)
536  return rLow;
537  if (dLow == dHigh)
538  return rLow;
539 
540  return ((dValue - dLow) / (dHigh - dLow) * (rHigh - rLow) + rLow);
541 }
542 
543 /*--------------------------------------------------------------------------*/
544 
545 static DCELL
546 fpreclass_get_default_cell_value(const struct FPReclass *r, DCELL cellVal)
547 {
548  DCELL tmp;
549 
550  G_set_d_null_value(&tmp, 1);
551 
552  if ((cellVal < MIN(r->defaultDMin, r->defaultDMax)) ||
553  (cellVal > MAX(r->defaultDMin, r->defaultDMax)))
554  return tmp;
555 
556  if (r->defaultRRuleSet)
557  return fpreclass_interpolate(r->defaultDMin, r->defaultDMax,
558  r->defaultRMin, r->defaultRMax, cellVal);
559  else
560  return fpreclass_interpolate(r->defaultDMin, r->defaultDMax,
561  DEFAULT_MIN, DEFAULT_MAX, cellVal);
562 }
563 
564 /*--------------------------------------------------------------------------*/
565 
566 DCELL G_fpreclass_get_cell_value(const struct FPReclass * r, DCELL cellVal)
567 {
568  DCELL tmp;
569  const struct FPReclass_table *p;
570 
571  G_set_d_null_value(&tmp, 1);
572  if (NO_EXPLICIT_RULE) {
573 
574  if (NO_DEFAULT_RULE)
575  return tmp;
576  return fpreclass_get_default_cell_value(r, cellVal);
577  }
578 
579  if (!NO_FINITE_RULE)
580  for (p = &(r->table[r->nofRules - 1]); p >= r->table; p--)
581  if ((cellVal >= p->dLow) && (cellVal <= p->dHigh))
582  return fpreclass_interpolate(p->dLow, p->dHigh, p->rLow,
583  p->rHigh, cellVal);
584 
585  if ((!NO_LEFT_INFINITE_RULE) && (cellVal <= r->infiniteDLeft))
586  return r->infiniteRLeft;
587 
588  if ((NO_RIGHT_INFINITE_RULE) || (cellVal < r->infiniteDRight))
589  return tmp;
590 
591  return r->infiniteRRight;
592 }
593 
594 /*--------------------------------------------------------------------------*/
595 
596 void
597 G_fpreclass_perform_di(const struct FPReclass *r, const DCELL * dcell,
598  CELL * cell, int n)
599 {
600  int i;
601 
602  for (i = 0; i < n; i++, dcell++)
603  if (!G_is_d_null_value(dcell))
604  *cell++ = G_fpreclass_get_cell_value(r, *dcell);
605  else
606  G_set_c_null_value(cell++, 1);
607 }
608 
609 /*--------------------------------------------------------------------------*/
610 
611 void
612 G_fpreclass_perform_df(const struct FPReclass *r, const DCELL * dcell,
613  FCELL * cell, int n)
614 {
615  int i;
616 
617  for (i = 0; i < n; i++, dcell++)
618  if (!G_is_d_null_value(dcell))
619  *cell++ = G_fpreclass_get_cell_value(r, *dcell);
620  else
621  G_set_f_null_value(cell++, 1);
622 }
623 
624 /*--------------------------------------------------------------------------*/
625 
626 void
627 G_fpreclass_perform_dd(const struct FPReclass *r, const DCELL * dcell,
628  DCELL * cell, int n)
629 {
630  int i;
631 
632  for (i = 0; i < n; i++, dcell++)
633  if (!G_is_d_null_value(dcell))
634  *cell++ = G_fpreclass_get_cell_value(r, *dcell);
635  else
636  G_set_d_null_value(cell++, 1);
637 }
638 
639 /*--------------------------------------------------------------------------*/
640 
641 void
642 G_fpreclass_perform_fi(const struct FPReclass *r, const FCELL * fcell,
643  CELL * cell, int n)
644 {
645  int i;
646 
647  for (i = 0; i < n; i++, fcell++)
648  if (!G_is_f_null_value(fcell))
649  *cell++ = G_fpreclass_get_cell_value(r, (DCELL) * fcell);
650  else
651  G_set_c_null_value(cell++, 1);
652 }
653 
654 /*--------------------------------------------------------------------------*/
655 
656 void
657 G_fpreclass_perform_ff(const struct FPReclass *r, const FCELL * fcell,
658  FCELL * cell, int n)
659 {
660  int i;
661 
662  for (i = 0; i < n; i++, fcell++)
663  if (!G_is_f_null_value(fcell))
664  *cell++ = G_fpreclass_get_cell_value(r, (DCELL) * fcell);
665  else
666  G_set_f_null_value(cell++, 1);
667 }
668 
669 /*--------------------------------------------------------------------------*/
670 
671 void
672 G_fpreclass_perform_fd(const struct FPReclass *r, const FCELL * fcell,
673  DCELL * cell, int n)
674 {
675  int i;
676 
677  for (i = 0; i < n; i++, fcell++)
678  if (!G_is_f_null_value(fcell))
679  *cell++ = G_fpreclass_get_cell_value(r, (DCELL) * fcell);
680  else
681  G_set_d_null_value(cell++, 1);
682 }
683 
684 /*--------------------------------------------------------------------------*/
685 
686 void
687 G_fpreclass_perform_ii(const struct FPReclass *r, const CELL * icell,
688  CELL * cell, int n)
689 {
690  int i;
691 
692  for (i = 0; i < n; i++, icell++)
693  if (!G_is_c_null_value(icell))
694  *cell++ = G_fpreclass_get_cell_value(r, (DCELL) * icell);
695  else
696  G_set_c_null_value(cell++, 1);
697 }
698 
699 /*--------------------------------------------------------------------------*/
700 
701 void
702 G_fpreclass_perform_if(const struct FPReclass *r, const CELL * icell,
703  FCELL * cell, int n)
704 {
705  int i;
706 
707  for (i = 0; i < n; i++, icell++)
708  if (!G_is_c_null_value(icell))
709  *cell++ = G_fpreclass_get_cell_value(r, (DCELL) * icell);
710  else
711  G_set_f_null_value(cell++, 1);
712 }
713 
714 /*--------------------------------------------------------------------------*/
715 
716 void
717 G_fpreclass_perform_id(const struct FPReclass *r, const CELL * icell,
718  DCELL * cell, int n)
719 {
720  int i;
721 
722  for (i = 0; i < n; i++, icell++)
723  if (!G_is_c_null_value(icell))
724  *cell++ = G_fpreclass_get_cell_value(r, (DCELL) * icell);
725  else
726  G_set_d_null_value(cell++, 1);
727 }
728 
729 /*--------------------------------------------------------------------------*/
730 
731 /*--------------------------------------------------------------------------*/
732 
733 /*--------------------------------------------------------------------------*/
#define DEFAULT_MIN
Definition: fpreclass.c:260
int G_is_c_null_value(const CELL *cellVal)
Returns 1 if cell is NULL, 0 otherwise. This will test if the value cell is the largest int...
Definition: null_val.c:244
void G_free(void *buf)
Free allocated memory.
Definition: gis/alloc.c:142
void G_fpreclass_perform_fi(const struct FPReclass *r, const FCELL *fcell, CELL *cell, int n)
Definition: fpreclass.c:642
int G_fpreclass_init(struct FPReclass *r)
Definition: fpreclass.c:287
#define NO_LEFT_INFINITE_RULE
Definition: fpreclass.c:254
void G_fpreclass_add_rule(struct FPReclass *r, DCELL dLow, DCELL dHigh, DCELL rLow, DCELL rHigh)
Definition: fpreclass.c:469
void G_set_d_null_value(DCELL *dcellVals, int numVals)
Definition: null_val.c:176
void G_fpreclass_perform_di(const struct FPReclass *r, const DCELL *dcell, CELL *cell, int n)
Definition: fpreclass.c:597
#define NO_FINITE_RULE
Definition: fpreclass.c:256
void G_fpreclass_perform_id(const struct FPReclass *r, const CELL *icell, DCELL *cell, int n)
Definition: fpreclass.c:717
float r
Definition: named_colr.c:8
#define NO_DEFAULT_RULE
Definition: fpreclass.c:253
void G_fpreclass_set_domain(struct FPReclass *r, DCELL dLow, DCELL dHigh)
Definition: fpreclass.c:297
void G_fpreclass_reset(struct FPReclass *r)
Definition: fpreclass.c:275
void G_fpreclass_perform_if(const struct FPReclass *r, const CELL *icell, FCELL *cell, int n)
Definition: fpreclass.c:702
int G_fpreclass_get_pos_infinite_rule(const struct FPReclass *r, DCELL *dRight, DCELL *c)
Definition: fpreclass.c:454
void G_fpreclass_set_pos_infinite_rule(struct FPReclass *r, DCELL dRight, DCELL c)
Definition: fpreclass.c:443
int G_fpreclass_get_limits(const struct FPReclass *r, DCELL *dMin, DCELL *dMax, DCELL *rMin, DCELL *rMax)
Definition: fpreclass.c:345
int G_is_d_null_value(const DCELL *dcellVal)
Returns 1 if dcell is NULL, 0 otherwise. This will test if the value dcell is a NaN. Same test as in G_is_f_null_value().
Definition: null_val.c:306
int G_is_f_null_value(const FCELL *fcellVal)
Returns 1 if fcell is NULL, 0 otherwise. This will test if the value fcell is a NaN. It isn&#39;t good enough to test for a particular NaN bit pattern since the machine code may change this bit pattern to a different NaN. The test will be.
Definition: null_val.c:281
void G_fpreclass_perform_dd(const struct FPReclass *r, const DCELL *dcell, DCELL *cell, int n)
Definition: fpreclass.c:627
DCELL G_fpreclass_get_cell_value(const struct FPReclass *r, DCELL cellVal)
Definition: fpreclass.c:566
#define MAX(a, b)
Definition: fpreclass.c:251
void G_fpreclass_perform_fd(const struct FPReclass *r, const FCELL *fcell, DCELL *cell, int n)
Definition: fpreclass.c:672
int G_fpreclass_get_neg_infinite_rule(const struct FPReclass *r, DCELL *dLeft, DCELL *c)
Definition: fpreclass.c:428
void G_fpreclass_get_ith_rule(const struct FPReclass *r, int i, DCELL *dLow, DCELL *dHigh, DCELL *rLow, DCELL *rHigh)
Definition: fpreclass.c:385
void G_fpreclass_perform_ii(const struct FPReclass *r, const CELL *icell, CELL *cell, int n)
Definition: fpreclass.c:687
void G_fpreclass_clear(struct FPReclass *r)
Definition: fpreclass.c:265
void G_set_f_null_value(FCELL *fcellVals, int numVals)
Definition: null_val.c:158
#define NO_EXPLICIT_RULE
Definition: fpreclass.c:257
#define DEFAULT_MAX
Definition: fpreclass.c:261
int G_fpreclass_nof_rules(const struct FPReclass *r)
Definition: fpreclass.c:377
void G_fpreclass_set_neg_infinite_rule(struct FPReclass *r, DCELL dLeft, DCELL c)
Definition: fpreclass.c:417
void G_fpreclass_reverse_rule_order(struct FPReclass *r)
Definition: fpreclass.c:500
void G_fpreclass_perform_df(const struct FPReclass *r, const DCELL *dcell, FCELL *cell, int n)
Definition: fpreclass.c:612
#define MIN(a, b)
Definition: fpreclass.c:250
void G_set_c_null_value(CELL *cellVals, int numVals)
Definition: null_val.c:142
void G_fpreclass_perform_ff(const struct FPReclass *r, const FCELL *fcell, FCELL *cell, int n)
Definition: fpreclass.c:657
void G_fpreclass_set_range(struct FPReclass *r, DCELL low, DCELL high)
Definition: fpreclass.c:306
int n
Definition: dataquad.c:291
#define NO_RIGHT_INFINITE_RULE
Definition: fpreclass.c:255