lib/App/SeismicUnixGui/specs/inversion/suinvco3d_spec.pm untested

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