~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/tools/gstat/gs_pk_prnt.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**@(#)
  2 **/
  3 #include <stdio.h>
  4 #include <math.h>
  5 #include <tina/sys.h>
  6 #include <tina/sysfuncs.h>
  7 #include <tina/math.h>
  8 #include <tina/mathfuncs.h>
  9 #include <tina/vision.h>
 10 #include <tina/visionfuncs.h>
 11 #include <tina/tv.h>
 12 #include <tina/tvfuncs.h>
 13 
 14 State  *gstat_get();
 15 void    gstat_pick_draw();
 16 void   *gstat_pick_closest();
 17 
 18 static void gstat_pick_print_geom_func(Tv * tv, List * picklist)
 19 {
 20     List   *ptr;
 21     State  *state = gstat_get();
 22 
 23     if (picklist == NULL)
 24     {
 25         format("state->geom:\n");
 26         vector_format((Vector *) state->geom);
 27     }
 28     for (ptr = picklist; ptr != NULL; ptr = ptr->next)
 29     {
 30         int     i = *(int *) ptr->to;
 31 
 32         state_format_one(state, i);
 33     }
 34     tv_repaint(tv);
 35 }
 36 
 37 Tv_pick gstat_pick_print_geom(void)
 38 {
 39     Tv_pick pick = {Tv_pick_id};
 40 
 41     pick = pick_define(
 42                        PICK_NAME, "print geom",
 43                        PICK_CLOSEST, gstat_pick_closest,
 44                        PICK_DRAW, gstat_pick_draw,
 45                        PICK_FUNC, gstat_pick_print_geom_func,
 46                        PICK_FREE, rfree,
 47                        NULL);
 48     return (pick);
 49 }
 50 
 51 static void gstat_pick_print_basis_func(Tv * tv, List * picklist)
 52 {
 53     List   *ptr;
 54     State  *state = gstat_get();
 55 
 56     if (picklist == NULL)
 57     {
 58         state_basis_format(state);
 59         vector_format((Vector *) state->basis);
 60     }
 61     for (ptr = picklist; ptr != NULL; ptr = ptr->next)
 62     {
 63         int     i = *(int *) ptr->to;
 64 
 65         state_basis_format_one(state, i);
 66     }
 67     tv_repaint(tv);
 68 }
 69 
 70 Tv_pick gstat_pick_print_basis(void)
 71 {
 72     Tv_pick pick = {Tv_pick_id};
 73 
 74     pick = pick_define(
 75                        PICK_NAME, "print basis",
 76                        PICK_CLOSEST, gstat_pick_closest,
 77                        PICK_DRAW, gstat_pick_draw,
 78                        PICK_FUNC, gstat_pick_print_basis_func,
 79                        PICK_FREE, rfree,
 80                        NULL);
 81     return (pick);
 82 }
 83 
 84 static void gstat_pick_print_x_func(Tv * tv, List * picklist)
 85 {
 86     List   *ptr;
 87     State  *state = gstat_get();
 88 
 89     if (picklist == NULL)
 90     {
 91         format("state->x:\n");
 92         vector_format((Vector *) state->x);
 93     }
 94     for (ptr = picklist; ptr != NULL; ptr = ptr->next)
 95     {
 96         Vector *xi;
 97         int     i = *(int *) ptr->to;
 98 
 99         format("x: %d\n", i);
100         xi = (Vector *) vector_getp(state->x, i);
101         vector_format(xi);
102     }
103 
104     format("\n");
105     tv_repaint(tv);
106 }
107 
108 Tv_pick gstat_pick_print_x(void)
109 {
110     Tv_pick pick = {Tv_pick_id};
111 
112     pick = pick_define(
113                        PICK_NAME, "print geom",
114                        PICK_CLOSEST, gstat_pick_closest,
115                        PICK_DRAW, gstat_pick_draw,
116                        PICK_FUNC, gstat_pick_print_x_func,
117                        PICK_FREE, rfree,
118                        NULL);
119     return (pick);
120 }
121 
122 static void gstat_pick_print_m_func(Tv * tv, List * picklist)
123 {
124     List   *ptr;
125     State  *state = gstat_get();
126 
127     if (picklist == NULL)
128     {
129         format("state->m:\n");
130         vector_format((Vector *) state->m);
131     }
132     for (ptr = picklist; ptr != NULL; ptr = ptr->next)
133     {
134         Vector *mi;
135         int     i = *(int *) ptr->to;
136 
137         format("m: %d\n", i);
138         mi = (Vector *) vector_getp(state->m, i);
139         vector_format(mi);
140     }
141     format("\n");
142     tv_repaint(tv);
143 }
144 
145 Tv_pick gstat_pick_print_m(void)
146 {
147     Tv_pick pick = {Tv_pick_id};
148 
149     pick = pick_define(
150                        PICK_NAME, "print geom",
151                        PICK_CLOSEST, gstat_pick_closest,
152                        PICK_DRAW, gstat_pick_draw,
153                        PICK_FUNC, gstat_pick_print_m_func,
154                        PICK_FREE, rfree,
155                        NULL);
156     return (pick);
157 }
158 
159 static void gstat_pick_print_cov_func(Tv * tv, List * picklist)
160 {
161     int     l;
162     State  *state = gstat_get();
163 
164     if ((l = list_length(picklist)) < 0 || l > 2)
165     {
166         error("gstat_pick_print_cov: pick 1 or 2 objects", non_fatal);
167         return;
168     }
169     if (l == 0)
170     {
171         format("state->s:\n");
172         state_cov_format(state);
173     } else if (l == 1)
174     {
175         int     i = *(int *) picklist->to;
176 
177         format("Variance:%10d\n", i);
178         state_cov_format_one(state, i);
179     } else
180     {
181         int     i = *(int *) picklist->to;
182         int     j = *(int *) picklist->next->to;
183 
184         format("Covariance:%10d%10d\n", i, j);
185         state_cov_format_two(state, i, j);
186     }
187 
188     tv_repaint(tv);
189 }
190 
191 Tv_pick gstat_pick_print_cov(void)
192 {
193     Tv_pick pick = {Tv_pick_id};
194 
195     pick = pick_define(
196                        PICK_NAME, "print cov",
197                        PICK_CLOSEST, gstat_pick_closest,
198                        PICK_DRAW, gstat_pick_draw,
199                        PICK_FUNC, gstat_pick_print_cov_func,
200                        PICK_FREE, rfree,
201                        NULL);
202     return (pick);
203 }
204 
205 static void gstat_pick_print_corr_func(Tv * tv, List * picklist)
206 {
207     int     l;
208     State  *state = gstat_get();
209 
210     if ((l = list_length(picklist)) < 0 || l > 2)
211     {
212         error("gstat_pick_print_corr: pick 1 or 2 objects", non_fatal);
213         return;
214     }
215     if (l == 0)
216     {
217         format("state->s:\n");
218         state_cov_format(state);
219     } else if (l == 1)
220     {
221         int     i = *(int *) picklist->to;
222 
223         format("Variance:%10d\n", i);
224         state_corr_format_one(state, i);
225     } else
226     {
227         int     i = *(int *) picklist->to;
228         int     j = *(int *) picklist->next->to;
229 
230         format("Covariance:%10d%10d\n", i, j);
231         state_corr_format_two(state, i, j);
232     }
233 
234     tv_repaint(tv);
235 }
236 
237 Tv_pick gstat_pick_print_corr(void)
238 {
239     Tv_pick pick = {Tv_pick_id};
240 
241     pick = pick_define(
242                        PICK_NAME, "print corr",
243                        PICK_CLOSEST, gstat_pick_closest,
244                        PICK_DRAW, gstat_pick_draw,
245                        PICK_FUNC, gstat_pick_print_corr_func,
246                        PICK_FREE, rfree,
247                        NULL);
248     return (pick);
249 }
250 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.