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