lib/App/SeismicUnixGui/specs/model/sufctanismod_spec.pm untested

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