lib/App/SeismicUnixGui/specs/NMO_Vel_Stk/suintvel_spec.pm untested

filter: Statementstmt 0.0% 0 / 133 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 18 Podpod 0.0% 0 / 13 totaltotal 0.0% 0 / 178 CC 8 SCAR 14.4
CC
8
Cov
0%
get_binding_index_aref
6.0
get_binding_length
6.0
get_file_dialog_type_aref
6.0
CRAP 4.2
1 package App::SeismicUnixGui::specs::NMO_Vel_Stk::suintvel_spec;
2  
3 use Moose;
4 our $VERSION = '0.0.1';
5  
6 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
7 use App::SeismicUnixGui::misc::SeismicUnix
8 qw($bin $ps $segy $su $suffix_bin $suffix_ps $suffix_segy $suffix_su $suffix_txt $txt);
9
10 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
11 use aliased 'App::SeismicUnixGui::sunix::NMO_Vel_Stk::suintvel';
12 my $get = L_SU_global_constants->new();
13 my $Project = Project_config->new();
14 my $suintvel = suintvel->new();
15  
16 my $var = $get->var();
17  
18 my $empty_string = $var->{_empty_string};
19 my $true = $var->{_true};
20 my $false = $var->{_false};
21 my $file_dialog_type = $get->file_dialog_type_href();
22 my $flow_type = $get->flow_type_href();
23  
24 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
25 my $DATA_SEISMIC_SEGY = $Project->DATA_SEISMIC_SEGY();
26 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); # output data directory
27 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT(); # output data directory
28 my $PL_SEISMIC = $Project->PL_SEISMIC();
29 my $PS_SEISMIC = $Project->PS_SEISMIC();
30 my $max_index = 7;
31  
32 my $suintvel_spec = {
33 _CONFIG => $PL_SEISMIC,
34 _DATA_DIR_IN => $DATA_SEISMIC_BIN,
35 _DATA_DIR_OUT => $DATA_SEISMIC_SU,
36 _binding_index_aref => '',
37 _suffix_type_in => $su,
38 _data_suffix_in => $suffix_su,
39 _suffix_type_out => $su,
40 _data_suffix_out => $suffix_su,
41 _file_dialog_type_aref => '',
42 _flow_type_aref => '',
43 _has_infile => $true,
44 _has_outpar => $false,
45 _has_pipe_in => $true,
46 _has_pipe_out => $true,
47 _has_redirect_in => $true,
48 _has_redirect_out => $true,
49 _has_subin_in => $false,
50 _has_subin_out => $false,
51 _is_data => $false,
52 _is_first_of_2 => $true,
53 _is_first_of_3or_more => $true,
54 _is_first_of_4or_more => $true,
55 _is_last_of_2 => $false,
56 _is_last_of_3or_more => $false,
57 _is_last_of_4or_more => $false,
58 _is_suprog => $true,
59 _is_superflow => $false,
60 _max_index => $max_index,
61 _prefix_aref => '',
62 _suffix_aref => '',
63 };
64  
65 =head2 sub binding_index_aref
66  
67 =cut
68  
69 sub binding_index_aref {
70  
71 my $self = @_;
72  
73 my @index;
74  
75 # first binding index (index=0)
76 # connects to second item (index=1)
77 # in the parameter list
78 # $index[0] = 1; # inbound item is bound
79 # $index[1] = 2; # inbound item is bound
80 # $index[2] = 8; # outbound item is bound
81  
82 $suintvel_spec->{_binding_index_aref} = \@index;
83 return ();
84  
85 }
86  
87 =head2 sub file_dialog_type_aref
88  
89 type of dialog (Data, Flow, SaveAs) is needed by binding
90 one type of dialog for each index
91 =cut
92  
93 sub file_dialog_type_aref {
94  
95 my $self = @_;
96  
97 my @type;
98  
99 my $index_aref = get_binding_index_aref();
100 my @index = @$index_aref;
101  
102 # bound index will look for data
103 $type[0] = '';
104  
105 # $type[$index[0]] = $file_dialog_type->{_Data};
106 # $type[$index[1]] = $file_dialog_type->{_Data};
107 # $type[$index[2]] = $file_dialog_type->{_Data};
108  
109 $suintvel_spec->{_file_dialog_type_aref} = \@type;
110 return ();
111  
112 }
113  
114 =head2 sub flow_type_aref
115  
116 =cut
117  
118 sub flow_type_aref {
119  
120 my $self = @_;
121  
122 my @type;
123  
124 $type[0] = $flow_type->{_user_built};
125  
126 $suintvel_spec->{_flow_type_aref} = \@type;
127 return ();
128  
129 }
130  
131 =head2 sub get_binding_index_aref
132  
133 =cut
134  
135 sub get_binding_index_aref {
136  
137 my $self = @_;
138 my @index;
139  
140 if ( $suintvel_spec->{_binding_index_aref} ) {
141  
142 my $index_aref = $suintvel_spec->{_binding_index_aref};
143 return ($index_aref);
144  
145 }
146 else {
147 print(
148 "suintvel_spec, get_binding_index_aref, missing binding_index_aref\n"
149 );
150 return ();
151 }
152  
153 my $index_aref = $suintvel_spec->{_binding_index_aref};
154 }
155  
156 =head2 sub get_binding_length
157  
158 =cut
159  
160 sub get_binding_length {
161  
162 my $self = @_;
163  
164 if ( $suintvel_spec->{_binding_index_aref} ) {
165  
166 my $binding_length = scalar @{ $suintvel_spec->{_binding_index_aref} };
167 return ($binding_length);
168  
169 }
170 else {
171 print("suintvel_spec, get_binding_length, missing binding_length\n");
172 return ();
173 }
174  
175 return ();
176 }
177  
178 =head2 sub get_file_dialog_type_aref
179  
180 =cut
181  
182 sub get_file_dialog_type_aref {
183  
184 my $self = @_;
185 if ( $suintvel_spec->{_file_dialog_type_aref} ) {
186  
187 my $index_aref = $suintvel_spec->{_file_dialog_type_aref};
188 return ($index_aref);
189  
190 }
191 else {
192 print(
193 "suintvel_spec, get_file_dialog_type_aref, missing get_file_dialog_type_aref\n"
194 );
195 return ();
196 }
197  
198 return ();
199 }
200  
201 =head2 sub get_flow_type_aref
202  
203 =cut
204  
205 sub get_flow_type_aref {
206  
207 my $self = @_;
208  
209 if ( $suintvel_spec->{_flow_type_aref} ) {
210  
211 my $index_aref = $suintvel_spec->{_flow_type_aref};
212 return ($index_aref);
213  
214 }
215 else {
216 print("suintvel_spec, get_flow_type_aref, missing flow_type_aref\n");
217 return ();
218 }
219  
220 }
221  
222 =head2 sub get_incompatibles
223  
224 =cut
225  
226 sub get_incompatibles {
227  
228 my $self = @_;
229 my @needed;
230  
231 my @_need_both;
232  
233 my @_need_only_1;
234  
235 my @_none_needed;
236  
237 my @_all_needed;
238  
239 my $params = {
240  
241 _need_both => \@_need_both,
242 _need_only_1 => \@_need_only_1,
243 _none_needed => \@_none_needed,
244 _all_needed => \@_all_needed,
245  
246 };
247  
248 my @of_two = ( 'xx', 'yy' );
249 push @{ $params->{_need_only_1} }, \@of_two;
250  
251 my $len_1_needed = scalar @{ $params->{_need_only_1} };
252  
253 if ( $len_1_needed >= 1 ) {
254  
255 for ( my $i = 0 ; $i < $len_1_needed ; $i++ ) {
256  
257 print(
258 "suintvel, get_incompatibles,need_only_1: @{@{$params->{_need_only_1}}[$i]}\n"
259 );
260  
261 }
262  
263 }
264 else {
265 print("get_incompatibles, no incompatibles\n");
266 }
267  
268 return ($params);
269  
270 }
271  
272 =head2 sub get_prefix_aref
273  
274 =cut
275  
276 sub get_prefix_aref {
277  
278 my $self = @_;
279  
280 if ( $suintvel_spec->{_prefix_aref} ) {
281  
282 my $prefix_aref = $suintvel_spec->{_prefix_aref};
283 return ($prefix_aref);
284  
285 }
286 else {
287 print("suintvel_spec, get_prefix_aref, missing prefix_aref\n");
288 return ();
289 }
290  
291 return ();
292 }
293  
294 =head2 sub get_suffix_aref
295  
296 =cut
297  
298 sub get_suffix_aref {
299  
300 my $self = @_;
301  
302 if ( $suintvel_spec->{_suffix_aref} ) {
303  
304 my $suffix_aref = $suintvel_spec->{_suffix_aref};
305 return ($suffix_aref);
306  
307 }
308 else {
309 print("$suintvel_spec, get_suffix_aref, missing suffix_aref\n");
310 return ();
311 }
312  
313 return ();
314 }
315  
316 =head2 sub prefix_aref
317  
318 Include in the Set up
319 sections of an output Poop flow.
320  
321 prefixes and suffixes to parameter labels
322 are filtered by sunix_pl
323  
324 =cut
325  
326 sub prefix_aref {
327  
328 my $self = @_;
329  
330 my @prefix;
331  
332 for ( my $i = 0 ; $i < $max_index ; $i++ ) {
333  
334 $prefix[$i] = $empty_string;
335  
336 }
337  
338 # my $index_aref = get_binding_index_aref();
339 # my @index = @$index_aref;
340  
341 # label 2 in GUI is input xx_file and needs a home directory
342 # $prefix[ $index[0] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
343  
344 # label 3 in GUI is input yy_file and needs a home directory
345 # $prefix[ $index[1] ] = '$DATA_SEISMIC_TXT' . ".'/'.";
346  
347 # label 9 in GUI is input zz_file and needs a home directory
348 # $prefix[ $index[2] ] = '$DATA_SEISMIC_SU' . ".'/'.";
349  
350 $suintvel_spec->{_prefix_aref} = \@prefix;
351 return ();
352  
353 }
354  
355 =head2 sub suffix_aref
356  
357 Initialize suffixes as empty
358 values
359  
360 =cut
361  
362 sub suffix_aref {
363  
364 my $self = @_;
365  
366 my @suffix;
367  
368 for ( my $i = 0 ; $i < $max_index ; $i++ ) {
369  
370 $suffix[$i] = $empty_string;
371  
372 }
373  
374 # my $index_aref = get_binding_index_aref();
375 # my @index = @$index_aref;
376  
377 # label 2 in GUI is input xx_file and needs a home directory
378 # $suffix[ $index[0] ] = ''.'' . '$suffix_bin';
379  
380 # label 3 in GUI is input yy_file and needs a home directory
381 # $suffix[ $index[1] ] = ''.'' . '$suffix_bin';
382  
383 # label 9 in GUI is output zz_file and needs a home directory
384 # $suffix[ $index[2] ] = ''.'' . '$suffix_su';
385  
386 $suintvel_spec->{_suffix_aref} = \@suffix;
387 return ();
388  
389 }
390  
391 =head2 sub variables
392  
393  
394 return a hash array
395 with definitions
396
397 =cut
398  
399 sub variables {
400  
401 my ($self) = @_;
402 my $hash_ref = $suintvel_spec;
403 return ($hash_ref);
404 }
405  
406 1;