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