« lib/App/SeismicUnixGui/specs/shapeNcut/sukill_spec.pm
↑ Summary
lib/App/SeismicUnixGui/specs/shapeNcut/supad_spec.pm »
| 1 | package App::SeismicUnixGui::specs::shapeNcut::sumute_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($bin $ps $segy $su $suffix_bin $suffix_ps $suffix_segy $suffix_su $suffix_txt $txt); | ||
| 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 | my $var = $get->var(); | ||
| 13 | |||
| 14 | my $empty_string = $var->{_empty_string}; | ||
| 15 | my $true = $var->{_true}; | ||
| 16 | my $false = $var->{_false}; | ||
| 17 | my $file_dialog_type = $get->file_dialog_type_href(); | ||
| 18 | my $flow_type = $get->flow_type_href(); | ||
| 19 | |||
| 20 | my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN(); | ||
| 21 | my $DATA_SEISMIC_SEGY = $Project->DATA_SEISMIC_SEGY(); | ||
| 22 | my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); # output data directory | ||
| 23 | my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT(); # input data directory | ||
| 24 | my $PL_SEISMIC = $Project->PL_SEISMIC(); | ||
| 25 | my $PS_SEISMIC = $Project->PS_SEISMIC(); | ||
| 26 | my $max_index = 16; | ||
| 27 | |||
| 28 | |||
| 29 | my $sumute_spec = { | ||
| 30 | _CONFIG => $PL_SEISMIC, | ||
| 31 | _DATA_DIR_IN => $DATA_SEISMIC_SU, | ||
| 32 | _DATA_DIR_OUT => $DATA_SEISMIC_SU, | ||
| 33 | _binding_index_aref => '', | ||
| 34 | _suffix_type_in => $su, | ||
| 35 | _data_suffix_in => $suffix_su, | ||
| 36 | _suffix_type_out => $su, | ||
| 37 | _data_suffix_out => $suffix_su, | ||
| 38 | _file_dialog_type_aref => '', | ||
| 39 | _flow_type_aref => '', | ||
| 40 | _has_infile => $true, | ||
| 41 | _has_outpar => $false, | ||
| 42 | _has_pipe_in => $true, | ||
| 43 | _has_pipe_out => $true, | ||
| 44 | _has_redirect_in => $true, | ||
| 45 | _has_redirect_out => $true, | ||
| 46 | _has_subin_in => $false, | ||
| 47 | _has_subin_out => $false, | ||
| 48 | _is_data => $false, | ||
| 49 | _is_first_of_2 => $true, | ||
| 50 | _is_first_of_3or_more => $true, | ||
| 51 | _is_first_of_4or_more => $true, | ||
| 52 | _is_last_of_2 => $false, | ||
| 53 | _is_last_of_3or_more => $false, | ||
| 54 | _is_last_of_4or_more => $false, | ||
| 55 | _is_suprog => $true, | ||
| 56 | _is_superflow => $false, | ||
| 57 | _max_index => $max_index, | ||
| 58 | _prefix_aref => '', | ||
| 59 | _suffix_aref => '', | ||
| 60 | }; | ||
| 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 fourth item (index=3) | ||
| 75 | # in the parameter list | ||
| 76 | $index[0] = 3; # inbound/outbound item is bound | ||
| 77 | $index[1] = 4; # inbound/outbound item is bound | ||
| 78 | $index[2] = 8; # inbound/outbound item is bound | ||
| 79 | $index[3] = 9; # inbound/outbound item is bound | ||
| 80 | $index[4] = 12; # inbound/outbound item is bound | ||
| 81 | $index[5] = 15; # inbound/outbound item is bound | ||
| 82 | $sumute_spec ->{_binding_index_aref} = \@index; | ||
| 83 | return(); | ||
| 84 | |||
| 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 | |||
| 93 | 'Path' - can go anywhere | ||
| 94 | but starts by going to $PL_SEISMICS directory | ||
| 95 | |||
| 96 | type of dialog (Data, Flow, SaveAs) is needed | ||
| 97 | for binding | ||
| 98 | one type of dialog for each index | ||
| 99 | |||
| 100 | =cut | ||
| 101 | |||
| 102 | sub file_dialog_type_aref { | ||
| 103 | |||
| 104 | my $self = @_; | ||
| 105 | |||
| 106 | my @type; | ||
| 107 | |||
| 108 | my $index_aref = get_binding_index_aref(); | ||
| 109 | my @index = @$index_aref; | ||
| 110 | |||
| 111 | # bound index will look for data | ||
| 112 | $type[$index[0]] = $file_dialog_type->{_Data_SEISMIC_TXT}; | ||
| 113 | $type[$index[1]] = $file_dialog_type->{_Data}; | ||
| 114 | $type[$index[2]] = $file_dialog_type->{_Data_SEISMIC_TXT}; | ||
| 115 | $type[$index[3]] = $file_dialog_type->{_Data_PL_SEISMIC}; | ||
| 116 | $type[$index[4]] = $file_dialog_type->{_Data_PL_SEISMIC}; | ||
| 117 | $type[$index[5]] = $file_dialog_type->{_Data_PL_SEISMIC}; | ||
| 118 | |||
| 119 | $sumute_spec->{_file_dialog_type_aref} = \@type; | ||
| 120 | return(); | ||
| 121 | |||
| 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 | $sumute_spec ->{_flow_type_aref} = \@type; | ||
| 138 | return(); | ||
| 139 | |||
| 140 | } | ||
| 141 | |||
| 142 | |||
| 143 | =head2 sub get_binding_index_aref | ||
| 144 | |||
| 145 | =cut | ||
| 146 | |||
| 147 | sub get_binding_index_aref{ | ||
| 148 | |||
| 149 | my $self = @_; | ||
| 150 | my @index; | ||
| 151 | |||
| 152 | if ($sumute_spec->{_binding_index_aref} ) { | ||
| 153 | |||
| 154 | my $index_aref = $sumute_spec->{_binding_index_aref}; | ||
| 155 | return($index_aref); | ||
| 156 | |||
| 157 | } else { | ||
| 158 | print("sumute_spec, get_binding_index_aref, missing binding_index_aref\n"); | ||
| 159 | return(); | ||
| 160 | } | ||
| 161 | |||
| 162 | my $index_aref = $sumute_spec->{_binding_index_aref}; | ||
| 163 | } | ||
| 164 | |||
| 165 | |||
| 166 | =head2 sub get_binding_length | ||
| 167 | |||
| 168 | =cut | ||
| 169 | |||
| 170 | sub get_binding_length{ | ||
| 171 | |||
| 172 | my $self = @_; | ||
| 173 | |||
| 174 | if ($sumute_spec->{_binding_index_aref} ) { | ||
| 175 | |||
| 176 | my $binding_length= scalar @{$sumute_spec->{_binding_index_aref}}; | ||
| 177 | return($binding_length); | ||
| 178 | |||
| 179 | } else { | ||
| 180 | print("sumute_spec, get_binding_length, missing binding_length\n"); | ||
| 181 | return(); | ||
| 182 | } | ||
| 183 | |||
| 184 | return(); | ||
| 185 | } | ||
| 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 ($sumute_spec->{_file_dialog_type_aref} ) { | ||
| 196 | |||
| 197 | my $index_aref = $sumute_spec->{_file_dialog_type_aref}; | ||
| 198 | return($index_aref); | ||
| 199 | |||
| 200 | } else { | ||
| 201 | print("sumute_spec, get_file_dialog_type_aref, missing get_file_dialog_type_aref\n"); | ||
| 202 | return(); | ||
| 203 | } | ||
| 204 | |||
| 205 | return(); | ||
| 206 | } | ||
| 207 | |||
| 208 | |||
| 209 | =head2 sub get_flow_type_aref | ||
| 210 | |||
| 211 | =cut | ||
| 212 | |||
| 213 | sub get_flow_type_aref { | ||
| 214 | |||
| 215 | my $self = @_; | ||
| 216 | |||
| 217 | if ($sumute_spec->{_flow_type_aref} ) { | ||
| 218 | |||
| 219 | my $index_aref = $sumute_spec->{_flow_type_aref}; | ||
| 220 | return($index_aref); | ||
| 221 | |||
| 222 | } else { | ||
| 223 | print("sumute_spec, get_flow_type_aref, missing flow_type_aref\n"); | ||
| 224 | return(); | ||
| 225 | } | ||
| 226 | |||
| 227 | } | ||
| 228 | |||
| 229 | |||
| 230 | =head2 sub get_incompatibles | ||
| 231 | |||
| 232 | =cut | ||
| 233 | |||
| 234 | sub get_incompatibles{ | ||
| 235 | |||
| 236 | my $self = @_; | ||
| 237 | my @needed; | ||
| 238 | |||
| 239 | my @_need_both; | ||
| 240 | |||
| 241 | my @_need_only_1; | ||
| 242 | |||
| 243 | my @_none_needed; | ||
| 244 | |||
| 245 | my @_all_needed; | ||
| 246 | |||
| 247 | my $params = { | ||
| 248 | |||
| 249 | _need_both => \@_need_both, | ||
| 250 | _need_only_1 => \@_need_only_1, | ||
| 251 | _none_needed => \@_none_needed, | ||
| 252 | _all_needed => \@_all_needed, | ||
| 253 | |||
| 254 | }; | ||
| 255 | |||
| 256 | my @of_two = ('xx','yy'); | ||
| 257 | push @{$params->{_need_only_1}} , \@of_two; | ||
| 258 | |||
| 259 | my $len_1_needed = scalar @{$params->{_need_only_1}}; | ||
| 260 | |||
| 261 | if ($len_1_needed >= 1) { | ||
| 262 | |||
| 263 | for (my $i=0; $i < $len_1_needed; $i++) { | ||
| 264 | |||
| 265 | print("sumute, get_incompatibles,need_only_1: @{@{$params->{_need_only_1}}[$i]}\n"); | ||
| 266 | |||
| 267 | } | ||
| 268 | |||
| 269 | } else { | ||
| 270 | print("get_incompatibles, no incompatibles\n") | ||
| 271 | } | ||
| 272 | |||
| 273 | return($params); | ||
| 274 | |||
| 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 ($sumute_spec->{_prefix_aref} ) { | ||
| 287 | |||
| 288 | my $prefix_aref= $sumute_spec->{_prefix_aref}; | ||
| 289 | return($prefix_aref); | ||
| 290 | |||
| 291 | } else { | ||
| 292 | print("sumute_spec, get_prefix_aref, missing prefix_aref\n"); | ||
| 293 | return(); | ||
| 294 | } | ||
| 295 | |||
| 296 | return(); | ||
| 297 | } | ||
| 298 | |||
| 299 | |||
| 300 | =head2 sub get_suffix_aref | ||
| 301 | |||
| 302 | =cut | ||
| 303 | |||
| 304 | sub get_suffix_aref { | ||
| 305 | |||
| 306 | my $self = @_; | ||
| 307 | |||
| 308 | if ($sumute_spec->{_suffix_aref} ) { | ||
| 309 | |||
| 310 | my $suffix_aref= $sumute_spec->{_suffix_aref}; | ||
| 311 | return($suffix_aref); | ||
| 312 | |||
| 313 | } else { | ||
| 314 | print("$sumute_spec, get_suffix_aref, missing suffix_aref\n"); | ||
| 315 | return(); | ||
| 316 | } | ||
| 317 | |||
| 318 | return(); | ||
| 319 | } | ||
| 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 4 in GUI is input/output xx_file and needs a home directory | ||
| 348 | $prefix[ $index[0] ] = '$DATA_SEISMIC_TXT' . ".'/'."; | ||
| 349 | |||
| 350 | # label 5 in GUI is input/output xx_file and needs a home directory | ||
| 351 | $prefix[ $index[1] ] = '$DATA_SEISMIC_SU' . ".'/'."; | ||
| 352 | |||
| 353 | # label 9 in GUI is input/output xx_file and needs a home directory | ||
| 354 | $prefix[ $index[2] ] = '$DATA_SEISMIC_TXT' . ".'/'."; | ||
| 355 | |||
| 356 | # label 10 in GUI is input/output xx_file and needs a home directory | ||
| 357 | $prefix[ $index[3] ] = '$PL_SEISMIC' . ".'/'."; | ||
| 358 | |||
| 359 | # label 13 in GUI is input/output xx_file and needs a home directory | ||
| 360 | $prefix[ $index[4] ] = '$PL_SEISMIC' . ".'/'."; | ||
| 361 | |||
| 362 | # label 16 in GUI is input/output xx_file and needs a home directory | ||
| 363 | $prefix[ $index[5] ] = '$PL_SEISMIC' . ".'/'."; | ||
| 364 | |||
| 365 | $sumute_spec ->{_prefix_aref} = \@prefix; | ||
| 366 | return(); | ||
| 367 | |||
| 368 | } | ||
| 369 | |||
| 370 | |||
| 371 | =head2 sub suffix_aref | ||
| 372 | |||
| 373 | Initialize suffixes as empty | ||
| 374 | values | ||
| 375 | |||
| 376 | =cut | ||
| 377 | |||
| 378 | sub suffix_aref { | ||
| 379 | |||
| 380 | my $self = @_; | ||
| 381 | |||
| 382 | my @suffix; | ||
| 383 | |||
| 384 | for (my $i=0; $i < $max_index; $i++) { | ||
| 385 | |||
| 386 | $suffix[$i] = $empty_string; | ||
| 387 | |||
| 388 | } | ||
| 389 | |||
| 390 | my $index_aref = get_binding_index_aref(); | ||
| 391 | my @index = @$index_aref; | ||
| 392 | |||
| 393 | # label 4 in GUI is input/ouput xx_file and needs a home directory | ||
| 394 | $suffix[ $index[0] ] = ''.'' . '$suffix_txt'; | ||
| 395 | |||
| 396 | # label 5 in GUI is input/ouput xx_file and needs a home directory | ||
| 397 | $suffix[ $index[1] ] = ''.'' . '$suffix_su'; | ||
| 398 | |||
| 399 | # label 9 in GUI is input/ouput xx_file and needs a home directory | ||
| 400 | $suffix[ $index[2] ] = ''.'' . ''; | ||
| 401 | |||
| 402 | # label 10 in GUI is input/ouput xx_file and needs a home directory | ||
| 403 | $suffix[ $index[3] ] = ''.'' . ''; | ||
| 404 | |||
| 405 | # label 13 in GUI is input/ouput xx_file and needs a home directory | ||
| 406 | $suffix[ $index[4] ] = ''.'' . ''; | ||
| 407 | |||
| 408 | # label 16 in GUI is input/ouput xx_file and needs a home directory | ||
| 409 | $suffix[ $index[5] ] = ''.'' . ''; | ||
| 410 | |||
| 411 | |||
| 412 | $sumute_spec ->{_suffix_aref} = \@suffix; | ||
| 413 | return(); | ||
| 414 | |||
| 415 | } | ||
| 416 | |||
| 417 | |||
| 418 | =head2 sub variables | ||
| 419 | |||
| 420 | |||
| 421 | return a hash array | ||
| 422 | with definitions | ||
| 423 | |||
| 424 | =cut | ||
| 425 | |||
| 426 | sub variables { | ||
| 427 | |||
| 428 | my ($self) = @_; | ||
| 429 | my $hash_ref = $sumute_spec; | ||
| 430 | return ($hash_ref); | ||
| 431 | } | ||
| 432 | |||
| 433 | 1; |