GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
N_gradient.c
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * MODULE: Grass PDE Numerical Library
5 * AUTHOR(S): Soeren Gebbert, Berlin (GER) Dec 2006
6 * soerengebbert <at> gmx <dot> de
7 *
8 * PURPOSE: gradient management functions
9 * part of the gpde library
10 *
11 * COPYRIGHT: (C) 2000 by the GRASS Development Team
12 *
13 * This program is free software under the GNU General Public
14 * License (>=v2). Read the file COPYING that comes with GRASS
15 * for details.
16 *
17 *****************************************************************************/
18 
19 #include <grass/N_pde.h>
20 
28 {
29  N_gradient_2d *grad;
30 
31  grad = (N_gradient_2d *) G_calloc(1, sizeof(N_gradient_2d));
32 
33  return grad;
34 }
35 
43 {
44  G_free(grad);
45  grad = NULL;
46 
47  return;
48 }
49 
60 N_gradient_2d *N_create_gradient_2d(double NC, double SC, double WC,
61  double EC)
62 {
63  N_gradient_2d *grad;
64 
65  G_debug(5, "N_create_gradient_2d: create N_gradient_2d");
66 
67  grad = N_alloc_gradient_2d();
68 
69  grad->NC = NC;
70  grad->SC = SC;
71  grad->WC = WC;
72  grad->EC = EC;
73 
74  return grad;
75 }
76 
86 {
87  G_debug(5, "N_copy_gradient_2d: copy N_gradient_2d");
88 
89  if (!source || !target)
90  return 0;
91 
92  target->NC = source->NC;
93  target->SC = source->SC;
94  target->WC = source->WC;
95  target->EC = source->EC;
96 
97  return 1;
98 }
99 
116  N_gradient_2d * gradient, int col, int row)
117 {
118  double NC = 0, SC = 0, WC = 0, EC = 0;
119 
120  N_gradient_2d *grad = gradient;
121 
122 
123  NC = N_get_array_2d_d_value(field->y_array, col, row);
124  SC = N_get_array_2d_d_value(field->y_array, col, row + 1);
125  WC = N_get_array_2d_d_value(field->x_array, col, row);
126  EC = N_get_array_2d_d_value(field->x_array, col + 1, row);
127 
128  G_debug(5,
129  "N_get_gradient_2d: calculate N_gradient_2d NC %g SC %g WC %g EC %g",
130  NC, SC, WC, EC);
131 
132  /*if gradient is a NULL pointer, create a new one */
133  if (!grad) {
134  grad = N_create_gradient_2d(NC, SC, WC, EC);
135  }
136  else {
137  grad->NC = NC;
138  grad->SC = SC;
139  grad->WC = WC;
140  grad->EC = EC;
141  }
142 
143  return grad;
144 }
145 
153 {
154  N_gradient_3d *grad;
155 
156  grad = (N_gradient_3d *) G_calloc(1, sizeof(N_gradient_3d));
157 
158  return grad;
159 }
160 
168 {
169  G_free(grad);
170  grad = NULL;
171 
172  return;
173 }
174 
175 
188 N_gradient_3d *N_create_gradient_3d(double NC, double SC, double WC,
189  double EC, double TC, double BC)
190 {
191  N_gradient_3d *grad;
192 
193  G_debug(5, "N_create_gradient_3d: create N_gradient_3d");
194 
195  grad = N_alloc_gradient_3d();
196 
197  grad->NC = NC;
198  grad->SC = SC;
199  grad->WC = WC;
200  grad->EC = EC;
201  grad->TC = TC;
202  grad->BC = BC;
203 
204  return grad;
205 }
206 
216 {
217  G_debug(5, "N_copy_gradient_3d: copy N_gradient_3d");
218 
219  if (!source || !target)
220  return 0;
221 
222  target->NC = source->NC;
223  target->SC = source->SC;
224  target->WC = source->WC;
225  target->EC = source->EC;
226  target->TC = source->TC;
227  target->BC = source->BC;
228 
229  return 1;
230 }
231 
232 
250  N_gradient_3d * gradient, int col, int row,
251  int depth)
252 {
253  double NC, SC, WC, EC, TC, BC;
254 
255  N_gradient_3d *grad = gradient;
256 
257  NC = N_get_array_3d_d_value(field->y_array, col, row, depth);
258  SC = N_get_array_3d_d_value(field->y_array, col, row + 1, depth);
259  WC = N_get_array_3d_d_value(field->x_array, col, row, depth);
260  EC = N_get_array_3d_d_value(field->x_array, col + 1, row, depth);
261  BC = N_get_array_3d_d_value(field->z_array, col, row, depth);
262  TC = N_get_array_3d_d_value(field->z_array, col, row, depth + 1);
263 
264  G_debug(6,
265  "N_get_gradient_3d: calculate N_gradient_3d NC %g SC %g WC %g EC %g TC %g BC %g",
266  NC, SC, WC, EC, TC, BC);
267 
268  /*if gradient is a NULL pointer, create a new one */
269  if (!grad) {
270  grad = N_create_gradient_3d(NC, SC, WC, EC, TC, BC);
271  }
272  else {
273  grad->NC = NC;
274  grad->SC = SC;
275  grad->WC = WC;
276  grad->EC = EC;
277  grad->BC = BC;
278  grad->TC = TC;
279  }
280 
281  return grad;
282 }
283 
293 {
295 
296  grad =
297  (N_gradient_neighbours_x *) G_calloc(1,
298  sizeof(N_gradient_neighbours_x));
299 
300  return grad;
301 }
302 
310 {
311  G_free(grad);
312  grad = NULL;
313 
314  return;
315 }
316 
317 
332  double NEN, double WC,
333  double EC, double SWS,
334  double SES)
335 {
337 
338  G_debug(6,
339  "N_create_gradient_neighbours_x: create N_gradient_neighbours_x");
340 
342 
343  grad->NWN = NWN;
344  grad->NEN = NEN;
345  grad->WC = WC;
346  grad->EC = EC;
347  grad->SWS = SWS;
348  grad->SES = SES;
349 
350  return grad;
351 }
352 
361 int
363  N_gradient_neighbours_x * target)
364 {
365  G_debug(6, "N_copy_gradient_neighbours_x: copy N_gradient_neighbours_x");
366 
367  if (!source || !target)
368  return 0;
369 
370  target->NWN = source->NWN;
371  target->NEN = source->NEN;
372  target->WC = source->WC;
373  target->EC = source->EC;
374  target->SWS = source->SWS;
375  target->SES = source->SES;
376 
377  return 1;
378 }
379 
389 {
391 
392  grad =
393  (N_gradient_neighbours_y *) G_calloc(1,
394  sizeof(N_gradient_neighbours_y));
395 
396  return grad;
397 }
398 
406 {
407  G_free(grad);
408  grad = NULL;
409 
410  return;
411 }
412 
427  double NEE, double NC,
428  double SC, double SWW,
429  double SEE)
430 {
432 
433  G_debug(6,
434  "N_create_gradient_neighbours_y: create N_gradient_neighbours_y");
435 
437 
438  grad->NWW = NWW;
439  grad->NEE = NEE;
440  grad->NC = NC;
441  grad->SC = SC;
442  grad->SWW = SWW;
443  grad->SEE = SEE;
444 
445  return grad;
446 }
447 
456 int
458  N_gradient_neighbours_y * target)
459 {
460  G_debug(6, "N_copy_gradient_neighbours_y: copy N_gradient_neighbours_y");
461 
462  if (!source || !target)
463  return 0;
464 
465  target->NWW = source->NWW;
466  target->NEE = source->NEE;
467  target->NC = source->NC;
468  target->SC = source->SC;
469  target->SWW = source->SWW;
470  target->SEE = source->SEE;
471 
472  return 1;
473 }
474 
484 {
486 
487  grad =
488  (N_gradient_neighbours_z *) G_calloc(1,
489  sizeof(N_gradient_neighbours_z));
490 
491  return grad;
492 }
493 
501 {
502  G_free(grad);
503  grad = NULL;
504 
505  return;
506 }
507 
525  double NEZ, double WZ,
526  double CZ, double EZ,
527  double SWZ, double SZ,
528  double SEZ)
529 {
531 
532  G_debug(6,
533  "N_create_gradient_neighbours_z: create N_gradient_neighbours_z");
534 
536 
537  grad->NWZ = NWZ;
538  grad->NZ = NZ;
539  grad->NEZ = NEZ;
540  grad->WZ = WZ;
541  grad->CZ = CZ;
542  grad->EZ = EZ;
543  grad->SWZ = SWZ;
544  grad->SZ = SZ;
545  grad->SEZ = SEZ;
546 
547  return grad;
548 }
549 
558 int
560  N_gradient_neighbours_z * target)
561 {
562  G_debug(6, "N_copy_gradient_neighbours_z: copy N_gradient_neighbours_z");
563 
564  if (!source || !target)
565  return 0;
566 
567  target->NWZ = source->NWZ;
568  target->NZ = source->NZ;
569  target->NEZ = source->NEZ;
570  target->WZ = source->WZ;
571  target->CZ = source->CZ;
572  target->EZ = source->EZ;
573  target->SWZ = source->SWZ;
574  target->SZ = source->SZ;
575  target->SEZ = source->SEZ;
576 
577  return 1;
578 }
579 
590 {
592 
593  grad =
594  (N_gradient_neighbours_2d *) G_calloc(1,
595  sizeof
597 
600 
601  return grad;
602 }
603 
611 {
612 
615 
616  G_free(grad);
617  grad = NULL;
618 
619  return;
620 }
621 
634 {
636 
637  int fail = 0;
638 
639  G_debug(5,
640  "N_create_gradient_neighbours_2d: create N_gradient_neighbours_2d");
641 
643 
644  if (!N_copy_gradient_neighbours_x(x, grad->x))
645  fail++;
646  if (!N_copy_gradient_neighbours_y(y, grad->y))
647  fail++;
648 
649  if (fail > 0) {
651  grad = NULL;
652  }
653 
654  return grad;
655 }
656 
665 int
667  N_gradient_neighbours_2d * target)
668 {
669  int fail = 0;
670 
671  G_debug(5,
672  "N_copy_gradient_neighbours_2d: copy N_gradient_neighbours_2d");
673 
674  if (!source || !target)
675  return 0;
676 
677  if (!(N_copy_gradient_neighbours_x(source->x, target->x)))
678  fail++;
679  if (!(N_copy_gradient_neighbours_y(source->y, target->y)))
680  fail++;
681 
682  if (fail > 0) {
683  return 0;
684  }
685 
686  return 1;
687 }
688 
706  field,
708  * gradient, int col,
709  int row)
710 {
711  double NWN, NEN, WC, EC, SWS, SES;
712 
713  double NWW, NEE, NC, SC, SWW, SEE;
714 
716 
717  N_gradient_neighbours_x *grad_x = NULL;
718 
719  N_gradient_neighbours_y *grad_y = NULL;
720 
721 
722  NWN = N_get_array_2d_d_value(field->x_array, col, row - 1);
723  NEN = N_get_array_2d_d_value(field->x_array, col + 1, row - 1);
724  WC = N_get_array_2d_d_value(field->x_array, col, row);
725  EC = N_get_array_2d_d_value(field->x_array, col + 1, row);
726  SWS = N_get_array_2d_d_value(field->x_array, col, row + 1);
727  SES = N_get_array_2d_d_value(field->x_array, col + 1, row + 1);
728 
729  NWW = N_get_array_2d_d_value(field->y_array, col - 1, row);
730  NEE = N_get_array_2d_d_value(field->y_array, col + 1, row);
731  NC = N_get_array_2d_d_value(field->y_array, col, row);
732  SC = N_get_array_2d_d_value(field->y_array, col, row + 1);
733  SWW = N_get_array_2d_d_value(field->y_array, col - 1, row + 1);
734  SEE = N_get_array_2d_d_value(field->y_array, col + 1, row + 1);
735 
736 
737  grad_x = N_create_gradient_neighbours_x(NWN, NEN, WC, EC, SWS, SES);
738  grad_y = N_create_gradient_neighbours_y(NWW, NEE, NC, SC, SWW, SEE);
739 
740  G_debug(5,
741  "N_get_gradient_neighbours_2d: calculate N_gradient_neighbours_x NWN %g NEN %g WC %g EC %g SWS %g SES %g",
742  NWN, NEN, WC, EC, SWS, SES);
743 
744  G_debug(5,
745  "N_get_gradient_neighbours_2d: calculate N_gradient_neighbours_y NWW %g NEE %g NC %g SC %g SWW %g SEE %g",
746  NWW, NEE, NC, SC, SWW, SEE);
747 
748 
749  /*if gradient is a NULL pointer, create a new one */
750  if (!gradient) {
751  grad = N_create_gradient_neighbours_2d(grad_x, grad_y);
752  gradient = grad;
753  }
754  else {
755  grad = N_create_gradient_neighbours_2d(grad_x, grad_y);
756  N_copy_gradient_neighbours_2d(grad, gradient);
758  }
759 
762 
763  return gradient;
764 }
765 
766 
777 {
779 
780  grad =
781  (N_gradient_neighbours_3d *) G_calloc(1,
782  sizeof
784 
793 
794  return grad;
795 }
796 
804 {
805 
814 
815  G_free(grad);
816  grad = NULL;
817 
818  return;
819 }
820 
840 {
842 
843  int fail = 0;
844 
845  G_debug(5,
846  "N_create_gradient_neighbours_3d: create N_gradient_neighbours_3d");
847 
849 
850  if (!(N_copy_gradient_neighbours_x(xt, grad->xt)))
851  fail++;
852  if (!(N_copy_gradient_neighbours_x(xc, grad->xc)))
853  fail++;
854  if (!(N_copy_gradient_neighbours_x(xb, grad->xb)))
855  fail++;
856  if (!(N_copy_gradient_neighbours_y(yt, grad->yt)))
857  fail++;
858  if (!(N_copy_gradient_neighbours_y(yc, grad->yc)))
859  fail++;
860  if (!(N_copy_gradient_neighbours_y(yb, grad->yb)))
861  fail++;
862  if (!(N_copy_gradient_neighbours_z(zt, grad->zt)))
863  fail++;
864  if (!(N_copy_gradient_neighbours_z(zb, grad->zb)))
865  fail++;
866 
867  if (fail > 0) {
868  return NULL;
869  }
870 
871  return grad;
872 }
873 
882 int
884  N_gradient_neighbours_3d * target)
885 {
886  int fail = 0;
887 
888  G_debug(5,
889  "N_copy_gradient_neighbours_3d: copy N_gradient_neighbours_3d");
890 
891  if (!source || !target)
892  return 0;
893 
894  if (!(N_copy_gradient_neighbours_x(source->xt, target->xt)))
895  fail++;
896  if (!(N_copy_gradient_neighbours_x(source->xc, target->xc)))
897  fail++;
898  if (!(N_copy_gradient_neighbours_x(source->xb, target->xb)))
899  fail++;
900  if (!(N_copy_gradient_neighbours_y(source->yt, target->yt)))
901  fail++;
902  if (!(N_copy_gradient_neighbours_y(source->yc, target->yc)))
903  fail++;
904  if (!(N_copy_gradient_neighbours_y(source->yb, target->yb)))
905  fail++;
906  if (!(N_copy_gradient_neighbours_z(source->zt, target->zt)))
907  fail++;
908  if (!(N_copy_gradient_neighbours_z(source->zb, target->zb)))
909  fail++;
910 
911  if (fail > 0) {
912  return 0;
913  }
914 
915  return 1;
916 }
917 
929 {
930  N_gradient_field_2d *field;
931 
932  G_debug(5,
933  "N_alloc_gradient_field_2d: allocate a N_gradient_field_2d struct");
934 
935  field = (N_gradient_field_2d *) G_calloc(1, sizeof(N_gradient_field_2d));
936 
937  field->x_array = N_alloc_array_2d(cols, rows, 1, DCELL_TYPE);
938  field->y_array = N_alloc_array_2d(cols, rows, 1, DCELL_TYPE);
939 
940  field->cols = cols;
941  field->rows = rows;
942 
943  return field;
944 }
945 
953 {
954 
955  N_free_array_2d(field->x_array);
956  N_free_array_2d(field->y_array);
957 
958  G_free(field);
959 
960  field = NULL;
961 
962  return;
963 }
964 
973 int
975  N_gradient_field_2d * target)
976 {
977  G_debug(3, "N_copy_gradient_field_2d: copy N_gradient_field_2d");
978 
979  if (!source || !target)
980  return 0;
981 
982  N_copy_array_2d(source->x_array, target->x_array);
983  N_copy_array_2d(source->y_array, target->y_array);
984 
985  return 1;
986 }
987 
995 {
996  fprintf(stdout, "N_gradient_field_2d \n");
997  fprintf(stdout, "Cols %i\n", field->cols);
998  fprintf(stdout, "Rows: %i\n", field->rows);
999  fprintf(stdout, "X array pointer: %p\n", field->x_array);
1000  fprintf(stdout, "Y array pointer: %p\n", field->y_array);
1001  fprintf(stdout, "Min %g\n", field->min);
1002  fprintf(stdout, "Max %g\n", field->max);
1003  fprintf(stdout, "Sum %g\n", field->sum);
1004  fprintf(stdout, "Mean %g\n", field->mean);
1005  fprintf(stdout, "Nonull %i\n", field->nonull);
1006  fprintf(stdout, "X array info \n");
1008  fprintf(stdout, "Y array info \n");
1010 
1011  return;
1012 }
1013 
1014 
1027 {
1028  N_gradient_field_3d *field;
1029 
1030  G_debug(5,
1031  "N_alloc_gradient_field_3d: allocate a N_gradient_field_3d struct");
1032 
1033  field = (N_gradient_field_3d *) G_calloc(1, sizeof(N_gradient_field_3d));
1034 
1035  field->x_array = N_alloc_array_3d(cols, rows, depths, 1, DCELL_TYPE);
1036  field->y_array = N_alloc_array_3d(cols, rows, depths, 1, DCELL_TYPE);
1037  field->z_array = N_alloc_array_3d(cols, rows, depths, 1, DCELL_TYPE);
1038 
1039  field->cols = cols;
1040  field->rows = rows;
1041  field->depths = depths;
1042 
1043  return field;
1044 }
1045 
1046 
1054 {
1055 
1056  N_free_array_3d(field->x_array);
1057  N_free_array_3d(field->y_array);
1058  N_free_array_3d(field->z_array);
1059 
1060  G_free(field);
1061 
1062  field = NULL;
1063 
1064  return;
1065 }
1066 
1067 
1076 int
1078  N_gradient_field_3d * target)
1079 {
1080  G_debug(3, "N_copy_gradient_field_3d: copy N_gradient_field_3d");
1081 
1082  if (!source || !target)
1083  return 0;
1084 
1085  N_copy_array_3d(source->x_array, target->x_array);
1086  N_copy_array_3d(source->y_array, target->y_array);
1087  N_copy_array_3d(source->z_array, target->z_array);
1088 
1089  return 1;
1090 }
1091 
1099 {
1100 
1101  fprintf(stdout, "N_gradient_field_3d \n");
1102  fprintf(stdout, "Cols %i\n", field->cols);
1103  fprintf(stdout, "Rows: %i\n", field->rows);
1104  fprintf(stdout, "Depths %i\n", field->depths);
1105  fprintf(stdout, "X array pointer: %p\n", field->x_array);
1106  fprintf(stdout, "Y array pointer: %p\n", field->y_array);
1107  fprintf(stdout, "Z array pointer: %p\n", field->z_array);
1108  fprintf(stdout, "Min %g\n", field->min);
1109  fprintf(stdout, "Max %g\n", field->max);
1110  fprintf(stdout, "Sum %g\n", field->sum);
1111  fprintf(stdout, "Mean %g\n", field->mean);
1112  fprintf(stdout, "Nonull %i\n", field->nonull);
1113  fprintf(stdout, "X array info \n");
1115  fprintf(stdout, "Y array info \n");
1117  fprintf(stdout, "Z array info \n");
1119 
1120  return;
1121 }
void N_free_array_2d(N_array_2d *data)
Release the memory of a N_array_2d structure.
Definition: N_arrays.c:127
N_gradient_neighbours_x * xt
Definition: N_pde.h:622
N_gradient_neighbours_z * zt
Definition: N_pde.h:630
N_gradient_neighbours_3d * N_alloc_gradient_neighbours_3d(void)
Allocate a N_gradient_neighbours_3d structure.
Definition: N_gradient.c:776
N_gradient_neighbours_z * N_create_gradient_neighbours_z(double NWZ, double NZ, double NEZ, double WZ, double CZ, double EZ, double SWZ, double SZ, double SEZ)
Allocate and initialize a N_gradient_neighbours_z structure.
Definition: N_gradient.c:524
void N_free_gradient_neighbours_z(N_gradient_neighbours_z *grad)
Free&#39;s a N_gradient_neighbours_z structure.
Definition: N_gradient.c:500
double EC
Definition: N_pde.h:536
void G_free(void *buf)
Free allocated memory.
Definition: gis/alloc.c:142
void N_free_gradient_2d(N_gradient_2d *grad)
Free&#39;s a N_gradient_2d structure.
Definition: N_gradient.c:42
Gradient between the cell neighbours in X and Y direction.
Definition: N_pde.h:609
void N_free_gradient_field_3d(N_gradient_field_3d *field)
Free&#39;s a N_gradient_neighbours_3d structure.
Definition: N_gradient.c:1053
Gradient between the cell neighbours in Z direction.
Definition: N_pde.h:601
void N_print_gradient_field_3d_info(N_gradient_field_3d *field)
Print gradient field information to stdout.
Definition: N_gradient.c:1098
void N_free_gradient_neighbours_x(N_gradient_neighbours_x *grad)
Free&#39;s a N_gradient_neighbours_x structure.
Definition: N_gradient.c:309
void N_free_array_3d(N_array_3d *data)
Release the memory of a N_array_3d.
Definition: N_arrays.c:777
Gradient between the cells in X and Y direction.
Definition: N_pde.h:525
N_gradient_neighbours_y * y
Definition: N_pde.h:613
int N_copy_gradient_3d(N_gradient_3d *source, N_gradient_3d *target)
copy a N_gradient_3d structure
Definition: N_gradient.c:215
int N_copy_gradient_neighbours_2d(N_gradient_neighbours_2d *source, N_gradient_neighbours_2d *target)
copy a N_gradient_neighbours_2d structure
Definition: N_gradient.c:666
N_array_2d * N_alloc_array_2d(int cols, int rows, int offset, int type)
Allocate memory for a N_array_2d data structure.
Definition: N_arrays.c:69
double WC
Definition: N_pde.h:536
int y
Definition: plot.c:34
int N_copy_gradient_neighbours_x(N_gradient_neighbours_x *source, N_gradient_neighbours_x *target)
copy a N_gradient_neighbours_x structure
Definition: N_gradient.c:362
N_gradient_3d * N_alloc_gradient_3d(void)
Allocate a N_gradient_3d structure.
Definition: N_gradient.c:152
int N_copy_gradient_2d(N_gradient_2d *source, N_gradient_2d *target)
copy a N_gradient_2d structure
Definition: N_gradient.c:85
N_array_3d * y_array
Definition: N_pde.h:653
N_gradient_2d * N_create_gradient_2d(double NC, double SC, double WC, double EC)
allocate and initialize a N_gradient_2d structure
Definition: N_gradient.c:60
void N_free_gradient_field_2d(N_gradient_field_2d *field)
Free&#39;s a N_gradient_neighbours_2d structure.
Definition: N_gradient.c:952
N_array_3d * N_alloc_array_3d(int cols, int rows, int depths, int offset, int type)
Allocate memory for a N_array_3d data structure.
Definition: N_arrays.c:723
N_gradient_neighbours_2d * N_create_gradient_neighbours_2d(N_gradient_neighbours_x *x, N_gradient_neighbours_y *y)
Allocate and initialize a N_gradient_neighbours_2d structure.
Definition: N_gradient.c:632
double SC
Definition: N_pde.h:536
N_gradient_neighbours_z * zb
Definition: N_pde.h:631
N_gradient_neighbours_2d * N_get_gradient_neighbours_2d(N_gradient_field_2d *field, N_gradient_neighbours_2d *gradient, int col, int row)
Return a N_gradient_neighbours_2d structure calculated from the input gradient field at position [row...
Definition: N_gradient.c:705
void N_print_array_2d_info(N_array_2d *data)
This function writes the data info of the array data to stdout.
Definition: N_arrays.c:608
N_gradient_3d * N_get_gradient_3d(N_gradient_field_3d *field, N_gradient_3d *gradient, int col, int row, int depth)
Return a N_gradient_3d structure calculated from the input gradient field at position [depth][row][co...
Definition: N_gradient.c:249
double NC
Definition: N_pde.h:536
N_array_2d * y_array
Definition: N_pde.h:641
N_gradient_field_2d * N_alloc_gradient_field_2d(int cols, int rows)
Allocate a N_gradient_field_2d.
Definition: N_gradient.c:928
N_gradient_neighbours_x * xb
Definition: N_pde.h:624
N_gradient_neighbours_y * yb
Definition: N_pde.h:628
void N_print_array_3d_info(N_array_3d *data)
Write the info of the array to stdout.
Definition: N_arrays.c:1194
double TC
Definition: N_pde.h:536
Gradient between the cell neighbours in X, Y and Z direction.
Definition: N_pde.h:619
N_array_3d * z_array
Definition: N_pde.h:654
Gradient between the cell neighbours in X direction.
Definition: N_pde.h:585
N_gradient_neighbours_y * yt
Definition: N_pde.h:626
double BC
Definition: N_pde.h:536
N_gradient_neighbours_x * N_create_gradient_neighbours_x(double NWN, double NEN, double WC, double EC, double SWS, double SES)
Allocate and initialize a N_gradient_neighbours_x structure.
Definition: N_gradient.c:331
N_gradient_neighbours_z * N_alloc_gradient_neighbours_z(void)
Allocate a N_gradient_neighbours_z structure.
Definition: N_gradient.c:483
double EC
Definition: N_pde.h:528
N_gradient_3d * N_create_gradient_3d(double NC, double SC, double WC, double EC, double TC, double BC)
allocate and initialize a N_gradient_3d structure
Definition: N_gradient.c:188
void N_print_gradient_field_2d_info(N_gradient_field_2d *field)
Print gradient field information to stdout.
Definition: N_gradient.c:994
void N_copy_array_2d(N_array_2d *source, N_array_2d *target)
Copy the source N_array_2d struct to the target N_array_2d struct.
Definition: N_arrays_calc.c:43
N_gradient_neighbours_2d * N_alloc_gradient_neighbours_2d(void)
Allocate a N_gradient_neighbours_2d structure.
Definition: N_gradient.c:589
N_gradient_neighbours_3d * N_create_gradient_neighbours_3d(N_gradient_neighbours_x *xt, N_gradient_neighbours_x *xc, N_gradient_neighbours_x *xb, N_gradient_neighbours_y *yt, N_gradient_neighbours_y *yc, N_gradient_neighbours_y *yb, N_gradient_neighbours_z *zt, N_gradient_neighbours_z *zb)
Allocate and initialize a N_gradient_neighbours_3d structure.
Definition: N_gradient.c:832
Gradient between the cells in X, Y and Z direction.
Definition: N_pde.h:533
void N_free_gradient_neighbours_2d(N_gradient_neighbours_2d *grad)
Free&#39;s a N_gradient_neighbours_2d structure.
Definition: N_gradient.c:610
N_gradient_neighbours_x * N_alloc_gradient_neighbours_x(void)
Allocate a N_gradient_neighbours_x structure.
Definition: N_gradient.c:292
double N_get_array_3d_d_value(N_array_3d *data, int col, int row, int depth)
This function returns the value of type float at position col, row, depth.
Definition: N_arrays.c:987
N_gradient_2d * N_get_gradient_2d(N_gradient_field_2d *field, N_gradient_2d *gradient, int col, int row)
Return a N_gradient_2d structure calculated from the input gradient field at position [row][col]...
Definition: N_gradient.c:115
return NULL
Definition: dbfopen.c:1394
tuple cols
int G_debug(int level, const char *msg,...)
Print debugging message.
Definition: gis/debug.c:51
int N_copy_gradient_neighbours_z(N_gradient_neighbours_z *source, N_gradient_neighbours_z *target)
copy a N_gradient_neighbours_z structure
Definition: N_gradient.c:559
N_array_3d * x_array
Definition: N_pde.h:652
N_gradient_field_3d * N_alloc_gradient_field_3d(int cols, int rows, int depths)
Allocate a N_gradient_field_3d.
Definition: N_gradient.c:1026
double WC
Definition: N_pde.h:528
DCELL N_get_array_2d_d_value(N_array_2d *data, int col, int row)
Returns the value of type DCELL at position col, row.
Definition: N_arrays.c:375
void N_free_gradient_3d(N_gradient_3d *grad)
Free&#39;s a N_gradient_3d structure.
Definition: N_gradient.c:167
N_gradient_neighbours_x * xc
Definition: N_pde.h:623
N_gradient_neighbours_y * N_create_gradient_neighbours_y(double NWW, double NEE, double NC, double SC, double SWW, double SEE)
Allocate and initialize a N_gradient_neighbours_y structure.
Definition: N_gradient.c:426
N_gradient_neighbours_y * yc
Definition: N_pde.h:627
int N_copy_gradient_neighbours_3d(N_gradient_neighbours_3d *source, N_gradient_neighbours_3d *target)
copy a N_gradient_neighbours_3d structure
Definition: N_gradient.c:883
void N_free_gradient_neighbours_3d(N_gradient_neighbours_3d *grad)
Free&#39;s a N_gradient_neighbours_3d structure.
Definition: N_gradient.c:803
N_gradient_2d * N_alloc_gradient_2d(void)
Allocate a N_gradient_2d structure.
Definition: N_gradient.c:27
Gradient between the cell neighbours in Y direction.
Definition: N_pde.h:593
N_gradient_neighbours_x * x
Definition: N_pde.h:612
double SC
Definition: N_pde.h:528
int N_copy_gradient_field_2d(N_gradient_field_2d *source, N_gradient_field_2d *target)
Copy N_gradient_field_2d structure from source to target.
Definition: N_gradient.c:974
double NC
Definition: N_pde.h:528
int N_copy_gradient_field_3d(N_gradient_field_3d *source, N_gradient_field_3d *target)
Copy N_gradient_field_3d structure from source to target.
Definition: N_gradient.c:1077
SC
Definition: wxgui.py:32
N_gradient_neighbours_y * N_alloc_gradient_neighbours_y(void)
Allocate a N_gradient_neighbours_y structure.
Definition: N_gradient.c:388
N_array_2d * x_array
Definition: N_pde.h:640
void N_copy_array_3d(N_array_3d *source, N_array_3d *target)
Copy the source N_array_3d struct to the target N_array_3d struct.
int N_copy_gradient_neighbours_y(N_gradient_neighbours_y *source, N_gradient_neighbours_y *target)
copy a N_gradient_neighbours_y structure
Definition: N_gradient.c:457
void N_free_gradient_neighbours_y(N_gradient_neighbours_y *grad)
Free&#39;s a N_gradient_neighbours_y structure.
Definition: N_gradient.c:405