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