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