lib/App/SeismicUnixGui/specs/par/unif2aniso_spec.pm untested

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