« lib/App/SeismicUnixGui/specs/migration/sudatumfd_spec.pm
↑ Summary
lib/App/SeismicUnixGui/specs/migration/sumigps_spec.pm »
| 1 | package App::SeismicUnixGui::specs::migration::sukdmig3d_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(); # output data directory | ||
| 24 | my $PL_SEISMIC = $Project->PL_SEISMIC(); | ||
| 25 | my $PS_SEISMIC = $Project->PS_SEISMIC(); | ||
| 26 | my $max_index = 49; | ||
| 27 | |||
| 28 | |||
| 29 | my $sukdmig3d_spec = { | ||
| 30 | _CONFIG => $PL_SEISMIC, | ||
| 31 | _DATA_DIR_IN => $DATA_SEISMIC_BIN, | ||
| 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 second item (index=1) | ||
| 75 | # in the parameter list | ||
| 76 | $index[0] = 2; # inbound/outbound item is bound | ||
| 77 | $index[1] = 1; # inbound/outbound item is bound | ||
| 78 | $index[2] = 3; # inbound/outbound item is bound | ||
| 79 | $index[3] = 6; # inbound/outbound item is bound | ||
| 80 | $sukdmig3d_spec ->{_binding_index_aref} = \@index; | ||
| 81 | return(); | ||
| 82 | |||
| 83 | } | ||
| 84 | |||
| 85 | |||
| 86 | =head2 sub file_dialog_type_aref | ||
| 87 | |||
| 88 | type of dialog (Data, Flow, SaveAs) is needed by binding | ||
| 89 | one type of dialog for each index | ||
| 90 | =cut | ||
| 91 | |||
| 92 | sub file_dialog_type_aref { | ||
| 93 | |||
| 94 | my $self = @_; | ||
| 95 | |||
| 96 | my @type; | ||
| 97 | |||
| 98 | my $index_aref = get_binding_index_aref(); | ||
| 99 | my @index = @$index_aref; | ||
| 100 | |||
| 101 | # bound index will look for data | ||
| 102 | $type[$index[0]] = $file_dialog_type->{_Data}; | ||
| 103 | $type[$index[1]] = $file_dialog_type->{_Data}; | ||
| 104 | $type[$index[2]] = $file_dialog_type->{_Data}; | ||
| 105 | $type[$index[3]] = $file_dialog_type->{_Data}; | ||
| 106 | |||
| 107 | $sukdmig3d_spec ->{_file_dialog_type_aref} = \@type; | ||
| 108 | return(); | ||
| 109 | |||
| 110 | } | ||
| 111 | |||
| 112 | |||
| 113 | =head2 sub flow_type_aref | ||
| 114 | |||
| 115 | =cut | ||
| 116 | |||
| 117 | sub flow_type_aref { | ||
| 118 | |||
| 119 | my $self = @_; | ||
| 120 | |||
| 121 | my @type; | ||
| 122 | |||
| 123 | $type[0] = $flow_type->{_user_built}; | ||
| 124 | |||
| 125 | $sukdmig3d_spec ->{_flow_type_aref} = \@type; | ||
| 126 | return(); | ||
| 127 | |||
| 128 | } | ||
| 129 | |||
| 130 | |||
| 131 | =head2 sub get_binding_index_aref | ||
| 132 | |||
| 133 | =cut | ||
| 134 | |||
| 135 | sub get_binding_index_aref{ | ||
| 136 | |||
| 137 | my $self = @_; | ||
| 138 | my @index; | ||
| 139 | |||
| 140 | if ($sukdmig3d_spec->{_binding_index_aref} ) { | ||
| 141 | |||
| 142 | my $index_aref = $sukdmig3d_spec->{_binding_index_aref}; | ||
| 143 | return($index_aref); | ||
| 144 | |||
| 145 | } else { | ||
| 146 | print("sukdmig3d_spec, get_binding_index_aref, missing binding_index_aref\n"); | ||
| 147 | return(); | ||
| 148 | } | ||
| 149 | |||
| 150 | my $index_aref = $sukdmig3d_spec->{_binding_index_aref}; | ||
| 151 | } | ||
| 152 | |||
| 153 | |||
| 154 | =head2 sub get_binding_length | ||
| 155 | |||
| 156 | =cut | ||
| 157 | |||
| 158 | sub get_binding_length{ | ||
| 159 | |||
| 160 | my $self = @_; | ||
| 161 | |||
| 162 | if ($sukdmig3d_spec->{_binding_index_aref} ) { | ||
| 163 | |||
| 164 | my $binding_length= scalar @{$sukdmig3d_spec->{_binding_index_aref}}; | ||
| 165 | return($binding_length); | ||
| 166 | |||
| 167 | } else { | ||
| 168 | print("sukdmig3d_spec, get_binding_length, missing binding_length\n"); | ||
| 169 | return(); | ||
| 170 | } | ||
| 171 | |||
| 172 | return(); | ||
| 173 | } | ||
| 174 | |||
| 175 | |||
| 176 | =head2 sub get_file_dialog_type_aref | ||
| 177 | |||
| 178 | =cut | ||
| 179 | |||
| 180 | sub get_file_dialog_type_aref{ | ||
| 181 | |||
| 182 | my $self = @_; | ||
| 183 | if ($sukdmig3d_spec->{_file_dialog_type_aref} ) { | ||
| 184 | |||
| 185 | my $index_aref = $sukdmig3d_spec->{_file_dialog_type_aref}; | ||
| 186 | return($index_aref); | ||
| 187 | |||
| 188 | } else { | ||
| 189 | print("sukdmig3d_spec, get_file_dialog_type_aref, missing get_file_dialog_type_aref\n"); | ||
| 190 | return(); | ||
| 191 | } | ||
| 192 | |||
| 193 | return(); | ||
| 194 | } | ||
| 195 | |||
| 196 | |||
| 197 | =head2 sub get_flow_type_aref | ||
| 198 | |||
| 199 | =cut | ||
| 200 | |||
| 201 | sub get_flow_type_aref { | ||
| 202 | |||
| 203 | my $self = @_; | ||
| 204 | |||
| 205 | if ($sukdmig3d_spec->{_flow_type_aref} ) { | ||
| 206 | |||
| 207 | my $index_aref = $sukdmig3d_spec->{_flow_type_aref}; | ||
| 208 | return($index_aref); | ||
| 209 | |||
| 210 | } else { | ||
| 211 | print("sukdmig3d_spec, get_flow_type_aref, missing flow_type_aref\n"); | ||
| 212 | return(); | ||
| 213 | } | ||
| 214 | |||
| 215 | } | ||
| 216 | |||
| 217 | |||
| 218 | =head2 sub get_incompatibles | ||
| 219 | |||
| 220 | =cut | ||
| 221 | |||
| 222 | sub get_incompatibles{ | ||
| 223 | |||
| 224 | my $self = @_; | ||
| 225 | my @needed; | ||
| 226 | |||
| 227 | my @_need_both; | ||
| 228 | |||
| 229 | my @_need_only_1; | ||
| 230 | |||
| 231 | my @_none_needed; | ||
| 232 | |||
| 233 | my @_all_needed; | ||
| 234 | |||
| 235 | my $params = { | ||
| 236 | |||
| 237 | _need_both => \@_need_both, | ||
| 238 | _need_only_1 => \@_need_only_1, | ||
| 239 | _none_needed => \@_none_needed, | ||
| 240 | _all_needed => \@_all_needed, | ||
| 241 | |||
| 242 | }; | ||
| 243 | |||
| 244 | my @of_two = ('xx','yy'); | ||
| 245 | push @{$params->{_need_only_1}} , \@of_two; | ||
| 246 | |||
| 247 | my $len_1_needed = scalar @{$params->{_need_only_1}}; | ||
| 248 | |||
| 249 | if ($len_1_needed >= 1) { | ||
| 250 | |||
| 251 | for (my $i=0; $i < $len_1_needed; $i++) { | ||
| 252 | |||
| 253 | print("sukdmig3d, get_incompatibles,need_only_1: @{@{$params->{_need_only_1}}[$i]}\n"); | ||
| 254 | |||
| 255 | } | ||
| 256 | |||
| 257 | } else { | ||
| 258 | print("get_incompatibles, no incompatibles\n") | ||
| 259 | } | ||
| 260 | |||
| 261 | return($params); | ||
| 262 | |||
| 263 | } | ||
| 264 | |||
| 265 | |||
| 266 | =head2 sub get_prefix_aref | ||
| 267 | |||
| 268 | =cut | ||
| 269 | |||
| 270 | sub get_prefix_aref { | ||
| 271 | |||
| 272 | my $self = @_; | ||
| 273 | |||
| 274 | if ($sukdmig3d_spec->{_prefix_aref} ) { | ||
| 275 | |||
| 276 | my $prefix_aref= $sukdmig3d_spec->{_prefix_aref}; | ||
| 277 | return($prefix_aref); | ||
| 278 | |||
| 279 | } else { | ||
| 280 | print("sukdmig3d_spec, get_prefix_aref, missing prefix_aref\n"); | ||
| 281 | return(); | ||
| 282 | } | ||
| 283 | |||
| 284 | return(); | ||
| 285 | } | ||
| 286 | |||
| 287 | |||
| 288 | =head2 sub get_suffix_aref | ||
| 289 | |||
| 290 | =cut | ||
| 291 | |||
| 292 | sub get_suffix_aref { | ||
| 293 | |||
| 294 | my $self = @_; | ||
| 295 | |||
| 296 | if ($sukdmig3d_spec->{_suffix_aref} ) { | ||
| 297 | |||
| 298 | my $suffix_aref= $sukdmig3d_spec->{_suffix_aref}; | ||
| 299 | return($suffix_aref); | ||
| 300 | |||
| 301 | } else { | ||
| 302 | print("$sukdmig3d_spec, get_suffix_aref, missing suffix_aref\n"); | ||
| 303 | return(); | ||
| 304 | } | ||
| 305 | |||
| 306 | return(); | ||
| 307 | } | ||
| 308 | |||
| 309 | |||
| 310 | =head2 sub prefix_aref | ||
| 311 | |||
| 312 | Include in the Set up | ||
| 313 | sections of an output Poop flow. | ||
| 314 | |||
| 315 | prefixes and suffixes to parameter labels | ||
| 316 | are filtered by sunix_pl | ||
| 317 | |||
| 318 | =cut | ||
| 319 | |||
| 320 | sub prefix_aref { | ||
| 321 | |||
| 322 | my $self = @_; | ||
| 323 | |||
| 324 | my @prefix; | ||
| 325 | |||
| 326 | for (my $i=0; $i < $max_index; $i++) { | ||
| 327 | |||
| 328 | $prefix[$i] = $empty_string; | ||
| 329 | |||
| 330 | } | ||
| 331 | |||
| 332 | my $index_aref = get_binding_index_aref(); | ||
| 333 | my @index = @$index_aref; | ||
| 334 | |||
| 335 | # label 3 in GUI is input/output xx_file and needs a home directory | ||
| 336 | $prefix[ $index[0] ] = '$DATA_SEISMIC_SU' . ".'/'."; | ||
| 337 | |||
| 338 | # label 2 in GUI is input/output xx_file and needs a home directory | ||
| 339 | $prefix[ $index[1] ] = '$DATA_SEISMIC_BIN' . ".'/'."; | ||
| 340 | |||
| 341 | # label 4 in GUI is input/output xx_file and needs a home directory | ||
| 342 | $prefix[ $index[2] ] = '$DATA_SEISMIC_SU' . ".'/'."; | ||
| 343 | |||
| 344 | # label 7 in GUI is input/output xx_file and needs a home directory | ||
| 345 | $prefix[ $index[3] ] = '$DATA_SEISMIC_BIN' . ".'/'."; | ||
| 346 | |||
| 347 | $sukdmig3d_spec ->{_prefix_aref} = \@prefix; | ||
| 348 | return(); | ||
| 349 | |||
| 350 | } | ||
| 351 | |||
| 352 | |||
| 353 | =head2 sub suffix_aref | ||
| 354 | |||
| 355 | Initialize suffixes as empty | ||
| 356 | values | ||
| 357 | |||
| 358 | =cut | ||
| 359 | |||
| 360 | sub suffix_aref { | ||
| 361 | |||
| 362 | my $self = @_; | ||
| 363 | |||
| 364 | my @suffix; | ||
| 365 | |||
| 366 | for (my $i=0; $i < $max_index; $i++) { | ||
| 367 | |||
| 368 | $suffix[$i] = $empty_string; | ||
| 369 | |||
| 370 | } | ||
| 371 | |||
| 372 | my $index_aref = get_binding_index_aref(); | ||
| 373 | my @index = @$index_aref; | ||
| 374 | |||
| 375 | # label 3 in GUI is input/ouput xx_file and needs a home directory | ||
| 376 | $suffix[ $index[0] ] = ''.'' . '$suffix_su'; | ||
| 377 | |||
| 378 | # label 2 in GUI is input/ouput xx_file and needs a home directory | ||
| 379 | $suffix[ $index[1] ] = ''.'' . '$suffix_bin'; | ||
| 380 | |||
| 381 | # label 4 in GUI is input/ouput xx_file and needs a home directory | ||
| 382 | $suffix[ $index[2] ] = ''.'' . '$suffix_su'; | ||
| 383 | |||
| 384 | # label 7 in GUI is input/ouput xx_file and needs a home directory | ||
| 385 | $suffix[ $index[3] ] = ''.'' . '$suffix_bin'; | ||
| 386 | |||
| 387 | $sukdmig3d_spec ->{_suffix_aref} = \@suffix; | ||
| 388 | return(); | ||
| 389 | |||
| 390 | } | ||
| 391 | |||
| 392 | |||
| 393 | =head2 sub variables | ||
| 394 | |||
| 395 | |||
| 396 | return a hash array | ||
| 397 | with definitions | ||
| 398 | |||
| 399 | =cut | ||
| 400 | |||
| 401 | sub variables { | ||
| 402 | |||
| 403 | my ($self) = @_; | ||
| 404 | my $hash_ref = $sukdmig3d_spec; | ||
| 405 | return ($hash_ref); | ||
| 406 | } | ||
| 407 | |||
| 408 | 1; |